diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2013-07-14 23:03:08 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2013-08-14 00:57:50 -0400 |
commit | ecd73cc5c9e137559f4625b347f20cf9ed0de3d5 (patch) | |
tree | dbf8d993e1802bd6a6a3bbf4775dd2c9e7193236 | |
parent | de021bb79c7636df24864fa2dbb958121303663b (diff) |
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>
-rw-r--r-- | arch/powerpc/include/asm/io.h | 25 | ||||
-rw-r--r-- | arch/powerpc/kernel/Makefile | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/io-workarounds.c | 19 | ||||
-rw-r--r-- | arch/powerpc/kernel/setup_64.c | 5 | ||||
-rw-r--r-- | arch/powerpc/platforms/Kconfig | 7 |
5 files changed, 37 insertions, 21 deletions
diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h index dd15e5e37d6d..6cc61a3c43ee 100644 --- a/arch/powerpc/include/asm/io.h +++ b/arch/powerpc/include/asm/io.h | |||
@@ -69,8 +69,10 @@ extern unsigned long pci_dram_offset; | |||
69 | 69 | ||
70 | extern resource_size_t isa_mem_base; | 70 | extern resource_size_t isa_mem_base; |
71 | 71 | ||
72 | #if defined(CONFIG_PPC32) && defined(CONFIG_PPC_INDIRECT_IO) | 72 | #ifdef CONFIG_PPC32 |
73 | #error CONFIG_PPC_INDIRECT_IO is not yet supported on 32 bits | 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 | #endif | 76 | #endif |
75 | 77 | ||
76 | /* | 78 | /* |
@@ -222,9 +224,9 @@ extern void _memcpy_toio(volatile void __iomem *dest, const void *src, | |||
222 | * for PowerPC is as close as possible to the x86 version of these, and thus | 224 | * for PowerPC is as close as possible to the x86 version of these, and thus |
223 | * provides fairly heavy weight barriers for the non-raw versions | 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 | 227 | * In addition, they support a hook mechanism when CONFIG_PPC_INDIRECT_MMIO |
226 | * allowing the platform to provide its own implementation of some or all | 228 | * or CONFIG_PPC_INDIRECT_PIO are set allowing the platform to provide its |
227 | * of the accessors. | 229 | * own implementation of some or all of the accessors. |
228 | */ | 230 | */ |
229 | 231 | ||
230 | /* | 232 | /* |
@@ -240,8 +242,8 @@ extern void _memcpy_toio(volatile void __iomem *dest, const void *src, | |||
240 | 242 | ||
241 | /* Indirect IO address tokens: | 243 | /* Indirect IO address tokens: |
242 | * | 244 | * |
243 | * When CONFIG_PPC_INDIRECT_IO is set, the platform can provide hooks | 245 | * When CONFIG_PPC_INDIRECT_MMIO is set, the platform can provide hooks |
244 | * on all IOs. (Note that this is all 64 bits only for now) | 246 | * on all MMIOs. (Note that this is all 64 bits only for now) |
245 | * | 247 | * |
246 | * To help platforms who may need to differenciate MMIO addresses in | 248 | * To help platforms who may need to differenciate MMIO addresses in |
247 | * their hooks, a bitfield is reserved for use by the platform near the | 249 | * their hooks, a bitfield is reserved for use by the platform near the |
@@ -263,11 +265,14 @@ extern void _memcpy_toio(volatile void __iomem *dest, const void *src, | |||
263 | * | 265 | * |
264 | * The direct IO mapping operations will then mask off those bits | 266 | * The direct IO mapping operations will then mask off those bits |
265 | * before doing the actual access, though that only happen when | 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 | * mechanism | 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 | #define PCI_IO_IND_TOKEN_MASK 0x0fff000000000000ul | 276 | #define PCI_IO_IND_TOKEN_MASK 0x0fff000000000000ul |
272 | #define PCI_IO_IND_TOKEN_SHIFT 48 | 277 | #define PCI_IO_IND_TOKEN_SHIFT 48 |
273 | #define PCI_FIX_ADDR(addr) \ | 278 | #define PCI_FIX_ADDR(addr) \ |
@@ -672,7 +677,7 @@ extern void __iomem * __ioremap_at(phys_addr_t pa, void *ea, | |||
672 | extern void __iounmap_at(void *ea, unsigned long size); | 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 | * which needs some additional definitions here. They basically allow PIO | 681 | * which needs some additional definitions here. They basically allow PIO |
677 | * space overall to be 1GB. This will work as long as we never try to use | 682 | * space overall to be 1GB. This will work as long as we never try to use |
678 | * iomap to map MMIO below 1GB which should be fine on ppc64 | 683 | * iomap to map MMIO below 1GB which should be fine on ppc64 |
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index a8619bfe879e..725c2fb9f729 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile | |||
@@ -119,7 +119,7 @@ obj-$(CONFIG_FTRACE_SYSCALLS) += ftrace.o | |||
119 | 119 | ||
120 | obj-$(CONFIG_8XX_MINIMAL_FPEMU) += softemu8xx.o | 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 | obj-y += iomap.o | 123 | obj-y += iomap.o |
124 | endif | 124 | endif |
125 | 125 | ||
diff --git a/arch/powerpc/kernel/io-workarounds.c b/arch/powerpc/kernel/io-workarounds.c index fa0b54b2a362..24b968f8e4d8 100644 --- a/arch/powerpc/kernel/io-workarounds.c +++ b/arch/powerpc/kernel/io-workarounds.c | |||
@@ -53,6 +53,7 @@ static struct iowa_bus *iowa_pci_find(unsigned long vaddr, unsigned long paddr) | |||
53 | return NULL; | 53 | return NULL; |
54 | } | 54 | } |
55 | 55 | ||
56 | #ifdef CONFIG_PPC_INDIRECT_MMIO | ||
56 | struct iowa_bus *iowa_mem_find_bus(const PCI_IO_ADDR addr) | 57 | struct iowa_bus *iowa_mem_find_bus(const PCI_IO_ADDR addr) |
57 | { | 58 | { |
58 | unsigned hugepage_shift; | 59 | unsigned hugepage_shift; |
@@ -90,13 +91,25 @@ struct iowa_bus *iowa_mem_find_bus(const PCI_IO_ADDR addr) | |||
90 | 91 | ||
91 | return bus; | 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 | struct iowa_bus *iowa_pio_find_bus(unsigned long port) | 102 | struct iowa_bus *iowa_pio_find_bus(unsigned long port) |
95 | { | 103 | { |
96 | unsigned long vaddr = (unsigned long)pci_io_base + port; | 104 | unsigned long vaddr = (unsigned long)pci_io_base + port; |
97 | return iowa_pci_find(vaddr, 0); | 105 | return iowa_pci_find(vaddr, 0); |
98 | } | 106 | } |
99 | 107 | #else | |
108 | struct iowa_bus *iowa_pio_find_bus(unsigned long port) | ||
109 | { | ||
110 | return NULL; | ||
111 | } | ||
112 | #endif | ||
100 | 113 | ||
101 | #define DEF_PCI_AC_RET(name, ret, at, al, space, aa) \ | 114 | #define DEF_PCI_AC_RET(name, ret, at, al, space, aa) \ |
102 | static ret iowa_##name at \ | 115 | static ret iowa_##name at \ |
@@ -137,6 +150,7 @@ static const struct ppc_pci_io iowa_pci_io = { | |||
137 | 150 | ||
138 | }; | 151 | }; |
139 | 152 | ||
153 | #ifdef CONFIG_PPC_INDIRECT_MMIO | ||
140 | static void __iomem *iowa_ioremap(phys_addr_t addr, unsigned long size, | 154 | static void __iomem *iowa_ioremap(phys_addr_t addr, unsigned long size, |
141 | unsigned long flags, void *caller) | 155 | unsigned long flags, void *caller) |
142 | { | 156 | { |
@@ -151,6 +165,9 @@ static void __iomem *iowa_ioremap(phys_addr_t addr, unsigned long size, | |||
151 | } | 165 | } |
152 | return res; | 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 | /* Enable IO workaround */ | 172 | /* Enable IO workaround */ |
156 | static void io_workaround_init(void) | 173 | static void io_workaround_init(void) |
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index 0c0450dd4d31..9d5bae118d7e 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c | |||
@@ -716,8 +716,7 @@ void __init setup_per_cpu_areas(void) | |||
716 | #endif | 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 | struct ppc_pci_io ppc_pci_io; | 720 | struct ppc_pci_io ppc_pci_io; |
721 | EXPORT_SYMBOL(ppc_pci_io); | 721 | EXPORT_SYMBOL(ppc_pci_io); |
722 | #endif /* CONFIG_PPC_INDIRECT_IO */ | 722 | #endif |
723 | |||
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig index d703775bda30..bf9c6d4cd26c 100644 --- a/arch/powerpc/platforms/Kconfig +++ b/arch/powerpc/platforms/Kconfig | |||
@@ -202,17 +202,12 @@ config PPC_P7_NAP | |||
202 | bool | 202 | bool |
203 | default n | 203 | default n |
204 | 204 | ||
205 | config PPC_INDIRECT_IO | ||
206 | bool | ||
207 | select GENERIC_IOMAP | ||
208 | |||
209 | config PPC_INDIRECT_PIO | 205 | config PPC_INDIRECT_PIO |
210 | bool | 206 | bool |
211 | select PPC_INDIRECT_IO | 207 | select GENERIC_IOMAP |
212 | 208 | ||
213 | config PPC_INDIRECT_MMIO | 209 | config PPC_INDIRECT_MMIO |
214 | bool | 210 | bool |
215 | select PPC_INDIRECT_IO | ||
216 | 211 | ||
217 | config PPC_IO_WORKAROUNDS | 212 | config PPC_IO_WORKAROUNDS |
218 | bool | 213 | bool |