hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/arch/nds32/include/asm/pgtable.h
....@@ -1,44 +1,36 @@
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_PGTABLE_H
55 #define _ASMNDS32_PGTABLE_H
66
7
-#define __PAGETABLE_PMD_FOLDED 1
8
-#include <asm-generic/4level-fixup.h>
9
-#include <asm-generic/sizes.h>
7
+#include <asm-generic/pgtable-nopmd.h>
8
+#include <linux/sizes.h>
109
1110 #include <asm/memory.h>
1211 #include <asm/nds32.h>
1312 #ifndef __ASSEMBLY__
1413 #include <asm/fixmap.h>
15
-#include <asm/io.h>
1614 #include <nds32_intrinsic.h>
1715 #endif
1816
1917 #ifdef CONFIG_ANDES_PAGE_SIZE_4KB
2018 #define PGDIR_SHIFT 22
2119 #define PTRS_PER_PGD 1024
22
-#define PMD_SHIFT 22
23
-#define PTRS_PER_PMD 1
2420 #define PTRS_PER_PTE 1024
2521 #endif
2622
2723 #ifdef CONFIG_ANDES_PAGE_SIZE_8KB
2824 #define PGDIR_SHIFT 24
2925 #define PTRS_PER_PGD 256
30
-#define PMD_SHIFT 24
31
-#define PTRS_PER_PMD 1
3226 #define PTRS_PER_PTE 2048
3327 #endif
3428
3529 #ifndef __ASSEMBLY__
3630 extern void __pte_error(const char *file, int line, unsigned long val);
37
-extern void __pmd_error(const char *file, int line, unsigned long val);
3831 extern void __pgd_error(const char *file, int line, unsigned long val);
3932
4033 #define pte_ERROR(pte) __pte_error(__FILE__, __LINE__, pte_val(pte))
41
-#define pmd_ERROR(pmd) __pmd_error(__FILE__, __LINE__, pmd_val(pmd))
4234 #define pgd_ERROR(pgd) __pgd_error(__FILE__, __LINE__, pgd_val(pgd))
4335 #endif /* !__ASSEMBLY__ */
4436
....@@ -130,6 +122,9 @@
130122 #define _PAGE_CACHE _PAGE_C_MEM_WB
131123 #endif
132124
125
+#define _PAGE_IOREMAP \
126
+ (_PAGE_V | _PAGE_M_KRW | _PAGE_D | _PAGE_G | _PAGE_C_DEV)
127
+
133128 /*
134129 * + Level 1 descriptor (PMD)
135130 */
....@@ -191,16 +186,10 @@
191186 #define pte_clear(mm,addr,ptep) set_pte_at((mm),(addr),(ptep), __pte(0))
192187 #define pte_page(pte) (pfn_to_page(pte_pfn(pte)))
193188
194
-#define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
195
-#define pte_offset_kernel(dir, address) ((pte_t *)pmd_page_kernel(*(dir)) + pte_index(address))
196
-#define pte_offset_map(dir, address) ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address))
197
-#define pte_offset_map_nested(dir, address) pte_offset_map(dir, address)
198
-#define pmd_page_kernel(pmd) ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
199
-
200
-#define pte_unmap(pte) do { } while (0)
201
-#define pte_unmap_nested(pte) do { } while (0)
202
-
203
-#define pmd_off_k(address) pmd_offset(pgd_offset_k(address), address)
189
+static unsigned long pmd_page_vaddr(pmd_t pmd)
190
+{
191
+ return ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK));
192
+}
204193
205194 #define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
206195 /*
....@@ -291,15 +280,6 @@
291280 PTE_BIT_FUNC(mkdirty, |=_PAGE_D);
292281 PTE_BIT_FUNC(mkold, &=~_PAGE_YOUNG);
293282 PTE_BIT_FUNC(mkyoung, |=_PAGE_YOUNG);
294
-static inline int pte_special(pte_t pte)
295
-{
296
- return 0;
297
-}
298
-
299
-static inline pte_t pte_mkspecial(pte_t pte)
300
-{
301
- return pte;
302
-}
303283
304284 /*
305285 * Mark the prot value as uncacheable and unbufferable.
....@@ -360,15 +340,6 @@
360340 *
361341 */
362342
363
-/* to find an entry in a page-table-directory */
364
-#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1))
365
-#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address))
366
-/* to find an entry in a kernel page-table-directory */
367
-#define pgd_offset_k(addr) pgd_offset(&init_mm, addr)
368
-
369
-/* Find an entry in the second-level page table.. */
370
-#define pmd_offset(dir, addr) ((pmd_t *)(dir))
371
-
372343 static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
373344 {
374345 const unsigned long mask = 0xfff;
....@@ -391,8 +362,6 @@
391362 /* Needs to be defined here and not in linux/mm.h, as it is arch dependent */
392363 #define kern_addr_valid(addr) (1)
393364
394
-#include <asm-generic/pgtable.h>
395
-
396365 /*
397366 * We provide our own arch_get_unmapped_area to cope with VIPT caches.
398367 */
....@@ -402,8 +371,6 @@
402371 * remap a physical address `phys' of size `size' with page protection `prot'
403372 * into virtual address `from'
404373 */
405
-
406
-#define pgtable_cache_init() do { } while (0)
407374
408375 #endif /* !__ASSEMBLY__ */
409376