Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / arch / arm64 / include / asm / hugetlb.h
blobc6dff3e69539b4ff6573db3edd28359d49529a1d
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * arch/arm64/include/asm/hugetlb.h
5 * Copyright (C) 2013 Linaro Ltd.
7 * Based on arch/x86/include/asm/hugetlb.h
8 */
10 #ifndef __ASM_HUGETLB_H
11 #define __ASM_HUGETLB_H
13 #include <asm/cacheflush.h>
14 #include <asm/mte.h>
15 #include <asm/page.h>
17 #ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
18 #define arch_hugetlb_migration_supported arch_hugetlb_migration_supported
19 extern bool arch_hugetlb_migration_supported(struct hstate *h);
20 #endif
22 static inline void arch_clear_hugetlb_flags(struct folio *folio)
24 clear_bit(PG_dcache_clean, &folio->flags);
26 #ifdef CONFIG_ARM64_MTE
27 if (system_supports_mte()) {
28 clear_bit(PG_mte_tagged, &folio->flags);
29 clear_bit(PG_mte_lock, &folio->flags);
31 #endif
33 #define arch_clear_hugetlb_flags arch_clear_hugetlb_flags
35 pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags);
36 #define arch_make_huge_pte arch_make_huge_pte
37 #define __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT
38 extern void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
39 pte_t *ptep, pte_t pte, unsigned long sz);
40 #define __HAVE_ARCH_HUGE_PTEP_SET_ACCESS_FLAGS
41 extern int huge_ptep_set_access_flags(struct vm_area_struct *vma,
42 unsigned long addr, pte_t *ptep,
43 pte_t pte, int dirty);
44 #define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR
45 extern pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
46 unsigned long addr, pte_t *ptep);
47 #define __HAVE_ARCH_HUGE_PTEP_SET_WRPROTECT
48 extern void huge_ptep_set_wrprotect(struct mm_struct *mm,
49 unsigned long addr, pte_t *ptep);
50 #define __HAVE_ARCH_HUGE_PTEP_CLEAR_FLUSH
51 extern pte_t huge_ptep_clear_flush(struct vm_area_struct *vma,
52 unsigned long addr, pte_t *ptep);
53 #define __HAVE_ARCH_HUGE_PTE_CLEAR
54 extern void huge_pte_clear(struct mm_struct *mm, unsigned long addr,
55 pte_t *ptep, unsigned long sz);
56 #define __HAVE_ARCH_HUGE_PTEP_GET
57 extern pte_t huge_ptep_get(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
59 void __init arm64_hugetlb_cma_reserve(void);
61 #define huge_ptep_modify_prot_start huge_ptep_modify_prot_start
62 extern pte_t huge_ptep_modify_prot_start(struct vm_area_struct *vma,
63 unsigned long addr, pte_t *ptep);
65 #define huge_ptep_modify_prot_commit huge_ptep_modify_prot_commit
66 extern void huge_ptep_modify_prot_commit(struct vm_area_struct *vma,
67 unsigned long addr, pte_t *ptep,
68 pte_t old_pte, pte_t new_pte);
70 #include <asm-generic/hugetlb.h>
72 #define __HAVE_ARCH_FLUSH_HUGETLB_TLB_RANGE
73 static inline void flush_hugetlb_tlb_range(struct vm_area_struct *vma,
74 unsigned long start,
75 unsigned long end)
77 unsigned long stride = huge_page_size(hstate_vma(vma));
79 if (stride == PMD_SIZE)
80 __flush_tlb_range(vma, start, end, stride, false, 2);
81 else if (stride == PUD_SIZE)
82 __flush_tlb_range(vma, start, end, stride, false, 1);
83 else
84 __flush_tlb_range(vma, start, end, PAGE_SIZE, false, 0);
87 #endif /* __ASM_HUGETLB_H */