Skip to content

Commit 6cc1a0e

Browse files
kvaneeshmpe
authored andcommitted
powerpc/mm/radix: Add radix callback for pmd accessors
This only does 64K Linux page support for now. 64K hash Linux config THP needs to differentiate it from hugetlb huge page because with THP we need to track hash pte slot information with respect to each subpage. This is not needed with hugetlb hugepage, because we don't do MPSS with hugetlb. Radix doesn't have any such restrictions. Signed-off-by: Aneesh Kumar K.V <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent a9252aa commit 6cc1a0e

File tree

3 files changed

+36
-5
lines changed

3 files changed

+36
-5
lines changed

arch/powerpc/include/asm/book3s/64/hash-64k.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ extern bool __rpte_sub_valid(real_pte_t rpte, unsigned long index);
9797

9898
extern int remap_pfn_range(struct vm_area_struct *, unsigned long addr,
9999
unsigned long pfn, unsigned long size, pgprot_t);
100-
static inline int remap_4k_pfn(struct vm_area_struct *vma, unsigned long addr,
101-
unsigned long pfn, pgprot_t prot)
100+
static inline int hash__remap_4k_pfn(struct vm_area_struct *vma, unsigned long addr,
101+
unsigned long pfn, pgprot_t prot)
102102
{
103103
if (pfn > (PTE_RPN_MASK >> PAGE_SHIFT)) {
104104
WARN(1, "remap_4k_pfn called with wrong pfn value\n");
@@ -182,14 +182,13 @@ static inline void mark_hpte_slot_valid(unsigned char *hpte_slot_array,
182182
* that for explicit huge pages.
183183
*
184184
*/
185-
static inline int pmd_trans_huge(pmd_t pmd)
185+
static inline int hash__pmd_trans_huge(pmd_t pmd)
186186
{
187187
return !!((pmd_val(pmd) & (_PAGE_PTE | H_PAGE_THP_HUGE)) ==
188188
(_PAGE_PTE | H_PAGE_THP_HUGE));
189189
}
190190

191-
#define __HAVE_ARCH_PMD_SAME
192-
static inline int pmd_same(pmd_t pmd_a, pmd_t pmd_b)
191+
static inline int hash__pmd_same(pmd_t pmd_a, pmd_t pmd_b)
193192
{
194193
return (((pmd_raw(pmd_a) ^ pmd_raw(pmd_b)) & ~cpu_to_be64(_PAGE_HPTEFLAGS)) == 0);
195194
}

arch/powerpc/include/asm/book3s/64/pgtable-64k.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,29 @@ static inline void pmdp_set_wrprotect(struct mm_struct *mm, unsigned long addr,
8989
pmd_hugepage_update(mm, addr, pmdp, _PAGE_WRITE, 0);
9090
}
9191

92+
static inline int pmd_trans_huge(pmd_t pmd)
93+
{
94+
if (radix_enabled())
95+
return radix__pmd_trans_huge(pmd);
96+
return hash__pmd_trans_huge(pmd);
97+
}
98+
99+
#define __HAVE_ARCH_PMD_SAME
100+
static inline int pmd_same(pmd_t pmd_a, pmd_t pmd_b)
101+
{
102+
if (radix_enabled())
103+
return radix__pmd_same(pmd_a, pmd_b);
104+
return hash__pmd_same(pmd_a, pmd_b);
105+
}
92106
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
107+
108+
static inline int remap_4k_pfn(struct vm_area_struct *vma, unsigned long addr,
109+
unsigned long pfn, pgprot_t prot)
110+
{
111+
if (radix_enabled())
112+
BUG();
113+
return hash__remap_4k_pfn(vma, addr, pfn, prot);
114+
115+
}
93116
#endif /* __ASSEMBLY__ */
94117
#endif /*_ASM_POWERPC_BOOK3S_64_PGTABLE_64K_H */

arch/powerpc/include/asm/book3s/64/radix.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,5 +121,14 @@ static inline int radix__pgd_bad(pgd_t pgd)
121121
return !!(pgd_val(pgd) & RADIX_PGD_BAD_BITS);
122122
}
123123

124+
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
125+
126+
static inline int radix__pmd_trans_huge(pmd_t pmd)
127+
{
128+
return !!(pmd_val(pmd) & _PAGE_PTE);
129+
}
130+
131+
#endif
132+
124133
#endif /* __ASSEMBLY__ */
125134
#endif

0 commit comments

Comments
 (0)