File Index
Files and directories
Sign in
FILE

hugetlb.h

File preview with syntax highlighting.

linux-6.19.14/include/asm-generic/hugetlb.h C
  1/* SPDX-License-Identifier: GPL-2.0 */
  2#ifndef _ASM_GENERIC_HUGETLB_H
  3#define _ASM_GENERIC_HUGETLB_H
  4
  5#include <linux/swap.h>
  6#include <linux/swapops.h>
  7
  8static inline unsigned long huge_pte_write(pte_t pte)
  9{
 10	return pte_write(pte);
 11}
 12
 13static inline unsigned long huge_pte_dirty(pte_t pte)
 14{
 15	return pte_dirty(pte);
 16}
 17
 18static inline pte_t huge_pte_mkwrite(pte_t pte)
 19{
 20	return pte_mkwrite_novma(pte);
 21}
 22
 23#ifndef __HAVE_ARCH_HUGE_PTE_WRPROTECT
 24static inline pte_t huge_pte_wrprotect(pte_t pte)
 25{
 26	return pte_wrprotect(pte);
 27}
 28#endif
 29
 30static inline pte_t huge_pte_mkdirty(pte_t pte)
 31{
 32	return pte_mkdirty(pte);
 33}
 34
 35static inline pte_t huge_pte_modify(pte_t pte, pgprot_t newprot)
 36{
 37	return pte_modify(pte, newprot);
 38}
 39
 40#ifndef __HAVE_ARCH_HUGE_PTE_MKUFFD_WP
 41static inline pte_t huge_pte_mkuffd_wp(pte_t pte)
 42{
 43	return huge_pte_wrprotect(pte_mkuffd_wp(pte));
 44}
 45#endif
 46
 47#ifndef __HAVE_ARCH_HUGE_PTE_CLEAR_UFFD_WP
 48static inline pte_t huge_pte_clear_uffd_wp(pte_t pte)
 49{
 50	return pte_clear_uffd_wp(pte);
 51}
 52#endif
 53
 54#ifndef __HAVE_ARCH_HUGE_PTE_UFFD_WP
 55static inline int huge_pte_uffd_wp(pte_t pte)
 56{
 57	return pte_uffd_wp(pte);
 58}
 59#endif
 60
 61#ifndef __HAVE_ARCH_HUGE_PTE_CLEAR
 62static inline void huge_pte_clear(struct mm_struct *mm, unsigned long addr,
 63		    pte_t *ptep, unsigned long sz)
 64{
 65	pte_clear(mm, addr, ptep);
 66}
 67#endif
 68
 69#ifndef __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT
 70static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
 71		pte_t *ptep, pte_t pte, unsigned long sz)
 72{
 73	set_pte_at(mm, addr, ptep, pte);
 74}
 75#endif
 76
 77#ifndef __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR
 78static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
 79		unsigned long addr, pte_t *ptep, unsigned long sz)
 80{
 81	return ptep_get_and_clear(mm, addr, ptep);
 82}
 83#endif
 84
 85#ifndef __HAVE_ARCH_HUGE_PTEP_CLEAR_FLUSH
 86static inline pte_t huge_ptep_clear_flush(struct vm_area_struct *vma,
 87		unsigned long addr, pte_t *ptep)
 88{
 89	return ptep_clear_flush(vma, addr, ptep);
 90}
 91#endif
 92
 93#ifndef __HAVE_ARCH_HUGE_PTE_NONE
 94static inline int huge_pte_none(pte_t pte)
 95{
 96	return pte_none(pte);
 97}
 98#endif
 99
100#ifndef __HAVE_ARCH_HUGE_PTEP_SET_WRPROTECT
101static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
102		unsigned long addr, pte_t *ptep)
103{
104	ptep_set_wrprotect(mm, addr, ptep);
105}
106#endif
107
108#ifndef __HAVE_ARCH_HUGE_PTEP_SET_ACCESS_FLAGS
109static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma,
110		unsigned long addr, pte_t *ptep,
111		pte_t pte, int dirty)
112{
113	return ptep_set_access_flags(vma, addr, ptep, pte, dirty);
114}
115#endif
116
117#ifndef __HAVE_ARCH_HUGE_PTEP_GET
118static inline pte_t huge_ptep_get(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
119{
120	return ptep_get(ptep);
121}
122#endif
123
124#ifndef __HAVE_ARCH_GIGANTIC_PAGE_RUNTIME_SUPPORTED
125static inline bool gigantic_page_runtime_supported(void)
126{
127	return IS_ENABLED(CONFIG_ARCH_HAS_GIGANTIC_PAGE);
128}
129#endif /* __HAVE_ARCH_GIGANTIC_PAGE_RUNTIME_SUPPORTED */
130
131#endif /* _ASM_GENERIC_HUGETLB_H */
~/ Read-only file preview.