xref: /linux/arch/riscv/include/asm/hugetlb.h (revision 6966d7988c4fb6af3e395868e9800c07f9e98a30)
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 
1382a1a1f3SQinglin Pan #ifdef CONFIG_RISCV_ISA_SVNAPOT
1482a1a1f3SQinglin Pan #define __HAVE_ARCH_HUGE_PTE_CLEAR
1582a1a1f3SQinglin Pan void huge_pte_clear(struct mm_struct *mm, unsigned long addr,
1682a1a1f3SQinglin Pan 		    pte_t *ptep, unsigned long sz);
1782a1a1f3SQinglin Pan 
1882a1a1f3SQinglin Pan #define __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT
1982a1a1f3SQinglin Pan void set_huge_pte_at(struct mm_struct *mm,
2082a1a1f3SQinglin Pan 		     unsigned long addr, pte_t *ptep, pte_t pte);
2182a1a1f3SQinglin Pan 
2282a1a1f3SQinglin Pan #define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR
2382a1a1f3SQinglin Pan pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
2482a1a1f3SQinglin Pan 			      unsigned long addr, pte_t *ptep);
2582a1a1f3SQinglin Pan 
2682a1a1f3SQinglin Pan #define __HAVE_ARCH_HUGE_PTEP_CLEAR_FLUSH
2782a1a1f3SQinglin Pan pte_t huge_ptep_clear_flush(struct vm_area_struct *vma,
2882a1a1f3SQinglin Pan 			    unsigned long addr, pte_t *ptep);
2982a1a1f3SQinglin Pan 
3082a1a1f3SQinglin Pan #define __HAVE_ARCH_HUGE_PTEP_SET_WRPROTECT
3182a1a1f3SQinglin Pan void huge_ptep_set_wrprotect(struct mm_struct *mm,
3282a1a1f3SQinglin Pan 			     unsigned long addr, pte_t *ptep);
3382a1a1f3SQinglin Pan 
3482a1a1f3SQinglin Pan #define __HAVE_ARCH_HUGE_PTEP_SET_ACCESS_FLAGS
3582a1a1f3SQinglin Pan int huge_ptep_set_access_flags(struct vm_area_struct *vma,
3682a1a1f3SQinglin Pan 			       unsigned long addr, pte_t *ptep,
3782a1a1f3SQinglin Pan 			       pte_t pte, int dirty);
3882a1a1f3SQinglin Pan 
39*6966d798SAlexandre Ghiti #define __HAVE_ARCH_HUGE_PTEP_GET
40*6966d798SAlexandre Ghiti pte_t huge_ptep_get(pte_t *ptep);
41*6966d798SAlexandre Ghiti 
4282a1a1f3SQinglin Pan pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags);
4382a1a1f3SQinglin Pan #define arch_make_huge_pte arch_make_huge_pte
4482a1a1f3SQinglin Pan 
4582a1a1f3SQinglin Pan #endif /*CONFIG_RISCV_ISA_SVNAPOT*/
4682a1a1f3SQinglin Pan 
4782a1a1f3SQinglin Pan #include <asm-generic/hugetlb.h>
4882a1a1f3SQinglin Pan 
499e953cdaSAlexandre Ghiti #endif /* _ASM_RISCV_HUGETLB_H */
50