Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc: Better split CONFIG_PPC_INDIRECT_PIO and CONFIG_PPC_INDIRECT_MMIO

Remove the generic PPC_INDIRECT_IO and ensure we only add overhead
to the right accessors. IE. If only CONFIG_PPC_INDIRECT_PIO is set,
we don't add overhead to all MMIO accessors.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

+37 -21
+15 -10
arch/powerpc/include/asm/io.h
··· 69 69 70 70 extern resource_size_t isa_mem_base; 71 71 72 - #if defined(CONFIG_PPC32) && defined(CONFIG_PPC_INDIRECT_IO) 73 - #error CONFIG_PPC_INDIRECT_IO is not yet supported on 32 bits 72 + #ifdef CONFIG_PPC32 73 + #if defined(CONFIG_PPC_INDIRECT_PIO) || defined(CONFIG_PPC_INDIRECT_MMIO) 74 + #error CONFIG_PPC_INDIRECT_{PIO,MMIO} are not yet supported on 32 bits 75 + #endif 74 76 #endif 75 77 76 78 /* ··· 224 222 * for PowerPC is as close as possible to the x86 version of these, and thus 225 223 * provides fairly heavy weight barriers for the non-raw versions 226 224 * 227 - * In addition, they support a hook mechanism when CONFIG_PPC_INDIRECT_IO 228 - * allowing the platform to provide its own implementation of some or all 229 - * of the accessors. 225 + * In addition, they support a hook mechanism when CONFIG_PPC_INDIRECT_MMIO 226 + * or CONFIG_PPC_INDIRECT_PIO are set allowing the platform to provide its 227 + * own implementation of some or all of the accessors. 230 228 */ 231 229 232 230 /* ··· 242 240 243 241 /* Indirect IO address tokens: 244 242 * 245 - * When CONFIG_PPC_INDIRECT_IO is set, the platform can provide hooks 246 - * on all IOs. (Note that this is all 64 bits only for now) 243 + * When CONFIG_PPC_INDIRECT_MMIO is set, the platform can provide hooks 244 + * on all MMIOs. (Note that this is all 64 bits only for now) 247 245 * 248 246 * To help platforms who may need to differenciate MMIO addresses in 249 247 * their hooks, a bitfield is reserved for use by the platform near the ··· 265 263 * 266 264 * The direct IO mapping operations will then mask off those bits 267 265 * before doing the actual access, though that only happen when 268 - * CONFIG_PPC_INDIRECT_IO is set, thus be careful when you use that 266 + * CONFIG_PPC_INDIRECT_MMIO is set, thus be careful when you use that 269 267 * mechanism 268 + * 269 + * For PIO, there is a separate CONFIG_PPC_INDIRECT_PIO which makes 270 + * all PIO functions call through a hook. 270 271 */ 271 272 272 - #ifdef CONFIG_PPC_INDIRECT_IO 273 + #ifdef CONFIG_PPC_INDIRECT_MMIO 273 274 #define PCI_IO_IND_TOKEN_MASK 0x0fff000000000000ul 274 275 #define PCI_IO_IND_TOKEN_SHIFT 48 275 276 #define PCI_FIX_ADDR(addr) \ ··· 677 672 extern void __iounmap_at(void *ea, unsigned long size); 678 673 679 674 /* 680 - * When CONFIG_PPC_INDIRECT_IO is set, we use the generic iomap implementation 675 + * When CONFIG_PPC_INDIRECT_PIO is set, we use the generic iomap implementation 681 676 * which needs some additional definitions here. They basically allow PIO 682 677 * space overall to be 1GB. This will work as long as we never try to use 683 678 * iomap to map MMIO below 1GB which should be fine on ppc64
+1 -1
arch/powerpc/kernel/Makefile
··· 119 119 120 120 obj-$(CONFIG_8XX_MINIMAL_FPEMU) += softemu8xx.o 121 121 122 - ifneq ($(CONFIG_PPC_INDIRECT_IO),y) 122 + ifneq ($(CONFIG_PPC_INDIRECT_PIO),y) 123 123 obj-y += iomap.o 124 124 endif 125 125
+18 -1
arch/powerpc/kernel/io-workarounds.c
··· 53 53 return NULL; 54 54 } 55 55 56 + #ifdef CONFIG_PPC_INDIRECT_MMIO 56 57 struct iowa_bus *iowa_mem_find_bus(const PCI_IO_ADDR addr) 57 58 { 58 59 unsigned hugepage_shift; ··· 91 90 92 91 return bus; 93 92 } 93 + #else /* CONFIG_PPC_INDIRECT_MMIO */ 94 + struct iowa_bus *iowa_mem_find_bus(const PCI_IO_ADDR addr) 95 + { 96 + return NULL; 97 + } 98 + #endif /* !CONFIG_PPC_INDIRECT_MMIO */ 94 99 100 + #ifdef CONFIG_PPC_INDIRECT_PIO 95 101 struct iowa_bus *iowa_pio_find_bus(unsigned long port) 96 102 { 97 103 unsigned long vaddr = (unsigned long)pci_io_base + port; 98 104 return iowa_pci_find(vaddr, 0); 99 105 } 100 - 106 + #else 107 + struct iowa_bus *iowa_pio_find_bus(unsigned long port) 108 + { 109 + return NULL; 110 + } 111 + #endif 101 112 102 113 #define DEF_PCI_AC_RET(name, ret, at, al, space, aa) \ 103 114 static ret iowa_##name at \ ··· 150 137 151 138 }; 152 139 140 + #ifdef CONFIG_PPC_INDIRECT_MMIO 153 141 static void __iomem *iowa_ioremap(phys_addr_t addr, unsigned long size, 154 142 unsigned long flags, void *caller) 155 143 { ··· 165 151 } 166 152 return res; 167 153 } 154 + #else /* CONFIG_PPC_INDIRECT_MMIO */ 155 + #define iowa_ioremap NULL 156 + #endif /* !CONFIG_PPC_INDIRECT_MMIO */ 168 157 169 158 /* Enable IO workaround */ 170 159 static void io_workaround_init(void)
+2 -3
arch/powerpc/kernel/setup_64.c
··· 716 716 #endif 717 717 718 718 719 - #ifdef CONFIG_PPC_INDIRECT_IO 719 + #if defined(CONFIG_PPC_INDIRECT_PIO) || defined(CONFIG_PPC_INDIRECT_MMIO) 720 720 struct ppc_pci_io ppc_pci_io; 721 721 EXPORT_SYMBOL(ppc_pci_io); 722 - #endif /* CONFIG_PPC_INDIRECT_IO */ 723 - 722 + #endif
+1 -6
arch/powerpc/platforms/Kconfig
··· 202 202 bool 203 203 default n 204 204 205 - config PPC_INDIRECT_IO 205 + config PPC_INDIRECT_PIO 206 206 bool 207 207 select GENERIC_IOMAP 208 208 209 - config PPC_INDIRECT_PIO 210 - bool 211 - select PPC_INDIRECT_IO 212 - 213 209 config PPC_INDIRECT_MMIO 214 210 bool 215 - select PPC_INDIRECT_IO 216 211 217 212 config PPC_IO_WORKAROUNDS 218 213 bool