.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
---|
1 | 2 | /* |
---|
2 | 3 | * arch/arm64/include/asm/hugetlb.h |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2013 Linaro Ltd. |
---|
5 | 6 | * |
---|
6 | 7 | * Based on arch/x86/include/asm/hugetlb.h |
---|
7 | | - * |
---|
8 | | - * This program is free software; you can redistribute it and/or modify |
---|
9 | | - * it under the terms of the GNU General Public License version 2 as |
---|
10 | | - * published by the Free Software Foundation. |
---|
11 | | - * |
---|
12 | | - * This program is distributed in the hope that it will be useful, |
---|
13 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
15 | | - * GNU General Public License for more details. |
---|
16 | 8 | */ |
---|
17 | 9 | |
---|
18 | 10 | #ifndef __ASM_HUGETLB_H |
---|
.. | .. |
---|
20 | 12 | |
---|
21 | 13 | #include <asm/page.h> |
---|
22 | 14 | |
---|
23 | | -static inline pte_t huge_ptep_get(pte_t *ptep) |
---|
24 | | -{ |
---|
25 | | - return READ_ONCE(*ptep); |
---|
26 | | -} |
---|
27 | | - |
---|
28 | | - |
---|
29 | | - |
---|
30 | | -static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb, |
---|
31 | | - unsigned long addr, unsigned long end, |
---|
32 | | - unsigned long floor, |
---|
33 | | - unsigned long ceiling) |
---|
34 | | -{ |
---|
35 | | - free_pgd_range(tlb, addr, end, floor, ceiling); |
---|
36 | | -} |
---|
37 | | - |
---|
38 | | -static inline int is_hugepage_only_range(struct mm_struct *mm, |
---|
39 | | - unsigned long addr, unsigned long len) |
---|
40 | | -{ |
---|
41 | | - return 0; |
---|
42 | | -} |
---|
43 | | - |
---|
44 | | -static inline int prepare_hugepage_range(struct file *file, |
---|
45 | | - unsigned long addr, unsigned long len) |
---|
46 | | -{ |
---|
47 | | - struct hstate *h = hstate_file(file); |
---|
48 | | - if (len & ~huge_page_mask(h)) |
---|
49 | | - return -EINVAL; |
---|
50 | | - if (addr & ~huge_page_mask(h)) |
---|
51 | | - return -EINVAL; |
---|
52 | | - return 0; |
---|
53 | | -} |
---|
54 | | - |
---|
55 | | -static inline int huge_pte_none(pte_t pte) |
---|
56 | | -{ |
---|
57 | | - return pte_none(pte); |
---|
58 | | -} |
---|
59 | | - |
---|
60 | | -static inline pte_t huge_pte_wrprotect(pte_t pte) |
---|
61 | | -{ |
---|
62 | | - return pte_wrprotect(pte); |
---|
63 | | -} |
---|
| 15 | +#ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION |
---|
| 16 | +#define arch_hugetlb_migration_supported arch_hugetlb_migration_supported |
---|
| 17 | +extern bool arch_hugetlb_migration_supported(struct hstate *h); |
---|
| 18 | +#endif |
---|
64 | 19 | |
---|
65 | 20 | static inline void arch_clear_hugepage_flags(struct page *page) |
---|
66 | 21 | { |
---|
67 | 22 | clear_bit(PG_dcache_clean, &page->flags); |
---|
68 | 23 | } |
---|
| 24 | +#define arch_clear_hugepage_flags arch_clear_hugepage_flags |
---|
69 | 25 | |
---|
70 | 26 | extern pte_t arch_make_huge_pte(pte_t entry, struct vm_area_struct *vma, |
---|
71 | 27 | struct page *page, int writable); |
---|
72 | 28 | #define arch_make_huge_pte arch_make_huge_pte |
---|
| 29 | +#define __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT |
---|
73 | 30 | extern void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, |
---|
74 | 31 | pte_t *ptep, pte_t pte); |
---|
| 32 | +#define __HAVE_ARCH_HUGE_PTEP_SET_ACCESS_FLAGS |
---|
75 | 33 | extern int huge_ptep_set_access_flags(struct vm_area_struct *vma, |
---|
76 | 34 | unsigned long addr, pte_t *ptep, |
---|
77 | 35 | pte_t pte, int dirty); |
---|
| 36 | +#define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR |
---|
78 | 37 | extern pte_t huge_ptep_get_and_clear(struct mm_struct *mm, |
---|
79 | 38 | unsigned long addr, pte_t *ptep); |
---|
| 39 | +#define __HAVE_ARCH_HUGE_PTEP_SET_WRPROTECT |
---|
80 | 40 | extern void huge_ptep_set_wrprotect(struct mm_struct *mm, |
---|
81 | 41 | unsigned long addr, pte_t *ptep); |
---|
| 42 | +#define __HAVE_ARCH_HUGE_PTEP_CLEAR_FLUSH |
---|
82 | 43 | extern void huge_ptep_clear_flush(struct vm_area_struct *vma, |
---|
83 | 44 | unsigned long addr, pte_t *ptep); |
---|
| 45 | +#define __HAVE_ARCH_HUGE_PTE_CLEAR |
---|
84 | 46 | extern void huge_pte_clear(struct mm_struct *mm, unsigned long addr, |
---|
85 | 47 | pte_t *ptep, unsigned long sz); |
---|
86 | | -#define huge_pte_clear huge_pte_clear |
---|
87 | 48 | extern void set_huge_swap_pte_at(struct mm_struct *mm, unsigned long addr, |
---|
88 | 49 | pte_t *ptep, pte_t pte, unsigned long sz); |
---|
89 | 50 | #define set_huge_swap_pte_at set_huge_swap_pte_at |
---|
90 | 51 | |
---|
91 | | -#include <asm-generic/hugetlb.h> |
---|
| 52 | +void __init arm64_hugetlb_cma_reserve(void); |
---|
92 | 53 | |
---|
93 | | -#ifdef CONFIG_ARCH_HAS_GIGANTIC_PAGE |
---|
94 | | -static inline bool gigantic_page_supported(void) { return true; } |
---|
95 | | -#endif |
---|
| 54 | +#include <asm-generic/hugetlb.h> |
---|
96 | 55 | |
---|
97 | 56 | #endif /* __ASM_HUGETLB_H */ |
---|