aboutsummaryrefslogtreecommitdiffstats
path: root/arch/tile/include
diff options
context:
space:
mode:
authorChris Metcalf <cmetcalf@tilera.com>2013-08-10 13:15:46 -0400
committerChris Metcalf <cmetcalf@tilera.com>2013-08-30 11:57:02 -0400
commita718e10cbaa28035b7ab510d68fef68524454e1a (patch)
tree64b9283a5d94e2aa78046cc52f47757a8224d8ed /arch/tile/include
parent35f059761c5ac313d13372fe3cdaa41bce3d0dbf (diff)
tile: handle super huge pages in virt_to_pte
This tile-specific API had a minor bug, in that if a super huge (>4GB) page mapped a particular address range, we wouldn't handle it correctly. As part of fixing that bug, I also cleaned up some of the pud and pmd accessors to make them more consistent. Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Diffstat (limited to 'arch/tile/include')
-rw-r--r--arch/tile/include/asm/pgtable_32.h2
-rw-r--r--arch/tile/include/asm/pgtable_64.h24
2 files changed, 19 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
87static 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. */
88static inline int pgd_addr_invalid(unsigned long addr) 90static 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
66static inline int pud_none(pud_t pud) 75static 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
85static 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 */