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