Skip to content

Commit 38e4b66

Browse files
Anshuman Khandualwilldeacon
authored andcommitted
arm64/mm: Drop ARM64_KERNEL_USES_PMD_MAPS
Currently ARM64_KERNEL_USES_PMD_MAPS is an unnecessary abstraction. Kernel mapping at PMD (aka huge page aka block) level, is only applicable with 4K base page, which makes it 2MB aligned, a necessary requirement for linear mapping and physical memory start address. This can be easily achieved by directly checking against base page size itself. This drops off the macro ARM64_KERNE_USES_PMD_MAPS which is redundant. Cc: Catalin Marinas <[email protected]> Cc: Will Deacon <[email protected]> Cc: [email protected] Signed-off-by: Anshuman Khandual <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent e8e5104 commit 38e4b66

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

arch/arm64/include/asm/kernel-pgtable.h

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@
1818
* with 4K (section size = 2M) but not with 16K (section size = 32M) or
1919
* 64K (section size = 512M).
2020
*/
21-
#ifdef CONFIG_ARM64_4K_PAGES
22-
#define ARM64_KERNEL_USES_PMD_MAPS 1
23-
#else
24-
#define ARM64_KERNEL_USES_PMD_MAPS 0
25-
#endif
2621

2722
/*
2823
* The idmap and swapper page tables need some space reserved in the kernel
@@ -34,7 +29,7 @@
3429
* VA range, so pages required to map highest possible PA are reserved in all
3530
* cases.
3631
*/
37-
#if ARM64_KERNEL_USES_PMD_MAPS
32+
#ifdef CONFIG_ARM64_4K_PAGES
3833
#define SWAPPER_PGTABLE_LEVELS (CONFIG_PGTABLE_LEVELS - 1)
3934
#else
4035
#define SWAPPER_PGTABLE_LEVELS (CONFIG_PGTABLE_LEVELS)
@@ -96,7 +91,7 @@
9691
#define INIT_IDMAP_DIR_PAGES EARLY_PAGES(KIMAGE_VADDR, _end + MAX_FDT_SIZE + SWAPPER_BLOCK_SIZE, 1)
9792

9893
/* Initial memory map size */
99-
#if ARM64_KERNEL_USES_PMD_MAPS
94+
#ifdef CONFIG_ARM64_4K_PAGES
10095
#define SWAPPER_BLOCK_SHIFT PMD_SHIFT
10196
#define SWAPPER_BLOCK_SIZE PMD_SIZE
10297
#define SWAPPER_TABLE_SHIFT PUD_SHIFT
@@ -112,7 +107,7 @@
112107
#define SWAPPER_PTE_FLAGS (PTE_TYPE_PAGE | PTE_AF | PTE_SHARED)
113108
#define SWAPPER_PMD_FLAGS (PMD_TYPE_SECT | PMD_SECT_AF | PMD_SECT_S)
114109

115-
#if ARM64_KERNEL_USES_PMD_MAPS
110+
#ifdef CONFIG_ARM64_4K_PAGES
116111
#define SWAPPER_RW_MMUFLAGS (PMD_ATTRINDX(MT_NORMAL) | SWAPPER_PMD_FLAGS)
117112
#define SWAPPER_RX_MMUFLAGS (SWAPPER_RW_MMUFLAGS | PMD_SECT_RDONLY)
118113
#else

arch/arm64/mm/mmu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1196,7 +1196,7 @@ int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node,
11961196

11971197
WARN_ON((start < VMEMMAP_START) || (end > VMEMMAP_END));
11981198

1199-
if (!ARM64_KERNEL_USES_PMD_MAPS)
1199+
if (!IS_ENABLED(CONFIG_ARM64_4K_PAGES))
12001200
return vmemmap_populate_basepages(start, end, node, altmap);
12011201

12021202
do {

0 commit comments

Comments
 (0)