xref: /linux/arch/riscv/include/asm/hugetlb.h (revision a1ff5a7d78a036d6c2178ee5acd6ba4946243800)
19e953cdaSAlexandre Ghiti /* SPDX-License-Identifier: GPL-2.0 */
29e953cdaSAlexandre Ghiti #ifndef _ASM_RISCV_HUGETLB_H
39e953cdaSAlexandre Ghiti #define _ASM_RISCV_HUGETLB_H
49e953cdaSAlexandre Ghiti 
533a9fb09SHugh Dickins #include <asm/cacheflush.h>
69e953cdaSAlexandre Ghiti #include <asm/page.h>
79e953cdaSAlexandre Ghiti 
arch_clear_hugetlb_flags(struct folio * folio)851718e25SMatthew Wilcox (Oracle) static inline void arch_clear_hugetlb_flags(struct folio *folio)
9d8bf77a1STong Tiangen {
1051718e25SMatthew Wilcox (Oracle) 	clear_bit(PG_dcache_clean, &folio->flags);
11d8bf77a1STong Tiangen }
1251718e25SMatthew Wilcox (Oracle) #define arch_clear_hugetlb_flags arch_clear_hugetlb_flags
13d8bf77a1STong Tiangen 
14fc325b1aSAlexandre Ghiti #ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
15ce68c035SAlexandre Ghiti bool arch_hugetlb_migration_supported(struct hstate *h);
16ce68c035SAlexandre Ghiti #define arch_hugetlb_migration_supported arch_hugetlb_migration_supported
17fc325b1aSAlexandre Ghiti #endif
18ce68c035SAlexandre Ghiti 
1982a1a1f3SQinglin Pan #ifdef CONFIG_RISCV_ISA_SVNAPOT
2082a1a1f3SQinglin Pan #define __HAVE_ARCH_HUGE_PTE_CLEAR
2182a1a1f3SQinglin Pan void huge_pte_clear(struct mm_struct *mm, unsigned long addr,
2282a1a1f3SQinglin Pan 		    pte_t *ptep, unsigned long sz);
2382a1a1f3SQinglin Pan 
2482a1a1f3SQinglin Pan #define __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT
2582a1a1f3SQinglin Pan void set_huge_pte_at(struct mm_struct *mm,
26935d4f0cSRyan Roberts 		     unsigned long addr, pte_t *ptep, pte_t pte,
27935d4f0cSRyan Roberts 		     unsigned long sz);
2882a1a1f3SQinglin Pan 
2982a1a1f3SQinglin Pan #define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR
3082a1a1f3SQinglin Pan pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
3182a1a1f3SQinglin Pan 			      unsigned long addr, pte_t *ptep);
3282a1a1f3SQinglin Pan 
3382a1a1f3SQinglin Pan #define __HAVE_ARCH_HUGE_PTEP_CLEAR_FLUSH
3482a1a1f3SQinglin Pan pte_t huge_ptep_clear_flush(struct vm_area_struct *vma,
3582a1a1f3SQinglin Pan 			    unsigned long addr, pte_t *ptep);
3682a1a1f3SQinglin Pan 
3782a1a1f3SQinglin Pan #define __HAVE_ARCH_HUGE_PTEP_SET_WRPROTECT
3882a1a1f3SQinglin Pan void huge_ptep_set_wrprotect(struct mm_struct *mm,
3982a1a1f3SQinglin Pan 			     unsigned long addr, pte_t *ptep);
4082a1a1f3SQinglin Pan 
4182a1a1f3SQinglin Pan #define __HAVE_ARCH_HUGE_PTEP_SET_ACCESS_FLAGS
4282a1a1f3SQinglin Pan int huge_ptep_set_access_flags(struct vm_area_struct *vma,
4382a1a1f3SQinglin Pan 			       unsigned long addr, pte_t *ptep,
4482a1a1f3SQinglin Pan 			       pte_t pte, int dirty);
4582a1a1f3SQinglin Pan 
466966d798SAlexandre Ghiti #define __HAVE_ARCH_HUGE_PTEP_GET
47*e6c0c032SChristophe Leroy pte_t huge_ptep_get(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
486966d798SAlexandre Ghiti 
4982a1a1f3SQinglin Pan pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags);
5082a1a1f3SQinglin Pan #define arch_make_huge_pte arch_make_huge_pte
5182a1a1f3SQinglin Pan 
5282a1a1f3SQinglin Pan #endif /*CONFIG_RISCV_ISA_SVNAPOT*/
5382a1a1f3SQinglin Pan 
5482a1a1f3SQinglin Pan #include <asm-generic/hugetlb.h>
5582a1a1f3SQinglin Pan 
569e953cdaSAlexandre Ghiti #endif /* _ASM_RISCV_HUGETLB_H */
57