diff options
Diffstat (limited to 'arch/tile/include/asm/pgtable_32.h')
-rw-r--r-- | arch/tile/include/asm/pgtable_32.h | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/arch/tile/include/asm/pgtable_32.h b/arch/tile/include/asm/pgtable_32.h index 9f98529761fd..4ce4a7a99c24 100644 --- a/arch/tile/include/asm/pgtable_32.h +++ b/arch/tile/include/asm/pgtable_32.h | |||
@@ -20,11 +20,12 @@ | |||
20 | * The level-1 index is defined by the huge page size. A PGD is composed | 20 | * The level-1 index is defined by the huge page size. A PGD is composed |
21 | * of PTRS_PER_PGD pgd_t's and is the top level of the page table. | 21 | * of PTRS_PER_PGD pgd_t's and is the top level of the page table. |
22 | */ | 22 | */ |
23 | #define PGDIR_SHIFT HV_LOG2_PAGE_SIZE_LARGE | 23 | #define PGDIR_SHIFT HPAGE_SHIFT |
24 | #define PGDIR_SIZE HV_PAGE_SIZE_LARGE | 24 | #define PGDIR_SIZE HPAGE_SIZE |
25 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) | 25 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) |
26 | #define PTRS_PER_PGD (1 << (32 - PGDIR_SHIFT)) | 26 | #define PTRS_PER_PGD _HV_L1_ENTRIES(HPAGE_SHIFT) |
27 | #define SIZEOF_PGD (PTRS_PER_PGD * sizeof(pgd_t)) | 27 | #define PGD_INDEX(va) _HV_L1_INDEX(va, HPAGE_SHIFT) |
28 | #define SIZEOF_PGD _HV_L1_SIZE(HPAGE_SHIFT) | ||
28 | 29 | ||
29 | /* | 30 | /* |
30 | * The level-2 index is defined by the difference between the huge | 31 | * The level-2 index is defined by the difference between the huge |
@@ -33,8 +34,9 @@ | |||
33 | * Note that the hypervisor docs use PTE for what we call pte_t, so | 34 | * Note that the hypervisor docs use PTE for what we call pte_t, so |
34 | * this nomenclature is somewhat confusing. | 35 | * this nomenclature is somewhat confusing. |
35 | */ | 36 | */ |
36 | #define PTRS_PER_PTE (1 << (HV_LOG2_PAGE_SIZE_LARGE - HV_LOG2_PAGE_SIZE_SMALL)) | 37 | #define PTRS_PER_PTE _HV_L2_ENTRIES(HPAGE_SHIFT, PAGE_SHIFT) |
37 | #define SIZEOF_PTE (PTRS_PER_PTE * sizeof(pte_t)) | 38 | #define PTE_INDEX(va) _HV_L2_INDEX(va, HPAGE_SHIFT, PAGE_SHIFT) |
39 | #define SIZEOF_PTE _HV_L2_SIZE(HPAGE_SHIFT, PAGE_SHIFT) | ||
38 | 40 | ||
39 | #ifndef __ASSEMBLY__ | 41 | #ifndef __ASSEMBLY__ |
40 | 42 | ||
@@ -111,24 +113,14 @@ static inline pte_t ptep_get_and_clear(struct mm_struct *mm, | |||
111 | return pte; | 113 | return pte; |
112 | } | 114 | } |
113 | 115 | ||
114 | static inline void __set_pmd(pmd_t *pmdp, pmd_t pmdval) | 116 | /* |
115 | { | 117 | * pmds are wrappers around pgds, which are the same as ptes. |
116 | set_pte(&pmdp->pud.pgd, pmdval.pud.pgd); | 118 | * It's often convenient to "cast" back and forth and use the pte methods, |
117 | } | 119 | * which are the methods supplied by the hypervisor. |
118 | 120 | */ | |
119 | /* Create a pmd from a PTFN. */ | 121 | #define pmd_pte(pmd) ((pmd).pud.pgd) |
120 | static inline pmd_t ptfn_pmd(unsigned long ptfn, pgprot_t prot) | 122 | #define pmdp_ptep(pmdp) (&(pmdp)->pud.pgd) |
121 | { | 123 | #define pte_pmd(pte) ((pmd_t){ { (pte) } }) |
122 | return (pmd_t){ { hv_pte_set_ptfn(prot, ptfn) } }; | ||
123 | } | ||
124 | |||
125 | /* Return the page-table frame number (ptfn) that a pmd_t points at. */ | ||
126 | #define pmd_ptfn(pmd) hv_pte_get_ptfn((pmd).pud.pgd) | ||
127 | |||
128 | static inline void pmd_clear(pmd_t *pmdp) | ||
129 | { | ||
130 | __pte_clear(&pmdp->pud.pgd); | ||
131 | } | ||
132 | 124 | ||
133 | #endif /* __ASSEMBLY__ */ | 125 | #endif /* __ASSEMBLY__ */ |
134 | 126 | ||