Skip to contentSkip to conversation

MIPS: OCTEON: Changes to support readq()/writeq() usage.

PATCH Applied Steven J. Hill 4 participants 5 messages Jul 9, 2016 – Aug 13, 2016 MIPS

lore
Share & tools
lore
#0 lore raw

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
index ac91939..ab255dd 100644
@@ -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
index 64f852b..cb16fcc 100644
@@ -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
Applied
#1 lore raw
Quoted 8 lines · Steven J. Hill

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.

Thanks, applied.

Ralf

#2 lore raw
In reply to Steven J. Hill

Hi,

Quoted 8 lines · Steven J. Hill

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/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/includ
e/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/g

ettimeofday.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.

#3 lore raw
Quoted 14 lines · Aaro Koskinen

Hi,

Quoted 8 lines · Steven J. Hill

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.

[...]

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/includ e/asm/io.h:32:0,
from /home/aaro/los/work/shared/linux-v4.8-rc1/arch/mips/includ
e/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/g

ettimeofday.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.

#4 lore raw

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() 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.

[...]

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=y
CONFIG_CAVIUM_CN63XXP1=y
CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE=2
# CONFIG_COMPACTION is not set
CONFIG_SMP=y
CONFIG_NR_CPUS=2
CONFIG_HZ_100=y
CONFIG_MIPS_ELF_APPENDED_DTB=y
CONFIG_LOCALVERSION="-octeon"
CONFIG_SYSVIPC=y
CONFIG_POSIX_MQUEUE=y
CONFIG_NO_HZ_IDLE=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_LOG_BUF_SHIFT=14
CONFIG_SCHED_AUTOGROUP=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_EMBEDDED=y
# CONFIG_PERF_EVENTS is not set
CONFIG_PROFILING=y
CONFIG_OPROFILE=m
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
# CONFIG_BLK_DEV_BSG is not set
CONFIG_PCI=y
CONFIG_PCI_MSI=y
CONFIG_MIPS32_O32=y
CONFIG_MIPS32_N32=y
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_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 set
CONFIG_BRIDGE=y
# CONFIG_BRIDGE_IGMP_SNOOPING is not set
CONFIG_CFG80211=y
CONFIG_MAC80211=y
CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
CONFIG_DEVTMPFS=y
# CONFIG_FW_LOADER is not set
CONFIG_MTD=y
CONFIG_MTD_CMDLINE_PARTS=y
# CONFIG_MTD_OF_PARTS is not set
CONFIG_MTD_BLOCK=y
CONFIG_MTD_CFI=y
CONFIG_MTD_CFI_AMDSTD=y
CONFIG_MTD_SLRAM=y
CONFIG_BLK_DEV_LOOP=y
CONFIG_EEPROM_AT24=y
CONFIG_EEPROM_AT25=y
CONFIG_SCSI=y
CONFIG_BLK_DEV_SD=y
CONFIG_BLK_DEV_SR=y
CONFIG_BLK_DEV_SR_VENDOR=y
# CONFIG_SCSI_LOWLEVEL is not set
CONFIG_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 set
CONFIG_AT803X_PHY=m
CONFIG_BROADCOM_PHY=m
CONFIG_PPP=y
CONFIG_PPP_DEFLATE=y
CONFIG_PPP_ASYNC=y
# CONFIG_ATH9K_BTCOEX_SUPPORT is not set
CONFIG_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 set
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_8250_NR_UARTS=2
CONFIG_SERIAL_8250_RUNTIME_UARTS=2
CONFIG_SERIAL_8250_EXTENDED=y
CONFIG_SERIAL_8250_DW=y
# CONFIG_HW_RANDOM is not set
CONFIG_I2C=y
CONFIG_I2C_OCTEON=y
CONFIG_SPI=y
CONFIG_SPI_OCTEON=y
CONFIG_GPIO_SYSFS=y
# CONFIG_HWMON is not set
CONFIG_WATCHDOG=y
# CONFIG_VGA_ARB is not set
CONFIG_USB=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_HCD_PLATFORM=y
CONFIG_USB_OHCI_HCD=y
CONFIG_USB_OHCI_HCD_PLATFORM=y
CONFIG_USB_ACM=y
CONFIG_USB_STORAGE=y
CONFIG_USB_SERIAL=y
CONFIG_USB_SERIAL_OPTION=y
CONFIG_LEDS_GPIO=y
CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_DS1307=y
CONFIG_STAGING=y
CONFIG_OCTEON_ETHERNET=y
CONFIG_OCTEON_USB=y
# CONFIG_IOMMU_SUPPORT is not set
CONFIG_EXT4_FS=y
CONFIG_MSDOS_FS=y
CONFIG_VFAT_FS=y
CONFIG_PROC_KCORE=y
CONFIG_TMPFS=y
# CONFIG_MISC_FILESYSTEMS is not set
# CONFIG_NETWORK_FILESYSTEMS is not set
CONFIG_NLS_CODEPAGE_437=y
CONFIG_NLS_ASCII=y
CONFIG_NLS_ISO8859_1=y
CONFIG_NLS_UTF8=y
CONFIG_PRINTK_TIME=y
CONFIG_DEBUG_INFO=y
CONFIG_MAGIC_SYSRQ=y
CONFIG_LOCKUP_DETECTOR=y
# CONFIG_SCHED_DEBUG is not set
# CONFIG_FTRACE is not set
CONFIG_CRYPTO_TEST=m
CONFIG_CRYPTO_MD5_OCTEON=y
# CONFIG_CRYPTO_HW is not set

A.