MIPS: OCTEON: Changes to support readq()/writeq() usage.
PATCH 1/1 MIPS: OCTEON: Changes to support readq()/writeq() usage.
Update OCTEON port mangling code to support readq() and writeq() functions to allow driver code to be more portable. Updates also for word and long function pairs. We also remove SWAP_IO_SPACE for OCTEON platforms as the function macros are redundant with the new mangling code.
--- arch/mips/Kconfig | 1 - arch/mips/cavium-octeon/setup.c | 20 ++++++++++- .../include/asm/mach-cavium-octeon/mangle-port.h | 42 +++++++--------------- 3 files changed, 32 insertions(+), 31 deletions(-)
arch/mips/Kconfig +0 -1
@@ -880,7 +880,6 @@ config CAVIUM_OCTEON_SOC select SYS_SUPPORTS_HOTPLUG_CPU if CPU_BIG_ENDIAN select SYS_HAS_EARLY_PRINTK select SYS_HAS_CPU_CAVIUM_OCTEON - select SWAP_IO_SPACE select HW_HAS_PCI select ZONE_DMA32 select HOLES_IN_ZONE
arch/mips/cavium-octeon/setup.c +19 -1
@@ -40,9 +40,27 @@#include <asm/octeon/octeon.h> #include <asm/octeon/pci-octeon.h> -#include <asm/octeon/cvmx-mio-defs.h> #include <asm/octeon/cvmx-rst-defs.h> +/* +* TRUE for devices having registers with little-endian byte +* order, FALSE for registers with native-endian byte order. +* PCI mandates little-endian, USB and SATA are configuraable, +* but we chose little-endian for these. +*/ +const bool octeon_should_swizzle_table[256 ] = { + [0x00 ] = true,/* bootbus/CF */ + [0x1b ] = true,/* PCI mmio window */ + [0x1c ] = true,/* PCI mmio window */ + [0x1d ] = true,/* PCI mmio window */ + [0x1e ] = true,/* PCI mmio window */ + [0x68 ] = true,/* OCTEON III USB */ + [0x69 ] = true,/* OCTEON III USB */ + [0x6c ] = true,/* OCTEON III SATA */ + [0x6f ] = true,/* OCTEON II USB */ +}; +EXPORT_SYMBOL (octeon_should_swizzle_table); +#ifdef CONFIG_PCI extern void pci_console_init (const char *arg);#endif
arch/mips/include/asm/mach-cavium-octeon/mangle-port.h +13 -29
65 lines not on this page · raw message
Signature · 1 line
1.9.1
Ralf Baechle
AppliedQuoted 8 lines · Steven J. Hill
Update OCTEON port mangling code to support
readq()andwriteq()functions to allow driver code to be more portable. Updates also for word and long function pairs. We also removeSWAP_IO_SPACEfor OCTEON platforms as the function macros are redundant with the new mangling code.Signed-off-by Steven J. Hill <[email protected]>Acked-by David Daney <[email protected]>
Thanks, applied.
Ralf
Hi,
Quoted 8 lines · Steven J. Hill
Update OCTEON port mangling code to support
readq()andwriteq()functions to allow driver code to be more portable. Updates also for word and long function pairs. We also removeSWAP_IO_SPACEfor OCTEON platforms as the function macros are redundant with the new mangling code.Signed-off-by Steven J. Hill <[email protected]>Acked-by David Daney <[email protected]>
[...]
arch/mips/include/asm/mach-cavium-octeon/mangle-port.h line 21
Quoted 7 lines
arch/mips/include/asm/mach-cavium-octeon/mangle-port.h +7
-0+static inline bool __should_swizzle_bits (volatile void *a) +{ +extern const bool octeon_should_swizzle_table[]; + +unsigned long did = ((unsigned long )a >>40 ) &0xff ; +return octeon_should_swizzle_table[did]; +}
v4.8-rc1 OCTEON build is now broken with GCC 6.1 when support for 32-bit ABIs is enabled:
CC arch/mips/vdso/gettimeofday-o32.o
In file included from /home/aaro/los/work/shared/linux-v4.8-rc1/arch/mips/includ e/asm/io.h:32:0,
from /home/aaro/los/work/shared/linux-v4.8-rc1/arch/mips/include/asm/page.h:194,
from /home/aaro/los/work/shared/linux-v4.8-rc1/arch/mips/vdso/v
dso.h:26,
from /home/aaro/los/work/shared/linux-v4.8-rc1/arch/mips/vdso/gettimeofday.c:11:/home/aaro/los/work/shared/linux-v4.8-rc1/arch/mips/include/asm/mach-cavium-octe on/mangle-port.h: In function '__should_swizzle_bits':/home/aaro/los/work/shared/linux-v4.8-rc1/arch/mips/include/asm/mach-cavium-octe on/mangle-port.h:19:40: error: right shift count >= width of type [-Werror=shift -count-overflow]
unsigned long did = ((unsigned long)a >> 40) & 0xff;
A.
Quoted 14 lines · Aaro Koskinen
Hi,
Quoted 8 lines · Steven J. Hill
Update OCTEON port mangling code to support
readq()andwriteq()functions to allow driver code to be more portable. Updates also for word and long function pairs. We also removeSWAP_IO_SPACEfor OCTEON platforms as the function macros are redundant with the new mangling code.Signed-off-by Steven J. Hill <[email protected]>Acked-by David Daney <[email protected]>[...]
Quoted 10 lines
arch/mips/include/asm/mach-cavium-octeon/mangle-port.h line 21
Quoted 7 lines
arch/mips/include/asm/mach-cavium-octeon/mangle-port.h +7
-0+static inline bool __should_swizzle_bits (volatile void *a) +{ +extern const bool octeon_should_swizzle_table[]; + +unsigned long did = ((unsigned long )a >>40 ) &0xff ; +return octeon_should_swizzle_table[did]; +}v4.8-rc1 OCTEON build is now broken with GCC 6.1 when support for 32-bit ABIs is enabled:
I don't get it. The kernel is always 64-bit, so unsigned long will have a width of 64.
What kernel config are you using?
Quoted 19 lines
CC
arch/mips/vdso/gettimeofday-o32.o
In file included from/home/aaro/los/work/shared/linux-v4.8-rc1/arch/mips/include/asm/io.h:32:0,
from/home/aaro/los/work/shared/linux-v4.8-rc1/arch/mips/include/asm/page.h:194,from /home/aaro/los/work/shared/linux-v4.8-rc1/arch/mips/vdso/v dso.h:26, from /home/aaro/los/work/shared/linux-v4.8-rc1/arch/mips/vdso/gettimeofday.c:11:
/home/aaro/los/work/shared/linux-v4.8-rc1/arch/mips/include/asm/mach-cavium-octeon/mangle-port.h: In function '__should_swizzle_bits':/home/aaro/los/work/shared/linux-v4.8-rc1/arch/mips/include/asm/mach-cavium-octeon/mangle-port.h:19:40: error: right shift count >= width of type [-Werror=shift -count-overflow]
unsigned long did = ((unsigned long)a >> 40) &0xff;A.
Hi,
Quoted 24 lines · David Daney
Quoted 12 lines · Aaro Koskinen
Quoted 8 lines · Steven J. Hill
Update OCTEON port mangling code to support
readq()andwriteq()functions to allow driver code to be more portable. Updates also for word and long function pairs. We also removeSWAP_IO_SPACEfor OCTEON platforms as the function macros are redundant with the new mangling code.Signed-off-by Steven J. Hill <[email protected]>Acked-by David Daney <[email protected]>[...]
Quoted 10 lines
arch/mips/include/asm/mach-cavium-octeon/mangle-port.h line 21
Quoted 7 lines
arch/mips/include/asm/mach-cavium-octeon/mangle-port.h +7
-0+static inline bool __should_swizzle_bits (volatile void *a) +{ +extern const bool octeon_should_swizzle_table[]; + +unsigned long did = ((unsigned long )a >>40 ) &0xff ; +return octeon_should_swizzle_table[did]; +}v4.8-rc1 OCTEON build is now broken with GCC 6.1 when support for 32-bit ABIs is enabled:
Quoted 2 lines
I don't get it. The kernel is always 64-bit, so unsigned long will have a width of 64.
VDSO code is built with -mabi=32 when CONFIG_MIPS32_O32 is enabled (see arch/mips/vdso/Makefile).
Quoted 1 line
What kernel config are you using?
See below. AFAIK, you cannot disable VDSO?
...
CONFIG_CAVIUM_OCTEON_SOC=yCONFIG_CAVIUM_CN63XXP1=yCONFIG_CAVIUM_OCTEON_CVMSEG_SIZE=2
# CONFIG_COMPACTION is not setCONFIG_SMP=yCONFIG_NR_CPUS=2CONFIG_HZ_100=yCONFIG_MIPS_ELF_APPENDED_DTB=yCONFIG_LOCALVERSION="-octeon"CONFIG_SYSVIPC=yCONFIG_POSIX_MQUEUE=yCONFIG_NO_HZ_IDLE=yCONFIG_HIGH_RES_TIMERS=yCONFIG_LOG_BUF_SHIFT=14CONFIG_SCHED_AUTOGROUP=yCONFIG_BLK_DEV_INITRD=yCONFIG_EMBEDDED=y
# CONFIG_PERF_EVENTS is not setCONFIG_PROFILING=yCONFIG_OPROFILE=mCONFIG_MODULES=yCONFIG_MODULE_UNLOAD=y
# CONFIG_BLK_DEV_BSG is not setCONFIG_PCI=yCONFIG_PCI_MSI=yCONFIG_MIPS32_O32=yCONFIG_MIPS32_N32=yCONFIG_NET=yCONFIG_PACKET=yCONFIG_UNIX=yCONFIG_INET=y
# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
# CONFIG_INET_XFRM_MODE_TUNNEL is not set
# CONFIG_INET_XFRM_MODE_BEET is not set
# CONFIG_INET_DIAG is not set
# CONFIG_IPV6 is not setCONFIG_BRIDGE=y
# CONFIG_BRIDGE_IGMP_SNOOPING is not setCONFIG_CFG80211=yCONFIG_MAC80211=yCONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"CONFIG_DEVTMPFS=y
# CONFIG_FW_LOADER is not setCONFIG_MTD=yCONFIG_MTD_CMDLINE_PARTS=y
# CONFIG_MTD_OF_PARTS is not setCONFIG_MTD_BLOCK=yCONFIG_MTD_CFI=yCONFIG_MTD_CFI_AMDSTD=yCONFIG_MTD_SLRAM=yCONFIG_BLK_DEV_LOOP=yCONFIG_EEPROM_AT24=yCONFIG_EEPROM_AT25=yCONFIG_SCSI=yCONFIG_BLK_DEV_SD=yCONFIG_BLK_DEV_SR=yCONFIG_BLK_DEV_SR_VENDOR=y
# CONFIG_SCSI_LOWLEVEL is not setCONFIG_NETDEVICES=y
# CONFIG_NET_VENDOR_3COM is not set
# CONFIG_NET_VENDOR_ADAPTEC is not set
# CONFIG_NET_VENDOR_ALTEON is not set
# CONFIG_NET_VENDOR_AMD is not set
# CONFIG_NET_VENDOR_ATHEROS is not set
# CONFIG_NET_VENDOR_BROADCOM is not set
# CONFIG_NET_VENDOR_BROCADE is not set
# CONFIG_NET_VENDOR_CHELSIO is not set
# CONFIG_NET_VENDOR_CISCO is not set
# CONFIG_NET_VENDOR_DEC is not set
# CONFIG_NET_VENDOR_DLINK is not set
# CONFIG_NET_VENDOR_EMULEX is not set
# CONFIG_NET_VENDOR_EXAR is not set
# CONFIG_NET_VENDOR_HP is not set
# CONFIG_NET_VENDOR_INTEL is not set
# CONFIG_NET_VENDOR_MARVELL is not set
# CONFIG_NET_VENDOR_MELLANOX is not set
# CONFIG_NET_VENDOR_MICREL is not set
# CONFIG_NET_VENDOR_MICROCHIP is not set
# CONFIG_NET_VENDOR_MYRI is not set
# CONFIG_NET_VENDOR_NATSEMI is not set
# CONFIG_NET_VENDOR_NVIDIA is not set
# CONFIG_NET_VENDOR_OKI is not set
# CONFIG_NET_PACKET_ENGINE is not set
# CONFIG_NET_VENDOR_QLOGIC is not set
# CONFIG_NET_VENDOR_REALTEK is not set
# CONFIG_NET_VENDOR_RDC is not set
# CONFIG_NET_VENDOR_SEEQ is not set
# CONFIG_NET_VENDOR_SILAN is not set
# CONFIG_NET_VENDOR_SIS is not set
# CONFIG_NET_VENDOR_SMSC is not set
# CONFIG_NET_VENDOR_STMICRO is not set
# CONFIG_NET_VENDOR_SUN is not set
# CONFIG_NET_VENDOR_TEHUTI is not set
# CONFIG_NET_VENDOR_TI is not set
# CONFIG_NET_VENDOR_TOSHIBA is not set
# CONFIG_NET_VENDOR_VIA is not set
# CONFIG_NET_VENDOR_WIZNET is not setCONFIG_AT803X_PHY=mCONFIG_BROADCOM_PHY=mCONFIG_PPP=yCONFIG_PPP_DEFLATE=yCONFIG_PPP_ASYNC=y
# CONFIG_ATH9K_BTCOEX_SUPPORT is not setCONFIG_ATH9K=y
# CONFIG_ATH9K_PCOEM is not set
# CONFIG_RTL_CARDS is not set
# CONFIG_INPUT is not set
# CONFIG_SERIO is not set
# CONFIG_VT is not set
# CONFIG_LEGACY_PTYS is not setCONFIG_SERIAL_8250=yCONFIG_SERIAL_8250_CONSOLE=yCONFIG_SERIAL_8250_NR_UARTS=2CONFIG_SERIAL_8250_RUNTIME_UARTS=2CONFIG_SERIAL_8250_EXTENDED=yCONFIG_SERIAL_8250_DW=y
# CONFIG_HW_RANDOM is not setCONFIG_I2C=yCONFIG_I2C_OCTEON=yCONFIG_SPI=yCONFIG_SPI_OCTEON=yCONFIG_GPIO_SYSFS=y
# CONFIG_HWMON is not setCONFIG_WATCHDOG=y
# CONFIG_VGA_ARB is not setCONFIG_USB=yCONFIG_USB_EHCI_HCD=yCONFIG_USB_EHCI_HCD_PLATFORM=yCONFIG_USB_OHCI_HCD=yCONFIG_USB_OHCI_HCD_PLATFORM=yCONFIG_USB_ACM=yCONFIG_USB_STORAGE=yCONFIG_USB_SERIAL=yCONFIG_USB_SERIAL_OPTION=yCONFIG_LEDS_GPIO=yCONFIG_RTC_CLASS=yCONFIG_RTC_DRV_DS1307=yCONFIG_STAGING=yCONFIG_OCTEON_ETHERNET=yCONFIG_OCTEON_USB=y
# CONFIG_IOMMU_SUPPORT is not setCONFIG_EXT4_FS=yCONFIG_MSDOS_FS=yCONFIG_VFAT_FS=yCONFIG_PROC_KCORE=yCONFIG_TMPFS=y
# CONFIG_MISC_FILESYSTEMS is not set
# CONFIG_NETWORK_FILESYSTEMS is not setCONFIG_NLS_CODEPAGE_437=yCONFIG_NLS_ASCII=yCONFIG_NLS_ISO8859_1=yCONFIG_NLS_UTF8=yCONFIG_PRINTK_TIME=yCONFIG_DEBUG_INFO=yCONFIG_MAGIC_SYSRQ=yCONFIG_LOCKUP_DETECTOR=y
# CONFIG_SCHED_DEBUG is not set
# CONFIG_FTRACE is not setCONFIG_CRYPTO_TEST=mCONFIG_CRYPTO_MD5_OCTEON=y
# CONFIG_CRYPTO_HW is not set
A.