hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/arch/mips/include/asm/pgtable-64.h
....@@ -17,13 +17,12 @@
1717 #include <asm/cachectl.h>
1818 #include <asm/fixmap.h>
1919
20
-#define __ARCH_USE_5LEVEL_HACK
2120 #if CONFIG_PGTABLE_LEVELS == 2
2221 #include <asm-generic/pgtable-nopmd.h>
2322 #elif CONFIG_PGTABLE_LEVELS == 3
2423 #include <asm-generic/pgtable-nopud.h>
2524 #else
26
-#include <asm-generic/5level-fixup.h>
25
+#include <asm-generic/pgtable-nop4d.h>
2726 #endif
2827
2928 /*
....@@ -188,47 +187,42 @@
188187 /*
189188 * Empty pgd entries point to the invalid_pud_table.
190189 */
191
-static inline int pgd_none(pgd_t pgd)
190
+static inline int p4d_none(p4d_t p4d)
192191 {
193
- return pgd_val(pgd) == (unsigned long)invalid_pud_table;
192
+ return p4d_val(p4d) == (unsigned long)invalid_pud_table;
194193 }
195194
196
-static inline int pgd_bad(pgd_t pgd)
195
+static inline int p4d_bad(p4d_t p4d)
197196 {
198
- if (unlikely(pgd_val(pgd) & ~PAGE_MASK))
197
+ if (unlikely(p4d_val(p4d) & ~PAGE_MASK))
199198 return 1;
200199
201200 return 0;
202201 }
203202
204
-static inline int pgd_present(pgd_t pgd)
203
+static inline int p4d_present(p4d_t p4d)
205204 {
206
- return pgd_val(pgd) != (unsigned long)invalid_pud_table;
205
+ return p4d_val(p4d) != (unsigned long)invalid_pud_table;
207206 }
208207
209
-static inline void pgd_clear(pgd_t *pgdp)
208
+static inline void p4d_clear(p4d_t *p4dp)
210209 {
211
- pgd_val(*pgdp) = (unsigned long)invalid_pud_table;
210
+ p4d_val(*p4dp) = (unsigned long)invalid_pud_table;
212211 }
213212
214
-#define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))
215
-
216
-static inline unsigned long pgd_page_vaddr(pgd_t pgd)
213
+static inline pud_t *p4d_pgtable(p4d_t p4d)
217214 {
218
- return pgd_val(pgd);
215
+ return (pud_t *)p4d_val(p4d);
219216 }
220217
221
-#define pgd_phys(pgd) virt_to_phys((void *)pgd_val(pgd))
222
-#define pgd_page(pgd) (pfn_to_page(pgd_phys(pgd) >> PAGE_SHIFT))
218
+#define p4d_phys(p4d) virt_to_phys((void *)p4d_val(p4d))
219
+#define p4d_page(p4d) (pfn_to_page(p4d_phys(p4d) >> PAGE_SHIFT))
223220
224
-static inline pud_t *pud_offset(pgd_t *pgd, unsigned long address)
225
-{
226
- return (pud_t *)pgd_page_vaddr(*pgd) + pud_index(address);
227
-}
221
+#define p4d_index(address) (((address) >> P4D_SHIFT) & (PTRS_PER_P4D - 1))
228222
229
-static inline void set_pgd(pgd_t *pgd, pgd_t pgdval)
223
+static inline void set_p4d(p4d_t *p4d, p4d_t p4dval)
230224 {
231
- *pgd = pgdval;
225
+ *p4d = p4dval;
232226 }
233227
234228 #endif
....@@ -319,44 +313,15 @@
319313 #define pfn_pmd(pfn, prot) __pmd(((pfn) << _PFN_SHIFT) | pgprot_val(prot))
320314 #endif
321315
322
-#define __pgd_offset(address) pgd_index(address)
323
-#define __pud_offset(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1))
324
-#define __pmd_offset(address) pmd_index(address)
325
-
326
-/* to find an entry in a kernel page-table-directory */
327
-#define pgd_offset_k(address) pgd_offset(&init_mm, address)
328
-
329
-#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
330
-#define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
331
-
332
-/* to find an entry in a page-table-directory */
333
-#define pgd_offset(mm, addr) ((mm)->pgd + pgd_index(addr))
334
-
335316 #ifndef __PAGETABLE_PMD_FOLDED
336
-static inline unsigned long pud_page_vaddr(pud_t pud)
317
+static inline pmd_t *pud_pgtable(pud_t pud)
337318 {
338
- return pud_val(pud);
319
+ return (pmd_t *)pud_val(pud);
339320 }
340321 #define pud_phys(pud) virt_to_phys((void *)pud_val(pud))
341322 #define pud_page(pud) (pfn_to_page(pud_phys(pud) >> PAGE_SHIFT))
342323
343
-/* Find an entry in the second-level page table.. */
344
-static inline pmd_t *pmd_offset(pud_t * pud, unsigned long address)
345
-{
346
- return (pmd_t *) pud_page_vaddr(*pud) + pmd_index(address);
347
-}
348324 #endif
349
-
350
-/* Find an entry in the third-level page table.. */
351
-#define __pte_offset(address) \
352
- (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
353
-#define pte_offset(dir, address) \
354
- ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address))
355
-#define pte_offset_kernel(dir, address) \
356
- ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address))
357
-#define pte_offset_map(dir, address) \
358
- ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address))
359
-#define pte_unmap(pte) ((void)(pte))
360325
361326 /*
362327 * Initialize a new pgd / pmd table with invalid pointers.