@@ -102,10 +102,9 @@ static void __init print_vm_layout(void)
102
102
(unsigned long )VMALLOC_END );
103
103
print_mlm ("lowmem" , (unsigned long )PAGE_OFFSET ,
104
104
(unsigned long )high_memory );
105
- #ifdef CONFIG_64BIT
106
- print_mlm ("kernel" , (unsigned long )KERNEL_LINK_ADDR ,
107
- (unsigned long )ADDRESS_SPACE_END );
108
- #endif
105
+ if (IS_ENABLED (CONFIG_64BIT ))
106
+ print_mlm ("kernel" , (unsigned long )KERNEL_LINK_ADDR ,
107
+ (unsigned long )ADDRESS_SPACE_END );
109
108
}
110
109
#else
111
110
static void print_vm_layout (void ) { }
@@ -163,7 +162,7 @@ static void __init setup_bootmem(void)
163
162
{
164
163
phys_addr_t vmlinux_end = __pa_symbol (& _end );
165
164
phys_addr_t vmlinux_start = __pa_symbol (& _start );
166
- phys_addr_t __maybe_unused max_mapped_addr ;
165
+ phys_addr_t max_mapped_addr ;
167
166
phys_addr_t phys_ram_end ;
168
167
169
168
#ifdef CONFIG_XIP_KERNEL
@@ -172,25 +171,23 @@ static void __init setup_bootmem(void)
172
171
173
172
memblock_enforce_memory_limit (memory_limit );
174
173
175
- /*
176
- * Reserve from the start of the kernel to the end of the kernel
177
- */
178
- #if defined(CONFIG_64BIT ) && defined(CONFIG_STRICT_KERNEL_RWX )
179
174
/*
180
175
* Make sure we align the reservation on PMD_SIZE since we will
181
176
* map the kernel in the linear mapping as read-only: we do not want
182
177
* any allocation to happen between _end and the next pmd aligned page.
183
178
*/
184
- vmlinux_end = (vmlinux_end + PMD_SIZE - 1 ) & PMD_MASK ;
185
- #endif
179
+ if (IS_ENABLED (CONFIG_64BIT ) && IS_ENABLED (CONFIG_STRICT_KERNEL_RWX ))
180
+ vmlinux_end = (vmlinux_end + PMD_SIZE - 1 ) & PMD_MASK ;
181
+ /*
182
+ * Reserve from the start of the kernel to the end of the kernel
183
+ */
186
184
memblock_reserve (vmlinux_start , vmlinux_end - vmlinux_start );
187
185
188
186
189
187
phys_ram_end = memblock_end_of_DRAM ();
190
188
#ifndef CONFIG_XIP_KERNEL
191
189
phys_ram_base = memblock_start_of_DRAM ();
192
190
#endif
193
- #ifndef CONFIG_64BIT
194
191
/*
195
192
* memblock allocator is not aware of the fact that last 4K bytes of
196
193
* the addressable memory can not be mapped because of IS_ERR_VALUE
@@ -200,10 +197,11 @@ static void __init setup_bootmem(void)
200
197
* address space is occupied by the kernel mapping then this check must
201
198
* be done as soon as the kernel mapping base address is determined.
202
199
*/
203
- max_mapped_addr = __pa (~(ulong )0 );
204
- if (max_mapped_addr == (phys_ram_end - 1 ))
205
- memblock_set_current_limit (max_mapped_addr - 4096 );
206
- #endif
200
+ if (!IS_ENABLED (CONFIG_64BIT )) {
201
+ max_mapped_addr = __pa (~(ulong )0 );
202
+ if (max_mapped_addr == (phys_ram_end - 1 ))
203
+ memblock_set_current_limit (max_mapped_addr - 4096 );
204
+ }
207
205
208
206
min_low_pfn = PFN_UP (phys_ram_base );
209
207
max_low_pfn = max_pfn = PFN_DOWN (phys_ram_end );
@@ -617,14 +615,6 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa)
617
615
BUG_ON ((PAGE_OFFSET % PGDIR_SIZE ) != 0 );
618
616
BUG_ON ((kernel_map .phys_addr % PMD_SIZE ) != 0 );
619
617
620
- #ifdef CONFIG_64BIT
621
- /*
622
- * The last 4K bytes of the addressable memory can not be mapped because
623
- * of IS_ERR_VALUE macro.
624
- */
625
- BUG_ON ((kernel_map .virt_addr + kernel_map .size ) > ADDRESS_SPACE_END - SZ_4K );
626
- #endif
627
-
628
618
pt_ops .alloc_pte = alloc_pte_early ;
629
619
pt_ops .get_pte_virt = get_pte_virt_early ;
630
620
#ifndef __PAGETABLE_PMD_FOLDED
@@ -736,10 +726,9 @@ static void __init setup_vm_final(void)
736
726
}
737
727
}
738
728
739
- #ifdef CONFIG_64BIT
740
729
/* Map the kernel */
741
- create_kernel_page_table ( swapper_pg_dir , false);
742
- #endif
730
+ if ( IS_ENABLED ( CONFIG_64BIT ))
731
+ create_kernel_page_table ( swapper_pg_dir , false);
743
732
744
733
/* Clear fixmap PTE and PMD mappings */
745
734
clear_fixmap (FIX_PTE );
0 commit comments