xref: /openbmc/linux/arch/arm64/include/asm/hugetlb.h (revision 71de0a05)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * arch/arm64/include/asm/hugetlb.h
4  *
5  * Copyright (C) 2013 Linaro Ltd.
6  *
7  * Based on arch/x86/include/asm/hugetlb.h
8  */
9 
10 #ifndef __ASM_HUGETLB_H
11 #define __ASM_HUGETLB_H
12 
13 #include <asm/page.h>
14 
15 #ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
16 #define arch_hugetlb_migration_supported arch_hugetlb_migration_supported
17 extern bool arch_hugetlb_migration_supported(struct hstate *h);
18 #endif
19 
20 static inline void arch_clear_hugepage_flags(struct page *page)
21 {
22 	clear_bit(PG_dcache_clean, &page->flags);
23 }
24 #define arch_clear_hugepage_flags arch_clear_hugepage_flags
25 
26 pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags);
27 #define arch_make_huge_pte arch_make_huge_pte
28 #define __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT
29 extern void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
30 			    pte_t *ptep, pte_t pte);
31 #define __HAVE_ARCH_HUGE_PTEP_SET_ACCESS_FLAGS
32 extern int huge_ptep_set_access_flags(struct vm_area_struct *vma,
33 				      unsigned long addr, pte_t *ptep,
34 				      pte_t pte, int dirty);
35 #define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR
36 extern pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
37 				     unsigned long addr, pte_t *ptep);
38 #define __HAVE_ARCH_HUGE_PTEP_SET_WRPROTECT
39 extern void huge_ptep_set_wrprotect(struct mm_struct *mm,
40 				    unsigned long addr, pte_t *ptep);
41 #define __HAVE_ARCH_HUGE_PTEP_CLEAR_FLUSH
42 extern pte_t huge_ptep_clear_flush(struct vm_area_struct *vma,
43 				   unsigned long addr, pte_t *ptep);
44 #define __HAVE_ARCH_HUGE_PTE_CLEAR
45 extern void huge_pte_clear(struct mm_struct *mm, unsigned long addr,
46 			   pte_t *ptep, unsigned long sz);
47 #define __HAVE_ARCH_HUGE_PTEP_GET
48 extern pte_t huge_ptep_get(pte_t *ptep);
49 
50 void __init arm64_hugetlb_cma_reserve(void);
51 
52 #define huge_ptep_modify_prot_start huge_ptep_modify_prot_start
53 extern pte_t huge_ptep_modify_prot_start(struct vm_area_struct *vma,
54 					 unsigned long addr, pte_t *ptep);
55 
56 #define huge_ptep_modify_prot_commit huge_ptep_modify_prot_commit
57 extern void huge_ptep_modify_prot_commit(struct vm_area_struct *vma,
58 					 unsigned long addr, pte_t *ptep,
59 					 pte_t old_pte, pte_t new_pte);
60 
61 #include <asm-generic/hugetlb.h>
62 
63 #endif /* __ASM_HUGETLB_H */
64