diff options
Diffstat (limited to 'include/asm-ppc64/pgtable.h')
-rw-r--r-- | include/asm-ppc64/pgtable.h | 160 |
1 files changed, 53 insertions, 107 deletions
diff --git a/include/asm-ppc64/pgtable.h b/include/asm-ppc64/pgtable.h index 8c3f574046b6..fde93ec36abc 100644 --- a/include/asm-ppc64/pgtable.h +++ b/include/asm-ppc64/pgtable.h | |||
@@ -15,40 +15,11 @@ | |||
15 | #include <asm/tlbflush.h> | 15 | #include <asm/tlbflush.h> |
16 | #endif /* __ASSEMBLY__ */ | 16 | #endif /* __ASSEMBLY__ */ |
17 | 17 | ||
18 | /* | 18 | #ifdef CONFIG_PPC_64K_PAGES |
19 | * Entries per page directory level. The PTE level must use a 64b record | 19 | #include <asm/pgtable-64k.h> |
20 | * for each page table entry. The PMD and PGD level use a 32b record for | 20 | #else |
21 | * each entry by assuming that each entry is page aligned. | 21 | #include <asm/pgtable-4k.h> |
22 | */ | 22 | #endif |
23 | #define PTE_INDEX_SIZE 9 | ||
24 | #define PMD_INDEX_SIZE 7 | ||
25 | #define PUD_INDEX_SIZE 7 | ||
26 | #define PGD_INDEX_SIZE 9 | ||
27 | |||
28 | #define PTE_TABLE_SIZE (sizeof(pte_t) << PTE_INDEX_SIZE) | ||
29 | #define PMD_TABLE_SIZE (sizeof(pmd_t) << PMD_INDEX_SIZE) | ||
30 | #define PUD_TABLE_SIZE (sizeof(pud_t) << PUD_INDEX_SIZE) | ||
31 | #define PGD_TABLE_SIZE (sizeof(pgd_t) << PGD_INDEX_SIZE) | ||
32 | |||
33 | #define PTRS_PER_PTE (1 << PTE_INDEX_SIZE) | ||
34 | #define PTRS_PER_PMD (1 << PMD_INDEX_SIZE) | ||
35 | #define PTRS_PER_PUD (1 << PMD_INDEX_SIZE) | ||
36 | #define PTRS_PER_PGD (1 << PGD_INDEX_SIZE) | ||
37 | |||
38 | /* PMD_SHIFT determines what a second-level page table entry can map */ | ||
39 | #define PMD_SHIFT (PAGE_SHIFT + PTE_INDEX_SIZE) | ||
40 | #define PMD_SIZE (1UL << PMD_SHIFT) | ||
41 | #define PMD_MASK (~(PMD_SIZE-1)) | ||
42 | |||
43 | /* PUD_SHIFT determines what a third-level page table entry can map */ | ||
44 | #define PUD_SHIFT (PMD_SHIFT + PMD_INDEX_SIZE) | ||
45 | #define PUD_SIZE (1UL << PUD_SHIFT) | ||
46 | #define PUD_MASK (~(PUD_SIZE-1)) | ||
47 | |||
48 | /* PGDIR_SHIFT determines what a fourth-level page table entry can map */ | ||
49 | #define PGDIR_SHIFT (PUD_SHIFT + PUD_INDEX_SIZE) | ||
50 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) | ||
51 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) | ||
52 | 23 | ||
53 | #define FIRST_USER_ADDRESS 0 | 24 | #define FIRST_USER_ADDRESS 0 |
54 | 25 | ||
@@ -75,8 +46,9 @@ | |||
75 | #define VMALLOC_END (VMALLOC_START + VMALLOC_SIZE) | 46 | #define VMALLOC_END (VMALLOC_START + VMALLOC_SIZE) |
76 | 47 | ||
77 | /* | 48 | /* |
78 | * Bits in a linux-style PTE. These match the bits in the | 49 | * Common bits in a linux-style PTE. These match the bits in the |
79 | * (hardware-defined) PowerPC PTE as closely as possible. | 50 | * (hardware-defined) PowerPC PTE as closely as possible. Additional |
51 | * bits may be defined in pgtable-*.h | ||
80 | */ | 52 | */ |
81 | #define _PAGE_PRESENT 0x0001 /* software: pte contains a translation */ | 53 | #define _PAGE_PRESENT 0x0001 /* software: pte contains a translation */ |
82 | #define _PAGE_USER 0x0002 /* matches one of the PP bits */ | 54 | #define _PAGE_USER 0x0002 /* matches one of the PP bits */ |
@@ -91,15 +63,6 @@ | |||
91 | #define _PAGE_RW 0x0200 /* software: user write access allowed */ | 63 | #define _PAGE_RW 0x0200 /* software: user write access allowed */ |
92 | #define _PAGE_HASHPTE 0x0400 /* software: pte has an associated HPTE */ | 64 | #define _PAGE_HASHPTE 0x0400 /* software: pte has an associated HPTE */ |
93 | #define _PAGE_BUSY 0x0800 /* software: PTE & hash are busy */ | 65 | #define _PAGE_BUSY 0x0800 /* software: PTE & hash are busy */ |
94 | #define _PAGE_SECONDARY 0x8000 /* software: HPTE is in secondary group */ | ||
95 | #define _PAGE_GROUP_IX 0x7000 /* software: HPTE index within group */ | ||
96 | #define _PAGE_HUGE 0x10000 /* 16MB page */ | ||
97 | /* Bits 0x7000 identify the index within an HPT Group */ | ||
98 | #define _PAGE_HPTEFLAGS (_PAGE_BUSY | _PAGE_HASHPTE | _PAGE_SECONDARY | _PAGE_GROUP_IX) | ||
99 | /* PAGE_MASK gives the right answer below, but only by accident */ | ||
100 | /* It should be preserving the high 48 bits and then specifically */ | ||
101 | /* preserving _PAGE_SECONDARY | _PAGE_GROUP_IX */ | ||
102 | #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_HPTEFLAGS) | ||
103 | 66 | ||
104 | #define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_COHERENT) | 67 | #define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_COHERENT) |
105 | 68 | ||
@@ -122,10 +85,10 @@ | |||
122 | #define PAGE_AGP __pgprot(_PAGE_BASE | _PAGE_WRENABLE | _PAGE_NO_CACHE) | 85 | #define PAGE_AGP __pgprot(_PAGE_BASE | _PAGE_WRENABLE | _PAGE_NO_CACHE) |
123 | #define HAVE_PAGE_AGP | 86 | #define HAVE_PAGE_AGP |
124 | 87 | ||
125 | /* | 88 | /* PTEIDX nibble */ |
126 | * This bit in a hardware PTE indicates that the page is *not* executable. | 89 | #define _PTEIDX_SECONDARY 0x8 |
127 | */ | 90 | #define _PTEIDX_GROUP_IX 0x7 |
128 | #define HW_NO_EXEC _PAGE_EXEC | 91 | |
129 | 92 | ||
130 | /* | 93 | /* |
131 | * POWER4 and newer have per page execute protection, older chips can only | 94 | * POWER4 and newer have per page execute protection, older chips can only |
@@ -164,21 +127,10 @@ extern unsigned long empty_zero_page[PAGE_SIZE/sizeof(unsigned long)]; | |||
164 | #define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) | 127 | #define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) |
165 | #endif /* __ASSEMBLY__ */ | 128 | #endif /* __ASSEMBLY__ */ |
166 | 129 | ||
167 | /* shift to put page number into pte */ | ||
168 | #define PTE_SHIFT (17) | ||
169 | |||
170 | #ifdef CONFIG_HUGETLB_PAGE | 130 | #ifdef CONFIG_HUGETLB_PAGE |
171 | 131 | ||
172 | #ifndef __ASSEMBLY__ | ||
173 | int hash_huge_page(struct mm_struct *mm, unsigned long access, | ||
174 | unsigned long ea, unsigned long vsid, int local); | ||
175 | #endif /* __ASSEMBLY__ */ | ||
176 | |||
177 | #define HAVE_ARCH_UNMAPPED_AREA | 132 | #define HAVE_ARCH_UNMAPPED_AREA |
178 | #define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN | 133 | #define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN |
179 | #else | ||
180 | |||
181 | #define hash_huge_page(mm,a,ea,vsid,local) -1 | ||
182 | 134 | ||
183 | #endif | 135 | #endif |
184 | 136 | ||
@@ -197,7 +149,7 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot) | |||
197 | pte_t pte; | 149 | pte_t pte; |
198 | 150 | ||
199 | 151 | ||
200 | pte_val(pte) = (pfn << PTE_SHIFT) | pgprot_val(pgprot); | 152 | pte_val(pte) = (pfn << PTE_RPN_SHIFT) | pgprot_val(pgprot); |
201 | return pte; | 153 | return pte; |
202 | } | 154 | } |
203 | 155 | ||
@@ -209,30 +161,25 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot) | |||
209 | 161 | ||
210 | /* pte_clear moved to later in this file */ | 162 | /* pte_clear moved to later in this file */ |
211 | 163 | ||
212 | #define pte_pfn(x) ((unsigned long)((pte_val(x) >> PTE_SHIFT))) | 164 | #define pte_pfn(x) ((unsigned long)((pte_val(x)>>PTE_RPN_SHIFT))) |
213 | #define pte_page(x) pfn_to_page(pte_pfn(x)) | 165 | #define pte_page(x) pfn_to_page(pte_pfn(x)) |
214 | 166 | ||
215 | #define pmd_set(pmdp, ptep) ({BUG_ON((u64)ptep < KERNELBASE); pmd_val(*(pmdp)) = (unsigned long)(ptep);}) | 167 | #define pmd_set(pmdp, pmdval) (pmd_val(*(pmdp)) = (pmdval)) |
216 | #define pmd_none(pmd) (!pmd_val(pmd)) | 168 | #define pmd_none(pmd) (!pmd_val(pmd)) |
217 | #define pmd_bad(pmd) (pmd_val(pmd) == 0) | 169 | #define pmd_bad(pmd) (pmd_val(pmd) == 0) |
218 | #define pmd_present(pmd) (pmd_val(pmd) != 0) | 170 | #define pmd_present(pmd) (pmd_val(pmd) != 0) |
219 | #define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0) | 171 | #define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0) |
220 | #define pmd_page_kernel(pmd) (pmd_val(pmd)) | 172 | #define pmd_page_kernel(pmd) (pmd_val(pmd) & ~PMD_MASKED_BITS) |
221 | #define pmd_page(pmd) virt_to_page(pmd_page_kernel(pmd)) | 173 | #define pmd_page(pmd) virt_to_page(pmd_page_kernel(pmd)) |
222 | 174 | ||
223 | #define pud_set(pudp, pmdp) (pud_val(*(pudp)) = (unsigned long)(pmdp)) | 175 | #define pud_set(pudp, pudval) (pud_val(*(pudp)) = (pudval)) |
224 | #define pud_none(pud) (!pud_val(pud)) | 176 | #define pud_none(pud) (!pud_val(pud)) |
225 | #define pud_bad(pud) ((pud_val(pud)) == 0) | 177 | #define pud_bad(pud) ((pud_val(pud)) == 0) |
226 | #define pud_present(pud) (pud_val(pud) != 0) | 178 | #define pud_present(pud) (pud_val(pud) != 0) |
227 | #define pud_clear(pudp) (pud_val(*(pudp)) = 0) | 179 | #define pud_clear(pudp) (pud_val(*(pudp)) = 0) |
228 | #define pud_page(pud) (pud_val(pud)) | 180 | #define pud_page(pud) (pud_val(pud) & ~PUD_MASKED_BITS) |
229 | 181 | ||
230 | #define pgd_set(pgdp, pudp) ({pgd_val(*(pgdp)) = (unsigned long)(pudp);}) | 182 | #define pgd_set(pgdp, pudp) ({pgd_val(*(pgdp)) = (unsigned long)(pudp);}) |
231 | #define pgd_none(pgd) (!pgd_val(pgd)) | ||
232 | #define pgd_bad(pgd) (pgd_val(pgd) == 0) | ||
233 | #define pgd_present(pgd) (pgd_val(pgd) != 0) | ||
234 | #define pgd_clear(pgdp) (pgd_val(*(pgdp)) = 0) | ||
235 | #define pgd_page(pgd) (pgd_val(pgd)) | ||
236 | 183 | ||
237 | /* | 184 | /* |
238 | * Find an entry in a page-table-directory. We combine the address region | 185 | * Find an entry in a page-table-directory. We combine the address region |
@@ -243,9 +190,6 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot) | |||
243 | 190 | ||
244 | #define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) | 191 | #define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) |
245 | 192 | ||
246 | #define pud_offset(pgdp, addr) \ | ||
247 | (((pud_t *) pgd_page(*(pgdp))) + (((addr) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))) | ||
248 | |||
249 | #define pmd_offset(pudp,addr) \ | 193 | #define pmd_offset(pudp,addr) \ |
250 | (((pmd_t *) pud_page(*(pudp))) + (((addr) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))) | 194 | (((pmd_t *) pud_page(*(pudp))) + (((addr) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))) |
251 | 195 | ||
@@ -271,7 +215,6 @@ static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_EXEC;} | |||
271 | static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY;} | 215 | static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY;} |
272 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED;} | 216 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED;} |
273 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE;} | 217 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE;} |
274 | static inline int pte_huge(pte_t pte) { return pte_val(pte) & _PAGE_HUGE;} | ||
275 | 218 | ||
276 | static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; } | 219 | static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; } |
277 | static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; } | 220 | static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; } |
@@ -286,7 +229,6 @@ static inline pte_t pte_mkclean(pte_t pte) { | |||
286 | pte_val(pte) &= ~(_PAGE_DIRTY); return pte; } | 229 | pte_val(pte) &= ~(_PAGE_DIRTY); return pte; } |
287 | static inline pte_t pte_mkold(pte_t pte) { | 230 | static inline pte_t pte_mkold(pte_t pte) { |
288 | pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } | 231 | pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } |
289 | |||
290 | static inline pte_t pte_mkread(pte_t pte) { | 232 | static inline pte_t pte_mkread(pte_t pte) { |
291 | pte_val(pte) |= _PAGE_USER; return pte; } | 233 | pte_val(pte) |= _PAGE_USER; return pte; } |
292 | static inline pte_t pte_mkexec(pte_t pte) { | 234 | static inline pte_t pte_mkexec(pte_t pte) { |
@@ -298,7 +240,7 @@ static inline pte_t pte_mkdirty(pte_t pte) { | |||
298 | static inline pte_t pte_mkyoung(pte_t pte) { | 240 | static inline pte_t pte_mkyoung(pte_t pte) { |
299 | pte_val(pte) |= _PAGE_ACCESSED; return pte; } | 241 | pte_val(pte) |= _PAGE_ACCESSED; return pte; } |
300 | static inline pte_t pte_mkhuge(pte_t pte) { | 242 | static inline pte_t pte_mkhuge(pte_t pte) { |
301 | pte_val(pte) |= _PAGE_HUGE; return pte; } | 243 | return pte; } |
302 | 244 | ||
303 | /* Atomic PTE updates */ | 245 | /* Atomic PTE updates */ |
304 | static inline unsigned long pte_update(pte_t *p, unsigned long clr) | 246 | static inline unsigned long pte_update(pte_t *p, unsigned long clr) |
@@ -321,11 +263,13 @@ static inline unsigned long pte_update(pte_t *p, unsigned long clr) | |||
321 | /* PTE updating functions, this function puts the PTE in the | 263 | /* PTE updating functions, this function puts the PTE in the |
322 | * batch, doesn't actually triggers the hash flush immediately, | 264 | * batch, doesn't actually triggers the hash flush immediately, |
323 | * you need to call flush_tlb_pending() to do that. | 265 | * you need to call flush_tlb_pending() to do that. |
266 | * Pass -1 for "normal" size (4K or 64K) | ||
324 | */ | 267 | */ |
325 | extern void hpte_update(struct mm_struct *mm, unsigned long addr, unsigned long pte, | 268 | extern void hpte_update(struct mm_struct *mm, unsigned long addr, |
326 | int wrprot); | 269 | pte_t *ptep, unsigned long pte, int huge); |
327 | 270 | ||
328 | static inline int __ptep_test_and_clear_young(struct mm_struct *mm, unsigned long addr, pte_t *ptep) | 271 | static inline int __ptep_test_and_clear_young(struct mm_struct *mm, |
272 | unsigned long addr, pte_t *ptep) | ||
329 | { | 273 | { |
330 | unsigned long old; | 274 | unsigned long old; |
331 | 275 | ||
@@ -333,7 +277,7 @@ static inline int __ptep_test_and_clear_young(struct mm_struct *mm, unsigned lon | |||
333 | return 0; | 277 | return 0; |
334 | old = pte_update(ptep, _PAGE_ACCESSED); | 278 | old = pte_update(ptep, _PAGE_ACCESSED); |
335 | if (old & _PAGE_HASHPTE) { | 279 | if (old & _PAGE_HASHPTE) { |
336 | hpte_update(mm, addr, old, 0); | 280 | hpte_update(mm, addr, ptep, old, 0); |
337 | flush_tlb_pending(); | 281 | flush_tlb_pending(); |
338 | } | 282 | } |
339 | return (old & _PAGE_ACCESSED) != 0; | 283 | return (old & _PAGE_ACCESSED) != 0; |
@@ -351,7 +295,8 @@ static inline int __ptep_test_and_clear_young(struct mm_struct *mm, unsigned lon | |||
351 | * moment we always flush but we need to fix hpte_update and test if the | 295 | * moment we always flush but we need to fix hpte_update and test if the |
352 | * optimisation is worth it. | 296 | * optimisation is worth it. |
353 | */ | 297 | */ |
354 | static inline int __ptep_test_and_clear_dirty(struct mm_struct *mm, unsigned long addr, pte_t *ptep) | 298 | static inline int __ptep_test_and_clear_dirty(struct mm_struct *mm, |
299 | unsigned long addr, pte_t *ptep) | ||
355 | { | 300 | { |
356 | unsigned long old; | 301 | unsigned long old; |
357 | 302 | ||
@@ -359,7 +304,7 @@ static inline int __ptep_test_and_clear_dirty(struct mm_struct *mm, unsigned lon | |||
359 | return 0; | 304 | return 0; |
360 | old = pte_update(ptep, _PAGE_DIRTY); | 305 | old = pte_update(ptep, _PAGE_DIRTY); |
361 | if (old & _PAGE_HASHPTE) | 306 | if (old & _PAGE_HASHPTE) |
362 | hpte_update(mm, addr, old, 0); | 307 | hpte_update(mm, addr, ptep, old, 0); |
363 | return (old & _PAGE_DIRTY) != 0; | 308 | return (old & _PAGE_DIRTY) != 0; |
364 | } | 309 | } |
365 | #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY | 310 | #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY |
@@ -371,7 +316,8 @@ static inline int __ptep_test_and_clear_dirty(struct mm_struct *mm, unsigned lon | |||
371 | }) | 316 | }) |
372 | 317 | ||
373 | #define __HAVE_ARCH_PTEP_SET_WRPROTECT | 318 | #define __HAVE_ARCH_PTEP_SET_WRPROTECT |
374 | static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) | 319 | static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, |
320 | pte_t *ptep) | ||
375 | { | 321 | { |
376 | unsigned long old; | 322 | unsigned long old; |
377 | 323 | ||
@@ -379,7 +325,7 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, | |||
379 | return; | 325 | return; |
380 | old = pte_update(ptep, _PAGE_RW); | 326 | old = pte_update(ptep, _PAGE_RW); |
381 | if (old & _PAGE_HASHPTE) | 327 | if (old & _PAGE_HASHPTE) |
382 | hpte_update(mm, addr, old, 0); | 328 | hpte_update(mm, addr, ptep, old, 0); |
383 | } | 329 | } |
384 | 330 | ||
385 | /* | 331 | /* |
@@ -408,21 +354,23 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, | |||
408 | }) | 354 | }) |
409 | 355 | ||
410 | #define __HAVE_ARCH_PTEP_GET_AND_CLEAR | 356 | #define __HAVE_ARCH_PTEP_GET_AND_CLEAR |
411 | static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) | 357 | static inline pte_t ptep_get_and_clear(struct mm_struct *mm, |
358 | unsigned long addr, pte_t *ptep) | ||
412 | { | 359 | { |
413 | unsigned long old = pte_update(ptep, ~0UL); | 360 | unsigned long old = pte_update(ptep, ~0UL); |
414 | 361 | ||
415 | if (old & _PAGE_HASHPTE) | 362 | if (old & _PAGE_HASHPTE) |
416 | hpte_update(mm, addr, old, 0); | 363 | hpte_update(mm, addr, ptep, old, 0); |
417 | return __pte(old); | 364 | return __pte(old); |
418 | } | 365 | } |
419 | 366 | ||
420 | static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t * ptep) | 367 | static inline void pte_clear(struct mm_struct *mm, unsigned long addr, |
368 | pte_t * ptep) | ||
421 | { | 369 | { |
422 | unsigned long old = pte_update(ptep, ~0UL); | 370 | unsigned long old = pte_update(ptep, ~0UL); |
423 | 371 | ||
424 | if (old & _PAGE_HASHPTE) | 372 | if (old & _PAGE_HASHPTE) |
425 | hpte_update(mm, addr, old, 0); | 373 | hpte_update(mm, addr, ptep, old, 0); |
426 | } | 374 | } |
427 | 375 | ||
428 | /* | 376 | /* |
@@ -435,7 +383,14 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, | |||
435 | pte_clear(mm, addr, ptep); | 383 | pte_clear(mm, addr, ptep); |
436 | flush_tlb_pending(); | 384 | flush_tlb_pending(); |
437 | } | 385 | } |
438 | *ptep = __pte(pte_val(pte) & ~_PAGE_HPTEFLAGS); | 386 | pte = __pte(pte_val(pte) & ~_PAGE_HPTEFLAGS); |
387 | |||
388 | #ifdef CONFIG_PPC_64K_PAGES | ||
389 | if (mmu_virtual_psize != MMU_PAGE_64K) | ||
390 | pte = __pte(pte_val(pte) | _PAGE_COMBO); | ||
391 | #endif /* CONFIG_PPC_64K_PAGES */ | ||
392 | |||
393 | *ptep = pte; | ||
439 | } | 394 | } |
440 | 395 | ||
441 | /* Set the dirty and/or accessed bits atomically in a linux PTE, this | 396 | /* Set the dirty and/or accessed bits atomically in a linux PTE, this |
@@ -482,8 +437,6 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, | |||
482 | printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e)) | 437 | printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e)) |
483 | #define pmd_ERROR(e) \ | 438 | #define pmd_ERROR(e) \ |
484 | printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e)) | 439 | printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e)) |
485 | #define pud_ERROR(e) \ | ||
486 | printk("%s:%d: bad pud %08lx.\n", __FILE__, __LINE__, pud_val(e)) | ||
487 | #define pgd_ERROR(e) \ | 440 | #define pgd_ERROR(e) \ |
488 | printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e)) | 441 | printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e)) |
489 | 442 | ||
@@ -509,12 +462,12 @@ extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t); | |||
509 | /* Encode and de-code a swap entry */ | 462 | /* Encode and de-code a swap entry */ |
510 | #define __swp_type(entry) (((entry).val >> 1) & 0x3f) | 463 | #define __swp_type(entry) (((entry).val >> 1) & 0x3f) |
511 | #define __swp_offset(entry) ((entry).val >> 8) | 464 | #define __swp_offset(entry) ((entry).val >> 8) |
512 | #define __swp_entry(type, offset) ((swp_entry_t) { ((type) << 1) | ((offset) << 8) }) | 465 | #define __swp_entry(type, offset) ((swp_entry_t){((type)<< 1)|((offset)<<8)}) |
513 | #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) >> PTE_SHIFT }) | 466 | #define __pte_to_swp_entry(pte) ((swp_entry_t){pte_val(pte) >> PTE_RPN_SHIFT}) |
514 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val << PTE_SHIFT }) | 467 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val << PTE_RPN_SHIFT }) |
515 | #define pte_to_pgoff(pte) (pte_val(pte) >> PTE_SHIFT) | 468 | #define pte_to_pgoff(pte) (pte_val(pte) >> PTE_RPN_SHIFT) |
516 | #define pgoff_to_pte(off) ((pte_t) {((off) << PTE_SHIFT)|_PAGE_FILE}) | 469 | #define pgoff_to_pte(off) ((pte_t) {((off) << PTE_RPN_SHIFT)|_PAGE_FILE}) |
517 | #define PTE_FILE_MAX_BITS (BITS_PER_LONG - PTE_SHIFT) | 470 | #define PTE_FILE_MAX_BITS (BITS_PER_LONG - PTE_RPN_SHIFT) |
518 | 471 | ||
519 | /* | 472 | /* |
520 | * kern_addr_valid is intended to indicate whether an address is a valid | 473 | * kern_addr_valid is intended to indicate whether an address is a valid |
@@ -532,29 +485,22 @@ void pgtable_cache_init(void); | |||
532 | /* | 485 | /* |
533 | * find_linux_pte returns the address of a linux pte for a given | 486 | * find_linux_pte returns the address of a linux pte for a given |
534 | * effective address and directory. If not found, it returns zero. | 487 | * effective address and directory. If not found, it returns zero. |
535 | */ | 488 | */static inline pte_t *find_linux_pte(pgd_t *pgdir, unsigned long ea) |
536 | static inline pte_t *find_linux_pte(pgd_t *pgdir, unsigned long ea) | ||
537 | { | 489 | { |
538 | pgd_t *pg; | 490 | pgd_t *pg; |
539 | pud_t *pu; | 491 | pud_t *pu; |
540 | pmd_t *pm; | 492 | pmd_t *pm; |
541 | pte_t *pt = NULL; | 493 | pte_t *pt = NULL; |
542 | pte_t pte; | ||
543 | 494 | ||
544 | pg = pgdir + pgd_index(ea); | 495 | pg = pgdir + pgd_index(ea); |
545 | if (!pgd_none(*pg)) { | 496 | if (!pgd_none(*pg)) { |
546 | pu = pud_offset(pg, ea); | 497 | pu = pud_offset(pg, ea); |
547 | if (!pud_none(*pu)) { | 498 | if (!pud_none(*pu)) { |
548 | pm = pmd_offset(pu, ea); | 499 | pm = pmd_offset(pu, ea); |
549 | if (pmd_present(*pm)) { | 500 | if (pmd_present(*pm)) |
550 | pt = pte_offset_kernel(pm, ea); | 501 | pt = pte_offset_kernel(pm, ea); |
551 | pte = *pt; | ||
552 | if (!pte_present(pte)) | ||
553 | pt = NULL; | ||
554 | } | ||
555 | } | 502 | } |
556 | } | 503 | } |
557 | |||
558 | return pt; | 504 | return pt; |
559 | } | 505 | } |
560 | 506 | ||