xref: /openbmc/linux/arch/riscv/include/asm/hugetlb.h (revision 3ddc8b84)
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 #ifdef CONFIG_RISCV_ISA_SVNAPOT
15 #define __HAVE_ARCH_HUGE_PTE_CLEAR
16 void huge_pte_clear(struct mm_struct *mm, unsigned long addr,
17 		    pte_t *ptep, unsigned long sz);
18 
19 #define __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT
20 void set_huge_pte_at(struct mm_struct *mm,
21 		     unsigned long addr, pte_t *ptep, pte_t pte,
22 		     unsigned long sz);
23 
24 #define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR
25 pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
26 			      unsigned long addr, pte_t *ptep);
27 
28 #define __HAVE_ARCH_HUGE_PTEP_CLEAR_FLUSH
29 pte_t huge_ptep_clear_flush(struct vm_area_struct *vma,
30 			    unsigned long addr, pte_t *ptep);
31 
32 #define __HAVE_ARCH_HUGE_PTEP_SET_WRPROTECT
33 void huge_ptep_set_wrprotect(struct mm_struct *mm,
34 			     unsigned long addr, pte_t *ptep);
35 
36 #define __HAVE_ARCH_HUGE_PTEP_SET_ACCESS_FLAGS
37 int huge_ptep_set_access_flags(struct vm_area_struct *vma,
38 			       unsigned long addr, pte_t *ptep,
39 			       pte_t pte, int dirty);
40 
41 #define __HAVE_ARCH_HUGE_PTEP_GET
42 pte_t huge_ptep_get(pte_t *ptep);
43 
44 pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags);
45 #define arch_make_huge_pte arch_make_huge_pte
46 
47 #endif /*CONFIG_RISCV_ISA_SVNAPOT*/
48 
49 #include <asm-generic/hugetlb.h>
50 
51 #endif /* _ASM_RISCV_HUGETLB_H */
52