Commit ecd73cc5c9e137559f4625b347f20cf9ed0de3d5

Authored by Benjamin Herrenschmidt
1 parent de021bb79c

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>

Showing 5 changed files with 37 additions and 21 deletions Side-by-side Diff

arch/powerpc/include/asm/io.h
... ... @@ -69,9 +69,11 @@
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
74 75 #endif
  76 +#endif
75 77  
76 78 /*
77 79 *
... ... @@ -222,9 +224,9 @@
222 224 * for PowerPC is as close as possible to the x86 version of these, and thus
223 225 * provides fairly heavy weight barriers for the non-raw versions
224 226 *
225   - * In addition, they support a hook mechanism when CONFIG_PPC_INDIRECT_IO
226   - * allowing the platform to provide its own implementation of some or all
227   - * of the accessors.
  227 + * In addition, they support a hook mechanism when CONFIG_PPC_INDIRECT_MMIO
  228 + * or CONFIG_PPC_INDIRECT_PIO are set allowing the platform to provide its
  229 + * own implementation of some or all of the accessors.
228 230 */
229 231  
230 232 /*
... ... @@ -240,8 +242,8 @@
240 242  
241 243 /* Indirect IO address tokens:
242 244 *
243   - * When CONFIG_PPC_INDIRECT_IO is set, the platform can provide hooks
244   - * on all IOs. (Note that this is all 64 bits only for now)
  245 + * When CONFIG_PPC_INDIRECT_MMIO is set, the platform can provide hooks
  246 + * on all MMIOs. (Note that this is all 64 bits only for now)
245 247 *
246 248 * To help platforms who may need to differenciate MMIO addresses in
247 249 * their hooks, a bitfield is reserved for use by the platform near the
248 250  
249 251  
... ... @@ -263,11 +265,14 @@
263 265 *
264 266 * The direct IO mapping operations will then mask off those bits
265 267 * before doing the actual access, though that only happen when
266   - * CONFIG_PPC_INDIRECT_IO is set, thus be careful when you use that
  268 + * CONFIG_PPC_INDIRECT_MMIO is set, thus be careful when you use that
267 269 * mechanism
  270 + *
  271 + * For PIO, there is a separate CONFIG_PPC_INDIRECT_PIO which makes
  272 + * all PIO functions call through a hook.
268 273 */
269 274  
270   -#ifdef CONFIG_PPC_INDIRECT_IO
  275 +#ifdef CONFIG_PPC_INDIRECT_MMIO
271 276 #define PCI_IO_IND_TOKEN_MASK 0x0fff000000000000ul
272 277 #define PCI_IO_IND_TOKEN_SHIFT 48
273 278 #define PCI_FIX_ADDR(addr) \
... ... @@ -672,7 +677,7 @@
672 677 extern void __iounmap_at(void *ea, unsigned long size);
673 678  
674 679 /*
675   - * When CONFIG_PPC_INDIRECT_IO is set, we use the generic iomap implementation
  680 + * When CONFIG_PPC_INDIRECT_PIO is set, we use the generic iomap implementation
676 681 * which needs some additional definitions here. They basically allow PIO
677 682 * space overall to be 1GB. This will work as long as we never try to use
678 683 * iomap to map MMIO below 1GB which should be fine on ppc64
arch/powerpc/kernel/Makefile
... ... @@ -119,7 +119,7 @@
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  
arch/powerpc/kernel/io-workarounds.c
... ... @@ -53,6 +53,7 @@
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;
59 60  
60 61  
61 62  
... ... @@ -90,14 +91,26 @@
90 91  
91 92 return bus;
92 93 }
  94 +#else /* CONFIG_PPC_INDIRECT_MMIO */
  95 +struct iowa_bus *iowa_mem_find_bus(const PCI_IO_ADDR addr)
  96 +{
  97 + return NULL;
  98 +}
  99 +#endif /* !CONFIG_PPC_INDIRECT_MMIO */
93 100  
  101 +#ifdef CONFIG_PPC_INDIRECT_PIO
94 102 struct iowa_bus *iowa_pio_find_bus(unsigned long port)
95 103 {
96 104 unsigned long vaddr = (unsigned long)pci_io_base + port;
97 105 return iowa_pci_find(vaddr, 0);
98 106 }
  107 +#else
  108 +struct iowa_bus *iowa_pio_find_bus(unsigned long port)
  109 +{
  110 + return NULL;
  111 +}
  112 +#endif
99 113  
100   -
101 114 #define DEF_PCI_AC_RET(name, ret, at, al, space, aa) \
102 115 static ret iowa_##name at \
103 116 { \
... ... @@ -137,6 +150,7 @@
137 150  
138 151 };
139 152  
  153 +#ifdef CONFIG_PPC_INDIRECT_MMIO
140 154 static void __iomem *iowa_ioremap(phys_addr_t addr, unsigned long size,
141 155 unsigned long flags, void *caller)
142 156 {
... ... @@ -151,6 +165,9 @@
151 165 }
152 166 return res;
153 167 }
  168 +#else /* CONFIG_PPC_INDIRECT_MMIO */
  169 +#define iowa_ioremap NULL
  170 +#endif /* !CONFIG_PPC_INDIRECT_MMIO */
154 171  
155 172 /* Enable IO workaround */
156 173 static void io_workaround_init(void)
arch/powerpc/kernel/setup_64.c
... ... @@ -716,8 +716,8 @@
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 */
  722 +#endif
arch/powerpc/platforms/Kconfig
... ... @@ -202,17 +202,12 @@
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