diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-12-18 06:10:03 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-02-15 16:39:11 -0500 |
commit | 31aa8fd6fd30b0f36416df7d09619768d26b4332 (patch) | |
tree | d44a7edc5287cf73df43206712e3736ae9b1de5a | |
parent | 7284ce6c9f6153d1777df5f310c959724d1bd446 (diff) |
ARM: Add caller information to ioremap
This allows the procfs vmallocinfo file to show who created the ioremap
regions. Note: __builtin_return_address(0) doesn't do what's expected
if its used in an inline function, so we leave __arm_ioremap callers
in such places alone.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/include/asm/io.h | 11 | ||||
-rw-r--r-- | arch/arm/mach-davinci/io.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-iop13xx/io.c | 7 | ||||
-rw-r--r-- | arch/arm/mach-msm/io.c | 3 | ||||
-rw-r--r-- | arch/arm/mm/ioremap.c | 57 | ||||
-rw-r--r-- | arch/arm/mm/nommu.c | 12 | ||||
-rw-r--r-- | arch/arm/plat-iop/io.c | 3 | ||||
-rw-r--r-- | arch/arm/plat-omap/io.c | 2 |
8 files changed, 65 insertions, 32 deletions
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h index d2a59cfc30ce..c980156f3263 100644 --- a/arch/arm/include/asm/io.h +++ b/arch/arm/include/asm/io.h | |||
@@ -69,9 +69,16 @@ extern void __raw_readsl(const void __iomem *addr, void *data, int longlen); | |||
69 | /* | 69 | /* |
70 | * __arm_ioremap takes CPU physical address. | 70 | * __arm_ioremap takes CPU physical address. |
71 | * __arm_ioremap_pfn takes a Page Frame Number and an offset into that page | 71 | * __arm_ioremap_pfn takes a Page Frame Number and an offset into that page |
72 | * The _caller variety takes a __builtin_return_address(0) value for | ||
73 | * /proc/vmalloc to use - and should only be used in non-inline functions. | ||
72 | */ | 74 | */ |
73 | extern void __iomem * __arm_ioremap_pfn(unsigned long, unsigned long, size_t, unsigned int); | 75 | extern void __iomem *__arm_ioremap_pfn_caller(unsigned long, unsigned long, |
74 | extern void __iomem * __arm_ioremap(unsigned long, size_t, unsigned int); | 76 | size_t, unsigned int, void *); |
77 | extern void __iomem *__arm_ioremap_caller(unsigned long, size_t, unsigned int, | ||
78 | void *); | ||
79 | |||
80 | extern void __iomem *__arm_ioremap_pfn(unsigned long, unsigned long, size_t, unsigned int); | ||
81 | extern void __iomem *__arm_ioremap(unsigned long, size_t, unsigned int); | ||
75 | extern void __iounmap(volatile void __iomem *addr); | 82 | extern void __iounmap(volatile void __iomem *addr); |
76 | 83 | ||
77 | /* | 84 | /* |
diff --git a/arch/arm/mach-davinci/io.c b/arch/arm/mach-davinci/io.c index 49912b48b1b0..a1c0b6b99edf 100644 --- a/arch/arm/mach-davinci/io.c +++ b/arch/arm/mach-davinci/io.c | |||
@@ -24,7 +24,7 @@ void __iomem *davinci_ioremap(unsigned long p, size_t size, unsigned int type) | |||
24 | if (BETWEEN(p, IO_PHYS, IO_SIZE)) | 24 | if (BETWEEN(p, IO_PHYS, IO_SIZE)) |
25 | return XLATE(p, IO_PHYS, IO_VIRT); | 25 | return XLATE(p, IO_PHYS, IO_VIRT); |
26 | 26 | ||
27 | return __arm_ioremap(p, size, type); | 27 | return __arm_ioremap_caller(p, size, type, __builtin_return_address(0)); |
28 | } | 28 | } |
29 | EXPORT_SYMBOL(davinci_ioremap); | 29 | EXPORT_SYMBOL(davinci_ioremap); |
30 | 30 | ||
diff --git a/arch/arm/mach-iop13xx/io.c b/arch/arm/mach-iop13xx/io.c index 529580997814..48642e66c566 100644 --- a/arch/arm/mach-iop13xx/io.c +++ b/arch/arm/mach-iop13xx/io.c | |||
@@ -61,9 +61,9 @@ void * __iomem __iop13xx_ioremap(unsigned long cookie, size_t size, | |||
61 | (cookie - IOP13XX_PCIE_LOWER_MEM_RA)); | 61 | (cookie - IOP13XX_PCIE_LOWER_MEM_RA)); |
62 | break; | 62 | break; |
63 | case IOP13XX_PBI_LOWER_MEM_RA ... IOP13XX_PBI_UPPER_MEM_RA: | 63 | case IOP13XX_PBI_LOWER_MEM_RA ... IOP13XX_PBI_UPPER_MEM_RA: |
64 | retval = __arm_ioremap(IOP13XX_PBI_LOWER_MEM_PA + | 64 | retval = __arm_ioremap_caller(IOP13XX_PBI_LOWER_MEM_PA + |
65 | (cookie - IOP13XX_PBI_LOWER_MEM_RA), | 65 | (cookie - IOP13XX_PBI_LOWER_MEM_RA), |
66 | size, mtype); | 66 | size, mtype, __builtin_return_address(0)); |
67 | break; | 67 | break; |
68 | case IOP13XX_PCIE_LOWER_IO_PA ... IOP13XX_PCIE_UPPER_IO_PA: | 68 | case IOP13XX_PCIE_LOWER_IO_PA ... IOP13XX_PCIE_UPPER_IO_PA: |
69 | retval = (void *) IOP13XX_PCIE_IO_PHYS_TO_VIRT(cookie); | 69 | retval = (void *) IOP13XX_PCIE_IO_PHYS_TO_VIRT(cookie); |
@@ -75,7 +75,8 @@ void * __iomem __iop13xx_ioremap(unsigned long cookie, size_t size, | |||
75 | retval = (void *) IOP13XX_PMMR_PHYS_TO_VIRT(cookie); | 75 | retval = (void *) IOP13XX_PMMR_PHYS_TO_VIRT(cookie); |
76 | break; | 76 | break; |
77 | default: | 77 | default: |
78 | retval = __arm_ioremap(cookie, size, mtype); | 78 | retval = __arm_ioremap_caller(cookie, size, mtype, |
79 | __builtin_return_address(0)); | ||
79 | } | 80 | } |
80 | 81 | ||
81 | return retval; | 82 | return retval; |
diff --git a/arch/arm/mach-msm/io.c b/arch/arm/mach-msm/io.c index 1c5e7dac086f..05f96b780aa6 100644 --- a/arch/arm/mach-msm/io.c +++ b/arch/arm/mach-msm/io.c | |||
@@ -76,5 +76,6 @@ __msm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype) | |||
76 | mtype = MT_DEVICE_NONSHARED; | 76 | mtype = MT_DEVICE_NONSHARED; |
77 | } | 77 | } |
78 | 78 | ||
79 | return __arm_ioremap(phys_addr, size, mtype); | 79 | return __arm_ioremap_caller(phys_addr, size, mtype, |
80 | __builtin_return_address(0)); | ||
80 | } | 81 | } |
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c index 0ab75c60f7cf..28c8b950ef04 100644 --- a/arch/arm/mm/ioremap.c +++ b/arch/arm/mm/ioremap.c | |||
@@ -139,8 +139,8 @@ void __check_kvm_seq(struct mm_struct *mm) | |||
139 | * which requires the new ioremap'd region to be referenced, the CPU will | 139 | * which requires the new ioremap'd region to be referenced, the CPU will |
140 | * reference the _old_ region. | 140 | * reference the _old_ region. |
141 | * | 141 | * |
142 | * Note that get_vm_area() allocates a guard 4K page, so we need to mask | 142 | * Note that get_vm_area_caller() allocates a guard 4K page, so we need to |
143 | * the size back to 1MB aligned or we will overflow in the loop below. | 143 | * mask the size back to 1MB aligned or we will overflow in the loop below. |
144 | */ | 144 | */ |
145 | static void unmap_area_sections(unsigned long virt, unsigned long size) | 145 | static void unmap_area_sections(unsigned long virt, unsigned long size) |
146 | { | 146 | { |
@@ -254,22 +254,8 @@ remap_area_supersections(unsigned long virt, unsigned long pfn, | |||
254 | } | 254 | } |
255 | #endif | 255 | #endif |
256 | 256 | ||
257 | 257 | void __iomem * __arm_ioremap_pfn_caller(unsigned long pfn, | |
258 | /* | 258 | unsigned long offset, size_t size, unsigned int mtype, void *caller) |
259 | * Remap an arbitrary physical address space into the kernel virtual | ||
260 | * address space. Needed when the kernel wants to access high addresses | ||
261 | * directly. | ||
262 | * | ||
263 | * NOTE! We need to allow non-page-aligned mappings too: we will obviously | ||
264 | * have to convert them into an offset in a page-aligned mapping, but the | ||
265 | * caller shouldn't need to know that small detail. | ||
266 | * | ||
267 | * 'flags' are the extra L_PTE_ flags that you want to specify for this | ||
268 | * mapping. See <asm/pgtable.h> for more information. | ||
269 | */ | ||
270 | void __iomem * | ||
271 | __arm_ioremap_pfn(unsigned long pfn, unsigned long offset, size_t size, | ||
272 | unsigned int mtype) | ||
273 | { | 259 | { |
274 | const struct mem_type *type; | 260 | const struct mem_type *type; |
275 | int err; | 261 | int err; |
@@ -291,7 +277,7 @@ __arm_ioremap_pfn(unsigned long pfn, unsigned long offset, size_t size, | |||
291 | */ | 277 | */ |
292 | size = PAGE_ALIGN(offset + size); | 278 | size = PAGE_ALIGN(offset + size); |
293 | 279 | ||
294 | area = get_vm_area(size, VM_IOREMAP); | 280 | area = get_vm_area_caller(size, VM_IOREMAP, caller); |
295 | if (!area) | 281 | if (!area) |
296 | return NULL; | 282 | return NULL; |
297 | addr = (unsigned long)area->addr; | 283 | addr = (unsigned long)area->addr; |
@@ -318,10 +304,9 @@ __arm_ioremap_pfn(unsigned long pfn, unsigned long offset, size_t size, | |||
318 | flush_cache_vmap(addr, addr + size); | 304 | flush_cache_vmap(addr, addr + size); |
319 | return (void __iomem *) (offset + addr); | 305 | return (void __iomem *) (offset + addr); |
320 | } | 306 | } |
321 | EXPORT_SYMBOL(__arm_ioremap_pfn); | ||
322 | 307 | ||
323 | void __iomem * | 308 | void __iomem *__arm_ioremap_caller(unsigned long phys_addr, size_t size, |
324 | __arm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype) | 309 | unsigned int mtype, void *caller) |
325 | { | 310 | { |
326 | unsigned long last_addr; | 311 | unsigned long last_addr; |
327 | unsigned long offset = phys_addr & ~PAGE_MASK; | 312 | unsigned long offset = phys_addr & ~PAGE_MASK; |
@@ -334,7 +319,33 @@ __arm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype) | |||
334 | if (!size || last_addr < phys_addr) | 319 | if (!size || last_addr < phys_addr) |
335 | return NULL; | 320 | return NULL; |
336 | 321 | ||
337 | return __arm_ioremap_pfn(pfn, offset, size, mtype); | 322 | return __arm_ioremap_pfn_caller(pfn, offset, size, mtype, |
323 | caller); | ||
324 | } | ||
325 | |||
326 | /* | ||
327 | * Remap an arbitrary physical address space into the kernel virtual | ||
328 | * address space. Needed when the kernel wants to access high addresses | ||
329 | * directly. | ||
330 | * | ||
331 | * NOTE! We need to allow non-page-aligned mappings too: we will obviously | ||
332 | * have to convert them into an offset in a page-aligned mapping, but the | ||
333 | * caller shouldn't need to know that small detail. | ||
334 | */ | ||
335 | void __iomem * | ||
336 | __arm_ioremap_pfn(unsigned long pfn, unsigned long offset, size_t size, | ||
337 | unsigned int mtype) | ||
338 | { | ||
339 | return __arm_ioremap_pfn_caller(pfn, offset, size, mtype, | ||
340 | __builtin_return_address(0)); | ||
341 | } | ||
342 | EXPORT_SYMBOL(__arm_ioremap_pfn); | ||
343 | |||
344 | void __iomem * | ||
345 | __arm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype) | ||
346 | { | ||
347 | return __arm_ioremap_caller(phys_addr, size, mtype, | ||
348 | __builtin_return_address(0)); | ||
338 | } | 349 | } |
339 | EXPORT_SYMBOL(__arm_ioremap); | 350 | EXPORT_SYMBOL(__arm_ioremap); |
340 | 351 | ||
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c index 374a8311bc84..9bfeb6b9509a 100644 --- a/arch/arm/mm/nommu.c +++ b/arch/arm/mm/nommu.c | |||
@@ -74,6 +74,12 @@ void __iomem *__arm_ioremap_pfn(unsigned long pfn, unsigned long offset, | |||
74 | } | 74 | } |
75 | EXPORT_SYMBOL(__arm_ioremap_pfn); | 75 | EXPORT_SYMBOL(__arm_ioremap_pfn); |
76 | 76 | ||
77 | void __iomem *__arm_ioremap_pfn_caller(unsigned long pfn, unsigned long offset, | ||
78 | size_t size, unsigned int mtype, void *caller) | ||
79 | { | ||
80 | return __arm_ioremap_pfn(pfn, offset, size, mtype); | ||
81 | } | ||
82 | |||
77 | void __iomem *__arm_ioremap(unsigned long phys_addr, size_t size, | 83 | void __iomem *__arm_ioremap(unsigned long phys_addr, size_t size, |
78 | unsigned int mtype) | 84 | unsigned int mtype) |
79 | { | 85 | { |
@@ -81,6 +87,12 @@ void __iomem *__arm_ioremap(unsigned long phys_addr, size_t size, | |||
81 | } | 87 | } |
82 | EXPORT_SYMBOL(__arm_ioremap); | 88 | EXPORT_SYMBOL(__arm_ioremap); |
83 | 89 | ||
90 | void __iomem *__arm_ioremap(unsigned long phys_addr, size_t size, | ||
91 | unsigned int mtype, void *caller) | ||
92 | { | ||
93 | return __arm_ioremap(phys_addr, size, mtype); | ||
94 | } | ||
95 | |||
84 | void __iounmap(volatile void __iomem *addr) | 96 | void __iounmap(volatile void __iomem *addr) |
85 | { | 97 | { |
86 | } | 98 | } |
diff --git a/arch/arm/plat-iop/io.c b/arch/arm/plat-iop/io.c index ed0bbece0d61..e15bc17db90b 100644 --- a/arch/arm/plat-iop/io.c +++ b/arch/arm/plat-iop/io.c | |||
@@ -34,7 +34,8 @@ void * __iomem __iop3xx_ioremap(unsigned long cookie, size_t size, | |||
34 | retval = (void *) IOP3XX_PMMR_PHYS_TO_VIRT(cookie); | 34 | retval = (void *) IOP3XX_PMMR_PHYS_TO_VIRT(cookie); |
35 | break; | 35 | break; |
36 | default: | 36 | default: |
37 | retval = __arm_ioremap(cookie, size, mtype); | 37 | retval = __arm_ioremap_caller(cookie, size, mtype, |
38 | __builtin_return_address(0)); | ||
38 | } | 39 | } |
39 | 40 | ||
40 | return retval; | 41 | return retval; |
diff --git a/arch/arm/plat-omap/io.c b/arch/arm/plat-omap/io.c index 0cfd54f519c4..4cbd4fb3232c 100644 --- a/arch/arm/plat-omap/io.c +++ b/arch/arm/plat-omap/io.c | |||
@@ -128,7 +128,7 @@ void __iomem *omap_ioremap(unsigned long p, size_t size, unsigned int type) | |||
128 | return XLATE(p, L4_EMU_44XX_PHYS, L4_EMU_44XX_VIRT); | 128 | return XLATE(p, L4_EMU_44XX_PHYS, L4_EMU_44XX_VIRT); |
129 | } | 129 | } |
130 | #endif | 130 | #endif |
131 | return __arm_ioremap(p, size, type); | 131 | return __arm_ioremap_caller(p, size, type, __builtin_return_address(0)); |
132 | } | 132 | } |
133 | EXPORT_SYMBOL(omap_ioremap); | 133 | EXPORT_SYMBOL(omap_ioremap); |
134 | 134 | ||