diff options
| -rw-r--r-- | arch/tile/include/asm/pgtable_32.h | 2 | ||||
| -rw-r--r-- | arch/tile/include/asm/pgtable_64.h | 24 | ||||
| -rw-r--r-- | arch/tile/mm/pgtable.c | 3 |
3 files changed, 22 insertions, 7 deletions
diff --git a/arch/tile/include/asm/pgtable_32.h b/arch/tile/include/asm/pgtable_32.h index 4ce4a7a99c24..e5bdc0ea85c6 100644 --- a/arch/tile/include/asm/pgtable_32.h +++ b/arch/tile/include/asm/pgtable_32.h | |||
| @@ -84,6 +84,8 @@ extern unsigned long VMALLOC_RESERVE /* = CONFIG_VMALLOC_RESERVE */; | |||
| 84 | /* We have no pmd or pud since we are strictly a two-level page table */ | 84 | /* We have no pmd or pud since we are strictly a two-level page table */ |
| 85 | #include <asm-generic/pgtable-nopmd.h> | 85 | #include <asm-generic/pgtable-nopmd.h> |
| 86 | 86 | ||
| 87 | static inline int pud_huge_page(pud_t pud) { return 0; } | ||
| 88 | |||
| 87 | /* We don't define any pgds for these addresses. */ | 89 | /* We don't define any pgds for these addresses. */ |
| 88 | static inline int pgd_addr_invalid(unsigned long addr) | 90 | static inline int pgd_addr_invalid(unsigned long addr) |
| 89 | { | 91 | { |
diff --git a/arch/tile/include/asm/pgtable_64.h b/arch/tile/include/asm/pgtable_64.h index 2492fa5478e7..7cb8d355f91b 100644 --- a/arch/tile/include/asm/pgtable_64.h +++ b/arch/tile/include/asm/pgtable_64.h | |||
| @@ -63,6 +63,15 @@ | |||
| 63 | /* We have no pud since we are a three-level page table. */ | 63 | /* We have no pud since we are a three-level page table. */ |
| 64 | #include <asm-generic/pgtable-nopud.h> | 64 | #include <asm-generic/pgtable-nopud.h> |
| 65 | 65 | ||
| 66 | /* | ||
| 67 | * pmds are the same as pgds and ptes, so converting is a no-op. | ||
| 68 | */ | ||
| 69 | #define pmd_pte(pmd) (pmd) | ||
| 70 | #define pmdp_ptep(pmdp) (pmdp) | ||
| 71 | #define pte_pmd(pte) (pte) | ||
| 72 | |||
| 73 | #define pud_pte(pud) ((pud).pgd) | ||
| 74 | |||
| 66 | static inline int pud_none(pud_t pud) | 75 | static inline int pud_none(pud_t pud) |
| 67 | { | 76 | { |
| 68 | return pud_val(pud) == 0; | 77 | return pud_val(pud) == 0; |
| @@ -73,6 +82,11 @@ static inline int pud_present(pud_t pud) | |||
| 73 | return pud_val(pud) & _PAGE_PRESENT; | 82 | return pud_val(pud) & _PAGE_PRESENT; |
| 74 | } | 83 | } |
| 75 | 84 | ||
| 85 | static inline int pud_huge_page(pud_t pud) | ||
| 86 | { | ||
| 87 | return pud_val(pud) & _PAGE_HUGE_PAGE; | ||
| 88 | } | ||
| 89 | |||
| 76 | #define pmd_ERROR(e) \ | 90 | #define pmd_ERROR(e) \ |
| 77 | pr_err("%s:%d: bad pmd 0x%016llx.\n", __FILE__, __LINE__, pmd_val(e)) | 91 | pr_err("%s:%d: bad pmd 0x%016llx.\n", __FILE__, __LINE__, pmd_val(e)) |
| 78 | 92 | ||
| @@ -89,6 +103,9 @@ static inline int pud_bad(pud_t pud) | |||
| 89 | /* Return the page-table frame number (ptfn) that a pud_t points at. */ | 103 | /* Return the page-table frame number (ptfn) that a pud_t points at. */ |
| 90 | #define pud_ptfn(pud) hv_pte_get_ptfn((pud).pgd) | 104 | #define pud_ptfn(pud) hv_pte_get_ptfn((pud).pgd) |
| 91 | 105 | ||
| 106 | /* Return the page frame number (pfn) that a pud_t points at. */ | ||
| 107 | #define pud_pfn(pud) pte_pfn(pud_pte(pud)) | ||
| 108 | |||
| 92 | /* | 109 | /* |
| 93 | * A given kernel pud_t maps to a kernel pmd_t table at a specific | 110 | * A given kernel pud_t maps to a kernel pmd_t table at a specific |
| 94 | * virtual address. Since kernel pmd_t tables can be aligned at | 111 | * virtual address. Since kernel pmd_t tables can be aligned at |
| @@ -152,13 +169,6 @@ static inline pte_t ptep_get_and_clear(struct mm_struct *mm, | |||
| 152 | return hv_pte(__insn_exch(&ptep->val, 0UL)); | 169 | return hv_pte(__insn_exch(&ptep->val, 0UL)); |
| 153 | } | 170 | } |
| 154 | 171 | ||
| 155 | /* | ||
| 156 | * pmds are the same as pgds and ptes, so converting is a no-op. | ||
| 157 | */ | ||
| 158 | #define pmd_pte(pmd) (pmd) | ||
| 159 | #define pmdp_ptep(pmdp) (pmdp) | ||
| 160 | #define pte_pmd(pte) (pte) | ||
| 161 | |||
| 162 | #endif /* __ASSEMBLY__ */ | 172 | #endif /* __ASSEMBLY__ */ |
| 163 | 173 | ||
| 164 | #endif /* _ASM_TILE_PGTABLE_64_H */ | 174 | #endif /* _ASM_TILE_PGTABLE_64_H */ |
diff --git a/arch/tile/mm/pgtable.c b/arch/tile/mm/pgtable.c index e41487e22163..300443389671 100644 --- a/arch/tile/mm/pgtable.c +++ b/arch/tile/mm/pgtable.c | |||
| @@ -338,6 +338,8 @@ pte_t *virt_to_pte(struct mm_struct* mm, unsigned long addr) | |||
| 338 | pud = pud_offset(pgd, addr); | 338 | pud = pud_offset(pgd, addr); |
| 339 | if (!pud_present(*pud)) | 339 | if (!pud_present(*pud)) |
| 340 | return NULL; | 340 | return NULL; |
| 341 | if (pud_huge_page(*pud)) | ||
| 342 | return (pte_t *)pud; | ||
| 341 | pmd = pmd_offset(pud, addr); | 343 | pmd = pmd_offset(pud, addr); |
| 342 | if (pmd_huge_page(*pmd)) | 344 | if (pmd_huge_page(*pmd)) |
| 343 | return (pte_t *)pmd; | 345 | return (pte_t *)pmd; |
| @@ -345,6 +347,7 @@ pte_t *virt_to_pte(struct mm_struct* mm, unsigned long addr) | |||
| 345 | return NULL; | 347 | return NULL; |
| 346 | return pte_offset_kernel(pmd, addr); | 348 | return pte_offset_kernel(pmd, addr); |
| 347 | } | 349 | } |
| 350 | EXPORT_SYMBOL(virt_to_pte); | ||
| 348 | 351 | ||
| 349 | pgprot_t set_remote_cache_cpu(pgprot_t prot, int cpu) | 352 | pgprot_t set_remote_cache_cpu(pgprot_t prot, int cpu) |
| 350 | { | 353 | { |
