aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64/include/asm/pgtable.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm64/include/asm/pgtable.h')
-rw-r--r--arch/arm64/include/asm/pgtable.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index 21771330f809..720fc4a2be49 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -188,6 +188,61 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
188#define __HAVE_ARCH_PTE_SPECIAL 188#define __HAVE_ARCH_PTE_SPECIAL
189 189
190/* 190/*
191 * Software PMD bits for THP
192 */
193
194#define PMD_SECT_DIRTY (_AT(pmdval_t, 1) << 55)
195#define PMD_SECT_SPLITTING (_AT(pmdval_t, 1) << 57)
196
197/*
198 * THP definitions.
199 */
200#define pmd_young(pmd) (pmd_val(pmd) & PMD_SECT_AF)
201
202#define __HAVE_ARCH_PMD_WRITE
203#define pmd_write(pmd) (!(pmd_val(pmd) & PMD_SECT_RDONLY))
204
205#ifdef CONFIG_TRANSPARENT_HUGEPAGE
206#define pmd_trans_huge(pmd) (pmd_val(pmd) && !(pmd_val(pmd) & PMD_TABLE_BIT))
207#define pmd_trans_splitting(pmd) (pmd_val(pmd) & PMD_SECT_SPLITTING)
208#endif
209
210#define PMD_BIT_FUNC(fn,op) \
211static inline pmd_t pmd_##fn(pmd_t pmd) { pmd_val(pmd) op; return pmd; }
212
213PMD_BIT_FUNC(wrprotect, |= PMD_SECT_RDONLY);
214PMD_BIT_FUNC(mkold, &= ~PMD_SECT_AF);
215PMD_BIT_FUNC(mksplitting, |= PMD_SECT_SPLITTING);
216PMD_BIT_FUNC(mkwrite, &= ~PMD_SECT_RDONLY);
217PMD_BIT_FUNC(mkdirty, |= PMD_SECT_DIRTY);
218PMD_BIT_FUNC(mkyoung, |= PMD_SECT_AF);
219PMD_BIT_FUNC(mknotpresent, &= ~PMD_TYPE_MASK);
220
221#define pmd_mkhuge(pmd) (__pmd(pmd_val(pmd) & ~PMD_TABLE_BIT))
222
223#define pmd_pfn(pmd) (((pmd_val(pmd) & PMD_MASK) & PHYS_MASK) >> PAGE_SHIFT)
224#define pfn_pmd(pfn,prot) (__pmd(((phys_addr_t)(pfn) << PAGE_SHIFT) | pgprot_val(prot)))
225#define mk_pmd(page,prot) pfn_pmd(page_to_pfn(page),prot)
226
227#define pmd_page(pmd) pfn_to_page(__phys_to_pfn(pmd_val(pmd) & PHYS_MASK))
228
229static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
230{
231 const pmdval_t mask = PMD_SECT_USER | PMD_SECT_PXN | PMD_SECT_UXN |
232 PMD_SECT_RDONLY | PMD_SECT_PROT_NONE |
233 PMD_SECT_VALID;
234 pmd_val(pmd) = (pmd_val(pmd) & ~mask) | (pgprot_val(newprot) & mask);
235 return pmd;
236}
237
238#define set_pmd_at(mm, addr, pmdp, pmd) set_pmd(pmdp, pmd)
239
240static inline int has_transparent_hugepage(void)
241{
242 return 1;
243}
244
245/*
191 * Mark the prot value as uncacheable and unbufferable. 246 * Mark the prot value as uncacheable and unbufferable.
192 */ 247 */
193#define pgprot_noncached(prot) \ 248#define pgprot_noncached(prot) \