@@ -102,10 +102,9 @@ static void __init print_vm_layout(void)
102102 (unsigned long )VMALLOC_END );
103103 print_mlm ("lowmem" , (unsigned long )PAGE_OFFSET ,
104104 (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 );
109108}
110109#else
111110static void print_vm_layout (void ) { }
@@ -163,7 +162,7 @@ static void __init setup_bootmem(void)
163162{
164163 phys_addr_t vmlinux_end = __pa_symbol (& _end );
165164 phys_addr_t vmlinux_start = __pa_symbol (& _start );
166- phys_addr_t __maybe_unused max_mapped_addr ;
165+ phys_addr_t max_mapped_addr ;
167166 phys_addr_t phys_ram_end ;
168167
169168#ifdef CONFIG_XIP_KERNEL
@@ -172,25 +171,23 @@ static void __init setup_bootmem(void)
172171
173172 memblock_enforce_memory_limit (memory_limit );
174173
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 )
179174 /*
180175 * Make sure we align the reservation on PMD_SIZE since we will
181176 * map the kernel in the linear mapping as read-only: we do not want
182177 * any allocation to happen between _end and the next pmd aligned page.
183178 */
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+ */
186184 memblock_reserve (vmlinux_start , vmlinux_end - vmlinux_start );
187185
188186
189187 phys_ram_end = memblock_end_of_DRAM ();
190188#ifndef CONFIG_XIP_KERNEL
191189 phys_ram_base = memblock_start_of_DRAM ();
192190#endif
193- #ifndef CONFIG_64BIT
194191 /*
195192 * memblock allocator is not aware of the fact that last 4K bytes of
196193 * the addressable memory can not be mapped because of IS_ERR_VALUE
@@ -200,10 +197,11 @@ static void __init setup_bootmem(void)
200197 * address space is occupied by the kernel mapping then this check must
201198 * be done as soon as the kernel mapping base address is determined.
202199 */
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+ }
207205
208206 min_low_pfn = PFN_UP (phys_ram_base );
209207 max_low_pfn = max_pfn = PFN_DOWN (phys_ram_end );
@@ -617,14 +615,6 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa)
617615 BUG_ON ((PAGE_OFFSET % PGDIR_SIZE ) != 0 );
618616 BUG_ON ((kernel_map .phys_addr % PMD_SIZE ) != 0 );
619617
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-
628618 pt_ops .alloc_pte = alloc_pte_early ;
629619 pt_ops .get_pte_virt = get_pte_virt_early ;
630620#ifndef __PAGETABLE_PMD_FOLDED
@@ -736,10 +726,9 @@ static void __init setup_vm_final(void)
736726 }
737727 }
738728
739- #ifdef CONFIG_64BIT
740729 /* 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);
743732
744733 /* Clear fixmap PTE and PMD mappings */
745734 clear_fixmap (FIX_PTE );
0 commit comments