aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/mm/pgtable_32.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/mm/pgtable_32.c')
-rw-r--r--arch/powerpc/mm/pgtable_32.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index c7584072dfcc..2001abdb1912 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -145,13 +145,20 @@ void pte_free(struct mm_struct *mm, pgtable_t ptepage)
145void __iomem * 145void __iomem *
146ioremap(phys_addr_t addr, unsigned long size) 146ioremap(phys_addr_t addr, unsigned long size)
147{ 147{
148 return __ioremap(addr, size, _PAGE_NO_CACHE); 148 return __ioremap(addr, size, _PAGE_NO_CACHE | _PAGE_GUARDED);
149} 149}
150EXPORT_SYMBOL(ioremap); 150EXPORT_SYMBOL(ioremap);
151 151
152void __iomem * 152void __iomem *
153ioremap_flags(phys_addr_t addr, unsigned long size, unsigned long flags) 153ioremap_flags(phys_addr_t addr, unsigned long size, unsigned long flags)
154{ 154{
155 /* writeable implies dirty for kernel addresses */
156 if (flags & _PAGE_RW)
157 flags |= _PAGE_DIRTY | _PAGE_HWWRITE;
158
159 /* we don't want to let _PAGE_USER and _PAGE_EXEC leak out */
160 flags &= ~(_PAGE_USER | _PAGE_EXEC | _PAGE_HWEXEC);
161
155 return __ioremap(addr, size, flags); 162 return __ioremap(addr, size, flags);
156} 163}
157EXPORT_SYMBOL(ioremap_flags); 164EXPORT_SYMBOL(ioremap_flags);
@@ -163,6 +170,14 @@ __ioremap(phys_addr_t addr, unsigned long size, unsigned long flags)
163 phys_addr_t p; 170 phys_addr_t p;
164 int err; 171 int err;
165 172
173 /* Make sure we have the base flags */
174 if ((flags & _PAGE_PRESENT) == 0)
175 flags |= _PAGE_KERNEL;
176
177 /* Non-cacheable page cannot be coherent */
178 if (flags & _PAGE_NO_CACHE)
179 flags &= ~_PAGE_COHERENT;
180
166 /* 181 /*
167 * Choose an address to map it to. 182 * Choose an address to map it to.
168 * Once the vmalloc system is running, we use it. 183 * Once the vmalloc system is running, we use it.
@@ -219,11 +234,6 @@ __ioremap(phys_addr_t addr, unsigned long size, unsigned long flags)
219 v = (ioremap_bot -= size); 234 v = (ioremap_bot -= size);
220 } 235 }
221 236
222 if ((flags & _PAGE_PRESENT) == 0)
223 flags |= _PAGE_KERNEL;
224 if (flags & _PAGE_NO_CACHE)
225 flags |= _PAGE_GUARDED;
226
227 /* 237 /*
228 * Should check if it is a candidate for a BAT mapping 238 * Should check if it is a candidate for a BAT mapping
229 */ 239 */