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