Merge tag 'for-5.13-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave...
[linux-2.6-microblaze.git] / arch / riscv / mm / init.c
index 788eb22..4faf8bd 100644 (file)
@@ -116,7 +116,6 @@ void __init mem_init(void)
        high_memory = (void *)(__va(PFN_PHYS(max_low_pfn)));
        memblock_free_all();
 
-       mem_init_print_info(NULL);
        print_vm_layout();
 }
 
@@ -136,11 +135,16 @@ void __init setup_bootmem(void)
 
        /*
         * Reserve from the start of the kernel to the end of the kernel
-        * and make sure we align the reservation on PMD_SIZE since we will
+        */
+#if defined(CONFIG_64BIT) && defined(CONFIG_STRICT_KERNEL_RWX)
+       /*
+        * Make sure we align the reservation on PMD_SIZE since we will
         * map the kernel in the linear mapping as read-only: we do not want
         * any allocation to happen between _end and the next pmd aligned page.
         */
-       memblock_reserve(vmlinux_start, (vmlinux_end - vmlinux_start + PMD_SIZE - 1) & PMD_MASK);
+       vmlinux_end = (vmlinux_end + PMD_SIZE - 1) & PMD_MASK;
+#endif
+       memblock_reserve(vmlinux_start, vmlinux_end - vmlinux_start);
 
        /*
         * memblock allocator is not aware of the fact that last 4K bytes of
@@ -641,7 +645,7 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa)
 #endif
 }
 
-#if defined(CONFIG_64BIT) && !defined(CONFIG_XIP_KERNEL)
+#if defined(CONFIG_64BIT) && defined(CONFIG_STRICT_KERNEL_RWX)
 void protect_kernel_linear_mapping_text_rodata(void)
 {
        unsigned long text_start = (unsigned long)lm_alias(_start);