# git rev-parse -q --verify 6d3350efdc57b346112536c8e413e88940233642^{commit} 6d3350efdc57b346112536c8e413e88940233642 already have revision, skipping fetch # git checkout -q -f -B kisskb 6d3350efdc57b346112536c8e413e88940233642 # git clean -qxdf # < git log -1 # commit 6d3350efdc57b346112536c8e413e88940233642 # Author: Michael Ellerman # Date: Tue Nov 6 23:37:58 2018 +1100 # # powerpc/io: Fix the IO workarounds code to work with Radix # # Back in 2006 Ben added some workarounds for a misbehaviour in the # Spider IO bridge used on early Cell machines, see commit # 014da7ff47b5 ("[POWERPC] Cell "Spider" MMIO workarounds"). Later these # were made to be generic, ie. not tied specifically to Spider. # # The code stashes a token in the high bits (59-48) of virtual addresses # used for IO (eg. returned from ioremap()). This works fine when using # the Hash MMU, but when we're using the Radix MMU the bits used for the # token overlap with some of the bits of the virtual address. # # This is because the maximum virtual address is larger with Radix, up # to c00fffffffffffff, and in fact we use that high part of the address # range for ioremap(), see RADIX_KERN_IO_START. # # As it happens the bits that are used overlap with the bits that # differentiate an IO address vs a linear map address. If the resulting # address lies outside the linear mapping we will crash (see below), if # not we just corrupt memory. # # virtio-pci 0000:00:00.0: Using 64-bit direct DMA at offset 800000000000000 # Unable to handle kernel paging request for data at address 0xc000000080000014 # ... # CFAR: c000000000626b98 DAR: c000000080000014 DSISR: 42000000 IRQMASK: 0 # GPR00: c0000000006c54fc c00000003e523378 c0000000016de600 0000000000000000 # GPR04: c00c000080000014 0000000000000007 0fffffff000affff 0000000000000030 # ^^^^ # ... # NIP [c000000000626c5c] .iowrite8+0xec/0x100 # LR [c0000000006c992c] .vp_reset+0x2c/0x90 # Call Trace: # .pci_bus_read_config_dword+0xc4/0x120 (unreliable) # .register_virtio_device+0x13c/0x1c0 # .virtio_pci_probe+0x148/0x1f0 # .local_pci_probe+0x68/0x140 # .pci_device_probe+0x164/0x220 # .really_probe+0x274/0x3b0 # .driver_probe_device+0x80/0x170 # .__driver_attach+0x14c/0x150 # .bus_for_each_dev+0xb8/0x130 # .driver_attach+0x34/0x50 # .bus_add_driver+0x178/0x2f0 # .driver_register+0x90/0x1a0 # .__pci_register_driver+0x6c/0x90 # .virtio_pci_driver_init+0x2c/0x40 # .do_one_initcall+0x64/0x280 # .kernel_init_freeable+0x36c/0x474 # .kernel_init+0x24/0x160 # .ret_from_kernel_thread+0x58/0x7c # # This hasn't been a problem because CONFIG_PPC_IO_WORKAROUNDS which # enables this code is usually not enabled. It is only enabled when it's # selected by PPC_CELL_NATIVE which is only selected by # PPC_IBM_CELL_BLADE and that in turn depends on BIG_ENDIAN. So in order # to hit the bug you need to build a big endian kernel, with IBM Cell # Blade support enabled, as well as Radix MMU support, and then boot # that on Power9 using Radix MMU. # # Still we can fix the bug, so let's do that. We simply use fewer bits # for the token, taking the union of the restrictions on the address # from both Hash and Radix, we end up with 8 bits we can use for the # token. The only user of the token is iowa_mem_find_bus() which only # supports 8 token values, so 8 bits is plenty for that. # # Fixes: 566ca99af026 ("powerpc/mm/radix: Add dummy radix_enabled()") # Signed-off-by: Michael Ellerman # < /opt/cross/kisskb/korg/gcc-5.5.0-nolibc/powerpc64-linux/bin/powerpc64-linux-gcc --version # < git log --format=%s --max-count=1 6d3350efdc57b346112536c8e413e88940233642 # < make -s -j 48 ARCH=powerpc O=/kisskb/build/powerpc-fixes_mpc85xx_smp_defconfig_powerpc-gcc5 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-5.5.0-nolibc/powerpc64-linux/bin/powerpc64-linux- mpc85xx_smp_defconfig # make -s -j 48 ARCH=powerpc O=/kisskb/build/powerpc-fixes_mpc85xx_smp_defconfig_powerpc-gcc5 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-5.5.0-nolibc/powerpc64-linux/bin/powerpc64-linux- In file included from /kisskb/src/include/linux/kernel.h:10:0, from /kisskb/src/include/linux/list.h:9, from /kisskb/src/include/linux/module.h:9, from /kisskb/src/drivers/net/ethernet/freescale/fs_enet/mac-scc.c:15: /kisskb/src/drivers/net/ethernet/freescale/fs_enet/mac-scc.c: In function 'allocate_bd': /kisskb/src/include/linux/err.h:22:49: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] #define IS_ERR_VALUE(x) unlikely((unsigned long)(void *)(x) >= (unsigned long)-MAX_ERRNO) ^ /kisskb/src/include/linux/compiler.h:77:42: note: in definition of macro 'unlikely' # define unlikely(x) __builtin_expect(!!(x), 0) ^ /kisskb/src/drivers/net/ethernet/freescale/fs_enet/mac-scc.c:139:6: note: in expansion of macro 'IS_ERR_VALUE' if (IS_ERR_VALUE(fep->ring_mem_addr)) ^ arch/powerpc/boot/dts/fsl/mpc8555cds.dtb: Warning (pci_device_bus_num): /pci@e0008000/i8259@19000:bus-range: PCI bus number 1 out of range, expected (0 - 0) arch/powerpc/boot/dts/fsl/mpc8541cds.dtb: Warning (pci_device_bus_num): /pci@e0008000/i8259@19000:bus-range: PCI bus number 1 out of range, expected (0 - 0) INFO: Uncompressed kernel (size 0xc23c30) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xd00000) INFO: Uncompressed kernel (size 0xc23c30) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xd00000) INFO: Uncompressed kernel (size 0xc23c30) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xd00000) INFO: Uncompressed kernel (size 0xc23c30) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xd00000) INFO: Uncompressed kernel (size 0xc23c30) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xd00000) INFO: Uncompressed kernel (size 0xc23c30) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xd00000) INFO: Uncompressed kernel (size 0xc23c30) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xd00000) INFO: Uncompressed kernel (size 0xc23c30) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xd00000) INFO: Uncompressed kernel (size 0xc23c30) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xd00000) INFO: Uncompressed kernel (size 0xc23c30) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xd00000) INFO: Uncompressed kernel (size 0xc23c30) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xd00000) INFO: Uncompressed kernel (size 0xc23c30) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xd00000) INFO: Uncompressed kernel (size 0xc23c30) overlaps the address of the wrapper(0x400000) INFO: Uncompressed kernel (size 0xc23c30) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xd00000) INFO: Fixing the link_address of wrapper to (0xd00000) INFO: Uncompressed kernel (size 0xc23c30) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xd00000) INFO: Uncompressed kernel (size 0xc1343c) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xd00000) Image Name: Linux-4.20.0-rc1-g6d3350efdc57 Created: Thu Nov 8 00:40:15 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5996776 Bytes = 5856.23 KiB = 5.72 MiB Load Address: 00d00000 Entry Point: 00d00320 Image Name: Linux-4.20.0-rc1-g6d3350efdc57 Created: Thu Nov 8 00:40:15 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5996774 Bytes = 5856.22 KiB = 5.72 MiB Load Address: 00d00000 Entry Point: 00d00320 Image Name: Linux-4.20.0-rc1-g6d3350efdc57 Created: Thu Nov 8 00:40:15 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5997987 Bytes = 5857.41 KiB = 5.72 MiB Load Address: 00d00000 Entry Point: 00d002b0 Image Name: Linux-4.20.0-rc1-g6d3350efdc57 Created: Thu Nov 8 00:40:15 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5995868 Bytes = 5855.34 KiB = 5.72 MiB Load Address: 00d00000 Entry Point: 00d002b0 Image Name: Linux-4.20.0-rc1-g6d3350efdc57 Created: Thu Nov 8 00:40:15 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5996129 Bytes = 5855.59 KiB = 5.72 MiB Load Address: 00d00000 Entry Point: 00d002b0 Image Name: Linux-4.20.0-rc1-g6d3350efdc57 Created: Thu Nov 8 00:40:15 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5997024 Bytes = 5856.47 KiB = 5.72 MiB Load Address: 00d00000 Entry Point: 00d002b0 Image Name: Linux-4.20.0-rc1-g6d3350efdc57 Created: Thu Nov 8 00:40:15 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5965313 Bytes = 5825.50 KiB = 5.69 MiB Load Address: 00000000 Entry Point: 00000000 Image Name: Linux-4.20.0-rc1-g6d3350efdc57 Created: Thu Nov 8 00:40:15 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5996798 Bytes = 5856.25 KiB = 5.72 MiB Load Address: 00d00000 Entry Point: 00d002b0 Image Name: Linux-4.20.0-rc1-g6d3350efdc57 Created: Thu Nov 8 00:40:15 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5996114 Bytes = 5855.58 KiB = 5.72 MiB Load Address: 00d00000 Entry Point: 00d002b0 Image Name: Linux-4.20.0-rc1-g6d3350efdc57 Created: Thu Nov 8 00:40:15 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5998083 Bytes = 5857.50 KiB = 5.72 MiB Load Address: 00d00000 Entry Point: 00d002b0 Image Name: Linux-4.20.0-rc1-g6d3350efdc57 Created: Thu Nov 8 00:40:15 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5996767 Bytes = 5856.22 KiB = 5.72 MiB Load Address: 00d00000 Entry Point: 00d002b0 Image Name: Linux-4.20.0-rc1-g6d3350efdc57 Created: Thu Nov 8 00:40:15 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5996438 Bytes = 5855.90 KiB = 5.72 MiB Load Address: 00d00000 Entry Point: 00d00320 Image Name: Linux-4.20.0-rc1-g6d3350efdc57 Created: Thu Nov 8 00:40:15 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5996137 Bytes = 5855.60 KiB = 5.72 MiB Load Address: 00d00000 Entry Point: 00d002b0 Image Name: Linux-4.20.0-rc1-g6d3350efdc57 Created: Thu Nov 8 00:40:15 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5996136 Bytes = 5855.60 KiB = 5.72 MiB Load Address: 00d00000 Entry Point: 00d00320 Image Name: Linux-4.20.0-rc1-g6d3350efdc57 Created: Thu Nov 8 00:40:15 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5998146 Bytes = 5857.56 KiB = 5.72 MiB Load Address: 00d00000 Entry Point: 00d002b0 Image Name: Linux-4.20.0-rc1-g6d3350efdc57 Created: Thu Nov 8 00:40:15 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5996026 Bytes = 5855.49 KiB = 5.72 MiB Load Address: 00d00000 Entry Point: 00d00320 Completed OK # rm -rf /kisskb/build/powerpc-fixes_mpc85xx_smp_defconfig_powerpc-gcc5 # Build took: 0:01:45.238754