xref: /openbmc/linux/arch/parisc/include/asm/hugetlb.h (revision 8e581d43)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2736d2169SHelge Deller #ifndef _ASM_PARISC64_HUGETLB_H
3736d2169SHelge Deller #define _ASM_PARISC64_HUGETLB_H
4736d2169SHelge Deller 
5736d2169SHelge Deller #include <asm/page.h>
6736d2169SHelge Deller 
7cea685d5SAlexandre Ghiti #define __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT
8736d2169SHelge Deller void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
9736d2169SHelge Deller 		     pte_t *ptep, pte_t pte);
10736d2169SHelge Deller 
11a4d83853SAlexandre Ghiti #define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR
12736d2169SHelge Deller pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
13736d2169SHelge Deller 			      pte_t *ptep);
14736d2169SHelge Deller 
15736d2169SHelge Deller static inline int is_hugepage_only_range(struct mm_struct *mm,
16736d2169SHelge Deller 					 unsigned long addr,
17736d2169SHelge Deller 					 unsigned long len) {
18736d2169SHelge Deller 	return 0;
19736d2169SHelge Deller }
20736d2169SHelge Deller 
21736d2169SHelge Deller /*
22736d2169SHelge Deller  * If the arch doesn't supply something else, assume that hugepage
23736d2169SHelge Deller  * size aligned regions are ok without further preparation.
24736d2169SHelge Deller  */
2578d6e4e8SAlexandre Ghiti #define __HAVE_ARCH_PREPARE_HUGEPAGE_RANGE
26736d2169SHelge Deller static inline int prepare_hugepage_range(struct file *file,
27736d2169SHelge Deller 			unsigned long addr, unsigned long len)
28736d2169SHelge Deller {
29736d2169SHelge Deller 	if (len & ~HPAGE_MASK)
30736d2169SHelge Deller 		return -EINVAL;
31736d2169SHelge Deller 	if (addr & ~HPAGE_MASK)
32736d2169SHelge Deller 		return -EINVAL;
33736d2169SHelge Deller 	return 0;
34736d2169SHelge Deller }
35736d2169SHelge Deller 
36fe632225SAlexandre Ghiti #define __HAVE_ARCH_HUGE_PTEP_CLEAR_FLUSH
37736d2169SHelge Deller static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
38736d2169SHelge Deller 					 unsigned long addr, pte_t *ptep)
39736d2169SHelge Deller {
40736d2169SHelge Deller }
41736d2169SHelge Deller 
428e581d43SAlexandre Ghiti #define __HAVE_ARCH_HUGE_PTEP_SET_WRPROTECT
43b0e55131SHelge Deller void huge_ptep_set_wrprotect(struct mm_struct *mm,
44b0e55131SHelge Deller 					   unsigned long addr, pte_t *ptep);
45736d2169SHelge Deller 
46b0e55131SHelge Deller int huge_ptep_set_access_flags(struct vm_area_struct *vma,
47736d2169SHelge Deller 					     unsigned long addr, pte_t *ptep,
48b0e55131SHelge Deller 					     pte_t pte, int dirty);
49736d2169SHelge Deller 
50736d2169SHelge Deller static inline pte_t huge_ptep_get(pte_t *ptep)
51736d2169SHelge Deller {
52736d2169SHelge Deller 	return *ptep;
53736d2169SHelge Deller }
54736d2169SHelge Deller 
55736d2169SHelge Deller static inline void arch_clear_hugepage_flags(struct page *page)
56736d2169SHelge Deller {
57736d2169SHelge Deller }
58736d2169SHelge Deller 
591e5f50fcSAlexandre Ghiti #include <asm-generic/hugetlb.h>
601e5f50fcSAlexandre Ghiti 
61736d2169SHelge Deller #endif /* _ASM_PARISC64_HUGETLB_H */
62