18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * arch/arm64/include/asm/hugetlb.h
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2013 Linaro Ltd.
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Based on arch/x86/include/asm/hugetlb.h
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#ifndef __ASM_HUGETLB_H
118c2ecf20Sopenharmony_ci#define __ASM_HUGETLB_H
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#include <asm/page.h>
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
168c2ecf20Sopenharmony_ci#define arch_hugetlb_migration_supported arch_hugetlb_migration_supported
178c2ecf20Sopenharmony_ciextern bool arch_hugetlb_migration_supported(struct hstate *h);
188c2ecf20Sopenharmony_ci#endif
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_cistatic inline void arch_clear_hugepage_flags(struct page *page)
218c2ecf20Sopenharmony_ci{
228c2ecf20Sopenharmony_ci	clear_bit(PG_dcache_clean, &page->flags);
238c2ecf20Sopenharmony_ci}
248c2ecf20Sopenharmony_ci#define arch_clear_hugepage_flags arch_clear_hugepage_flags
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ciextern pte_t arch_make_huge_pte(pte_t entry, struct vm_area_struct *vma,
278c2ecf20Sopenharmony_ci				struct page *page, int writable);
288c2ecf20Sopenharmony_ci#define arch_make_huge_pte arch_make_huge_pte
298c2ecf20Sopenharmony_ci#define __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT
308c2ecf20Sopenharmony_ciextern void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
318c2ecf20Sopenharmony_ci			    pte_t *ptep, pte_t pte);
328c2ecf20Sopenharmony_ci#define __HAVE_ARCH_HUGE_PTEP_SET_ACCESS_FLAGS
338c2ecf20Sopenharmony_ciextern int huge_ptep_set_access_flags(struct vm_area_struct *vma,
348c2ecf20Sopenharmony_ci				      unsigned long addr, pte_t *ptep,
358c2ecf20Sopenharmony_ci				      pte_t pte, int dirty);
368c2ecf20Sopenharmony_ci#define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR
378c2ecf20Sopenharmony_ciextern pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
388c2ecf20Sopenharmony_ci				     unsigned long addr, pte_t *ptep);
398c2ecf20Sopenharmony_ci#define __HAVE_ARCH_HUGE_PTEP_SET_WRPROTECT
408c2ecf20Sopenharmony_ciextern void huge_ptep_set_wrprotect(struct mm_struct *mm,
418c2ecf20Sopenharmony_ci				    unsigned long addr, pte_t *ptep);
428c2ecf20Sopenharmony_ci#define __HAVE_ARCH_HUGE_PTEP_CLEAR_FLUSH
438c2ecf20Sopenharmony_ciextern void huge_ptep_clear_flush(struct vm_area_struct *vma,
448c2ecf20Sopenharmony_ci				  unsigned long addr, pte_t *ptep);
458c2ecf20Sopenharmony_ci#define __HAVE_ARCH_HUGE_PTE_CLEAR
468c2ecf20Sopenharmony_ciextern void huge_pte_clear(struct mm_struct *mm, unsigned long addr,
478c2ecf20Sopenharmony_ci			   pte_t *ptep, unsigned long sz);
488c2ecf20Sopenharmony_ciextern void set_huge_swap_pte_at(struct mm_struct *mm, unsigned long addr,
498c2ecf20Sopenharmony_ci				 pte_t *ptep, pte_t pte, unsigned long sz);
508c2ecf20Sopenharmony_ci#define set_huge_swap_pte_at set_huge_swap_pte_at
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_civoid __init arm64_hugetlb_cma_reserve(void);
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci#include <asm-generic/hugetlb.h>
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci#endif /* __ASM_HUGETLB_H */
57