xref: /openbmc/linux/arch/riscv/include/asm/hugetlb.h (revision 19758688)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_RISCV_HUGETLB_H
3 #define _ASM_RISCV_HUGETLB_H
4 
5 #include <asm/cacheflush.h>
6 #include <asm/page.h>
7 
8 static inline void arch_clear_hugepage_flags(struct page *page)
9 {
10 	clear_bit(PG_dcache_clean, &page->flags);
11 }
12 #define arch_clear_hugepage_flags arch_clear_hugepage_flags
13 
14 bool arch_hugetlb_migration_supported(struct hstate *h);
15 #define arch_hugetlb_migration_supported arch_hugetlb_migration_supported
16 
17 #ifdef CONFIG_RISCV_ISA_SVNAPOT
18 #define __HAVE_ARCH_HUGE_PTE_CLEAR
19 void huge_pte_clear(struct mm_struct *mm, unsigned long addr,
20 		    pte_t *ptep, unsigned long sz);
21 
22 #define __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT
23 void set_huge_pte_at(struct mm_struct *mm,
24 		     unsigned long addr, pte_t *ptep, pte_t pte,
25 		     unsigned long sz);
26 
27 #define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR
28 pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
29 			      unsigned long addr, pte_t *ptep);
30 
31 #define __HAVE_ARCH_HUGE_PTEP_CLEAR_FLUSH
32 pte_t huge_ptep_clear_flush(struct vm_area_struct *vma,
33 			    unsigned long addr, pte_t *ptep);
34 
35 #define __HAVE_ARCH_HUGE_PTEP_SET_WRPROTECT
36 void huge_ptep_set_wrprotect(struct mm_struct *mm,
37 			     unsigned long addr, pte_t *ptep);
38 
39 #define __HAVE_ARCH_HUGE_PTEP_SET_ACCESS_FLAGS
40 int huge_ptep_set_access_flags(struct vm_area_struct *vma,
41 			       unsigned long addr, pte_t *ptep,
42 			       pte_t pte, int dirty);
43 
44 #define __HAVE_ARCH_HUGE_PTEP_GET
45 pte_t huge_ptep_get(pte_t *ptep);
46 
47 pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags);
48 #define arch_make_huge_pte arch_make_huge_pte
49 
50 #endif /*CONFIG_RISCV_ISA_SVNAPOT*/
51 
52 #include <asm-generic/hugetlb.h>
53 
54 #endif /* _ASM_RISCV_HUGETLB_H */
55