hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/arch/nds32/include/asm/pgalloc.h
....@@ -1,4 +1,4 @@
1
-// SPDX-License-Identifier: GPL-2.0
1
+/* SPDX-License-Identifier: GPL-2.0 */
22 // Copyright (C) 2005-2017 Andes Technology Corporation
33
44 #ifndef _ASMNDS32_PGALLOC_H
....@@ -9,55 +9,26 @@
99 #include <asm/tlbflush.h>
1010 #include <asm/proc-fns.h>
1111
12
+#define __HAVE_ARCH_PTE_ALLOC_ONE
13
+#include <asm-generic/pgalloc.h> /* for pte_{alloc,free}_one */
14
+
1215 /*
1316 * Since we have only two-level page tables, these are trivial
1417 */
15
-#define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *)2); })
16
-#define pmd_free(mm, pmd) do { } while (0)
17
-#define pgd_populate(mm, pmd, pte) BUG()
1818 #define pmd_pgtable(pmd) pmd_page(pmd)
1919
2020 extern pgd_t *pgd_alloc(struct mm_struct *mm);
2121 extern void pgd_free(struct mm_struct *mm, pgd_t * pgd);
2222
23
-#define check_pgt_cache() do { } while (0)
24
-
25
-static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
26
- unsigned long addr)
27
-{
28
- pte_t *pte;
29
-
30
- pte =
31
- (pte_t *) __get_free_page(GFP_KERNEL | __GFP_RETRY_MAYFAIL |
32
- __GFP_ZERO);
33
-
34
- return pte;
35
-}
36
-
37
-static inline pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long addr)
23
+static inline pgtable_t pte_alloc_one(struct mm_struct *mm)
3824 {
3925 pgtable_t pte;
4026
41
- pte = alloc_pages(GFP_KERNEL | __GFP_RETRY_MAYFAIL | __GFP_ZERO, 0);
27
+ pte = __pte_alloc_one(mm, GFP_PGTABLE_USER);
4228 if (pte)
4329 cpu_dcache_wb_page((unsigned long)page_address(pte));
4430
4531 return pte;
46
-}
47
-
48
-/*
49
- * Free one PTE table.
50
- */
51
-static inline void pte_free_kernel(struct mm_struct *mm, pte_t * pte)
52
-{
53
- if (pte) {
54
- free_page((unsigned long)pte);
55
- }
56
-}
57
-
58
-static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
59
-{
60
- __free_page(pte);
6132 }
6233
6334 /*