accel/ivpu: Enable HWS by default on all platforms
[drm/drm-misc.git] / include / asm-generic / hugetlb.h
blobf42133dae68e5aa44b820ca973679db1c87c1419
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_GENERIC_HUGETLB_H
3 #define _ASM_GENERIC_HUGETLB_H
5 #include <linux/swap.h>
6 #include <linux/swapops.h>
8 static inline pte_t mk_huge_pte(struct page *page, pgprot_t pgprot)
10 return mk_pte(page, pgprot);
13 static inline unsigned long huge_pte_write(pte_t pte)
15 return pte_write(pte);
18 static inline unsigned long huge_pte_dirty(pte_t pte)
20 return pte_dirty(pte);
23 static inline pte_t huge_pte_mkwrite(pte_t pte)
25 return pte_mkwrite_novma(pte);
28 #ifndef __HAVE_ARCH_HUGE_PTE_WRPROTECT
29 static inline pte_t huge_pte_wrprotect(pte_t pte)
31 return pte_wrprotect(pte);
33 #endif
35 static inline pte_t huge_pte_mkdirty(pte_t pte)
37 return pte_mkdirty(pte);
40 static inline pte_t huge_pte_modify(pte_t pte, pgprot_t newprot)
42 return pte_modify(pte, newprot);
45 #ifndef __HAVE_ARCH_HUGE_PTE_MKUFFD_WP
46 static inline pte_t huge_pte_mkuffd_wp(pte_t pte)
48 return huge_pte_wrprotect(pte_mkuffd_wp(pte));
50 #endif
52 #ifndef __HAVE_ARCH_HUGE_PTE_CLEAR_UFFD_WP
53 static inline pte_t huge_pte_clear_uffd_wp(pte_t pte)
55 return pte_clear_uffd_wp(pte);
57 #endif
59 #ifndef __HAVE_ARCH_HUGE_PTE_UFFD_WP
60 static inline int huge_pte_uffd_wp(pte_t pte)
62 return pte_uffd_wp(pte);
64 #endif
66 #ifndef __HAVE_ARCH_HUGE_PTE_CLEAR
67 static inline void huge_pte_clear(struct mm_struct *mm, unsigned long addr,
68 pte_t *ptep, unsigned long sz)
70 pte_clear(mm, addr, ptep);
72 #endif
74 #ifndef __HAVE_ARCH_HUGETLB_FREE_PGD_RANGE
75 static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb,
76 unsigned long addr, unsigned long end,
77 unsigned long floor, unsigned long ceiling)
79 free_pgd_range(tlb, addr, end, floor, ceiling);
81 #endif
83 #ifndef __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT
84 static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
85 pte_t *ptep, pte_t pte, unsigned long sz)
87 set_pte_at(mm, addr, ptep, pte);
89 #endif
91 #ifndef __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR
92 static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
93 unsigned long addr, pte_t *ptep)
95 return ptep_get_and_clear(mm, addr, ptep);
97 #endif
99 #ifndef __HAVE_ARCH_HUGE_PTEP_CLEAR_FLUSH
100 static inline pte_t huge_ptep_clear_flush(struct vm_area_struct *vma,
101 unsigned long addr, pte_t *ptep)
103 return ptep_clear_flush(vma, addr, ptep);
105 #endif
107 #ifndef __HAVE_ARCH_HUGE_PTE_NONE
108 static inline int huge_pte_none(pte_t pte)
110 return pte_none(pte);
112 #endif
114 /* Please refer to comments above pte_none_mostly() for the usage */
115 #ifndef __HAVE_ARCH_HUGE_PTE_NONE_MOSTLY
116 static inline int huge_pte_none_mostly(pte_t pte)
118 return huge_pte_none(pte) || is_pte_marker(pte);
120 #endif
122 #ifndef __HAVE_ARCH_PREPARE_HUGEPAGE_RANGE
123 static inline int prepare_hugepage_range(struct file *file,
124 unsigned long addr, unsigned long len)
126 return 0;
128 #endif
130 #ifndef __HAVE_ARCH_HUGE_PTEP_SET_WRPROTECT
131 static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
132 unsigned long addr, pte_t *ptep)
134 ptep_set_wrprotect(mm, addr, ptep);
136 #endif
138 #ifndef __HAVE_ARCH_HUGE_PTEP_SET_ACCESS_FLAGS
139 static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma,
140 unsigned long addr, pte_t *ptep,
141 pte_t pte, int dirty)
143 return ptep_set_access_flags(vma, addr, ptep, pte, dirty);
145 #endif
147 #ifndef __HAVE_ARCH_HUGE_PTEP_GET
148 static inline pte_t huge_ptep_get(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
150 return ptep_get(ptep);
152 #endif
154 #ifndef __HAVE_ARCH_GIGANTIC_PAGE_RUNTIME_SUPPORTED
155 static inline bool gigantic_page_runtime_supported(void)
157 return IS_ENABLED(CONFIG_ARCH_HAS_GIGANTIC_PAGE);
159 #endif /* __HAVE_ARCH_GIGANTIC_PAGE_RUNTIME_SUPPORTED */
161 #endif /* _ASM_GENERIC_HUGETLB_H */