aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-02-22 11:19:14 -0500
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-03-11 02:10:14 -0400
commit1cdab55d8a8313f77a95fb8ca966dc4334f8e810 (patch)
tree09649768514553e9c25d1a5a53a5cd567d0e138d
parent16962e7ce1dce29e1e92d231ac7d6844d7385d54 (diff)
powerpc: Wire up /proc/vmallocinfo to our ioremap()
This adds the necessary bits and pieces to powerpc implementation of ioremap to benefit from caller tracking in /proc/vmallocinfo, at least for ioremap's done after mem init as the older ones aren't tracked. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--arch/powerpc/include/asm/io.h6
-rw-r--r--arch/powerpc/include/asm/machdep.h2
-rw-r--r--arch/powerpc/mm/pgtable_32.c14
-rw-r--r--arch/powerpc/mm/pgtable_64.c25
-rw-r--r--arch/powerpc/platforms/cell/io-workarounds.c4
-rw-r--r--arch/powerpc/platforms/iseries/setup.c2
6 files changed, 38 insertions, 15 deletions
diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
index 494cd8b0a278..001f2f11c19b 100644
--- a/arch/powerpc/include/asm/io.h
+++ b/arch/powerpc/include/asm/io.h
@@ -632,6 +632,9 @@ static inline void iosync(void)
632 * ioremap_flags and cannot be hooked (but can be used by a hook on one 632 * ioremap_flags and cannot be hooked (but can be used by a hook on one
633 * of the previous ones) 633 * of the previous ones)
634 * 634 *
635 * * __ioremap_caller is the same as above but takes an explicit caller
636 * reference rather than using __builtin_return_address(0)
637 *
635 * * __iounmap, is the low level implementation used by iounmap and cannot 638 * * __iounmap, is the low level implementation used by iounmap and cannot
636 * be hooked (but can be used by a hook on iounmap) 639 * be hooked (but can be used by a hook on iounmap)
637 * 640 *
@@ -646,6 +649,9 @@ extern void iounmap(volatile void __iomem *addr);
646 649
647extern void __iomem *__ioremap(phys_addr_t, unsigned long size, 650extern void __iomem *__ioremap(phys_addr_t, unsigned long size,
648 unsigned long flags); 651 unsigned long flags);
652extern void __iomem *__ioremap_caller(phys_addr_t, unsigned long size,
653 unsigned long flags, void *caller);
654
649extern void __iounmap(volatile void __iomem *addr); 655extern void __iounmap(volatile void __iomem *addr);
650 656
651extern void __iomem * __ioremap_at(phys_addr_t pa, void *ea, 657extern void __iomem * __ioremap_at(phys_addr_t pa, void *ea,
diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index 6c34a0df82fd..0efdb1dfdc5f 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -90,7 +90,7 @@ struct machdep_calls {
90 void (*tce_flush)(struct iommu_table *tbl); 90 void (*tce_flush)(struct iommu_table *tbl);
91 91
92 void __iomem * (*ioremap)(phys_addr_t addr, unsigned long size, 92 void __iomem * (*ioremap)(phys_addr_t addr, unsigned long size,
93 unsigned long flags); 93 unsigned long flags, void *caller);
94 void (*iounmap)(volatile void __iomem *token); 94 void (*iounmap)(volatile void __iomem *token);
95 95
96#ifdef CONFIG_PM 96#ifdef CONFIG_PM
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index 58bcaeba728d..0f8c4371dfab 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -129,7 +129,8 @@ pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
129void __iomem * 129void __iomem *
130ioremap(phys_addr_t addr, unsigned long size) 130ioremap(phys_addr_t addr, unsigned long size)
131{ 131{
132 return __ioremap(addr, size, _PAGE_NO_CACHE | _PAGE_GUARDED); 132 return __ioremap_caller(addr, size, _PAGE_NO_CACHE | _PAGE_GUARDED,
133 __builtin_return_address(0));
133} 134}
134EXPORT_SYMBOL(ioremap); 135EXPORT_SYMBOL(ioremap);
135 136
@@ -143,13 +144,20 @@ ioremap_flags(phys_addr_t addr, unsigned long size, unsigned long flags)
143 /* we don't want to let _PAGE_USER and _PAGE_EXEC leak out */ 144 /* we don't want to let _PAGE_USER and _PAGE_EXEC leak out */
144 flags &= ~(_PAGE_USER | _PAGE_EXEC | _PAGE_HWEXEC); 145 flags &= ~(_PAGE_USER | _PAGE_EXEC | _PAGE_HWEXEC);
145 146
146 return __ioremap(addr, size, flags); 147 return __ioremap_caller(addr, size, flags, __builtin_return_address(0));
147} 148}
148EXPORT_SYMBOL(ioremap_flags); 149EXPORT_SYMBOL(ioremap_flags);
149 150
150void __iomem * 151void __iomem *
151__ioremap(phys_addr_t addr, unsigned long size, unsigned long flags) 152__ioremap(phys_addr_t addr, unsigned long size, unsigned long flags)
152{ 153{
154 return __ioremap_caller(addr, size, flags, __builtin_return_address(0));
155}
156
157void __iomem *
158__ioremap_caller(phys_addr_t addr, unsigned long size, unsigned long flags,
159 void *caller)
160{
153 unsigned long v, i; 161 unsigned long v, i;
154 phys_addr_t p; 162 phys_addr_t p;
155 int err; 163 int err;
@@ -212,7 +220,7 @@ __ioremap(phys_addr_t addr, unsigned long size, unsigned long flags)
212 220
213 if (mem_init_done) { 221 if (mem_init_done) {
214 struct vm_struct *area; 222 struct vm_struct *area;
215 area = get_vm_area(size, VM_IOREMAP); 223 area = get_vm_area_caller(size, VM_IOREMAP, caller);
216 if (area == 0) 224 if (area == 0)
217 return NULL; 225 return NULL;
218 v = (unsigned long) area->addr; 226 v = (unsigned long) area->addr;
diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c
index 365e61ae5dbc..bfa7db6b2fd5 100644
--- a/arch/powerpc/mm/pgtable_64.c
+++ b/arch/powerpc/mm/pgtable_64.c
@@ -144,8 +144,8 @@ void __iounmap_at(void *ea, unsigned long size)
144 unmap_kernel_range((unsigned long)ea, size); 144 unmap_kernel_range((unsigned long)ea, size);
145} 145}
146 146
147void __iomem * __ioremap(phys_addr_t addr, unsigned long size, 147void __iomem * __ioremap_caller(phys_addr_t addr, unsigned long size,
148 unsigned long flags) 148 unsigned long flags, void *caller)
149{ 149{
150 phys_addr_t paligned; 150 phys_addr_t paligned;
151 void __iomem *ret; 151 void __iomem *ret;
@@ -168,8 +168,9 @@ void __iomem * __ioremap(phys_addr_t addr, unsigned long size,
168 if (mem_init_done) { 168 if (mem_init_done) {
169 struct vm_struct *area; 169 struct vm_struct *area;
170 170
171 area = __get_vm_area(size, VM_IOREMAP, 171 area = __get_vm_area_caller(size, VM_IOREMAP,
172 ioremap_bot, IOREMAP_END); 172 ioremap_bot, IOREMAP_END,
173 caller);
173 if (area == NULL) 174 if (area == NULL)
174 return NULL; 175 return NULL;
175 ret = __ioremap_at(paligned, area->addr, size, flags); 176 ret = __ioremap_at(paligned, area->addr, size, flags);
@@ -186,19 +187,27 @@ void __iomem * __ioremap(phys_addr_t addr, unsigned long size,
186 return ret; 187 return ret;
187} 188}
188 189
190void __iomem * __ioremap(phys_addr_t addr, unsigned long size,
191 unsigned long flags)
192{
193 return __ioremap_caller(addr, size, flags, __builtin_return_address(0));
194}
189 195
190void __iomem * ioremap(phys_addr_t addr, unsigned long size) 196void __iomem * ioremap(phys_addr_t addr, unsigned long size)
191{ 197{
192 unsigned long flags = _PAGE_NO_CACHE | _PAGE_GUARDED; 198 unsigned long flags = _PAGE_NO_CACHE | _PAGE_GUARDED;
199 void *caller = __builtin_return_address(0);
193 200
194 if (ppc_md.ioremap) 201 if (ppc_md.ioremap)
195 return ppc_md.ioremap(addr, size, flags); 202 return ppc_md.ioremap(addr, size, flags, caller);
196 return __ioremap(addr, size, flags); 203 return __ioremap_caller(addr, size, flags, caller);
197} 204}
198 205
199void __iomem * ioremap_flags(phys_addr_t addr, unsigned long size, 206void __iomem * ioremap_flags(phys_addr_t addr, unsigned long size,
200 unsigned long flags) 207 unsigned long flags)
201{ 208{
209 void *caller = __builtin_return_address(0);
210
202 /* writeable implies dirty for kernel addresses */ 211 /* writeable implies dirty for kernel addresses */
203 if (flags & _PAGE_RW) 212 if (flags & _PAGE_RW)
204 flags |= _PAGE_DIRTY; 213 flags |= _PAGE_DIRTY;
@@ -207,8 +216,8 @@ void __iomem * ioremap_flags(phys_addr_t addr, unsigned long size,
207 flags &= ~(_PAGE_USER | _PAGE_EXEC); 216 flags &= ~(_PAGE_USER | _PAGE_EXEC);
208 217
209 if (ppc_md.ioremap) 218 if (ppc_md.ioremap)
210 return ppc_md.ioremap(addr, size, flags); 219 return ppc_md.ioremap(addr, size, flags, caller);
211 return __ioremap(addr, size, flags); 220 return __ioremap_caller(addr, size, flags, caller);
212} 221}
213 222
214 223
diff --git a/arch/powerpc/platforms/cell/io-workarounds.c b/arch/powerpc/platforms/cell/io-workarounds.c
index 059cad6c3f69..5c1118e31940 100644
--- a/arch/powerpc/platforms/cell/io-workarounds.c
+++ b/arch/powerpc/platforms/cell/io-workarounds.c
@@ -131,10 +131,10 @@ static const struct ppc_pci_io __devinitconst iowa_pci_io = {
131}; 131};
132 132
133static void __iomem *iowa_ioremap(phys_addr_t addr, unsigned long size, 133static void __iomem *iowa_ioremap(phys_addr_t addr, unsigned long size,
134 unsigned long flags) 134 unsigned long flags, void *caller)
135{ 135{
136 struct iowa_bus *bus; 136 struct iowa_bus *bus;
137 void __iomem *res = __ioremap(addr, size, flags); 137 void __iomem *res = __ioremap_caller(addr, size, flags, caller);
138 int busno; 138 int busno;
139 139
140 bus = iowa_pci_find(0, (unsigned long)addr); 140 bus = iowa_pci_find(0, (unsigned long)addr);
diff --git a/arch/powerpc/platforms/iseries/setup.c b/arch/powerpc/platforms/iseries/setup.c
index 24519b96d6ad..a6cd3394feaa 100644
--- a/arch/powerpc/platforms/iseries/setup.c
+++ b/arch/powerpc/platforms/iseries/setup.c
@@ -617,7 +617,7 @@ static void iseries_dedicated_idle(void)
617} 617}
618 618
619static void __iomem *iseries_ioremap(phys_addr_t address, unsigned long size, 619static void __iomem *iseries_ioremap(phys_addr_t address, unsigned long size,
620 unsigned long flags) 620 unsigned long flags, void *caller)
621{ 621{
622 return (void __iomem *)address; 622 return (void __iomem *)address;
623} 623}