]> Git Repo - J-linux.git/commitdiff
openrisc: Call setup_memory() earlier in the init sequence
authorOreoluwa Babatunde <[email protected]>
Sat, 10 Feb 2024 00:29:30 +0000 (16:29 -0800)
committerStafford Horne <[email protected]>
Sun, 10 Mar 2024 08:55:46 +0000 (08:55 +0000)
The unflatten_and_copy_device_tree() function contains a call to
memblock_alloc(). This means that memblock is allocating memory before
any of the reserved memory regions are set aside in the setup_memory()
function which calls early_init_fdt_scan_reserved_mem(). Therefore,
there is a possibility for memblock to allocate from any of the
reserved memory regions.

Hence, move the call to setup_memory() to be earlier in the init
sequence so that the reserved memory regions are set aside before any
allocations are done using memblock.

Signed-off-by: Oreoluwa Babatunde <[email protected]>
Signed-off-by: Stafford Horne <[email protected]>
arch/openrisc/kernel/setup.c

index 9cf7fb60441f89094607aafe887c60e9dce75877..be56eaafc8b9575e29eb1f66f5daa4534238cf4f 100644 (file)
@@ -255,6 +255,9 @@ void calibrate_delay(void)
 
 void __init setup_arch(char **cmdline_p)
 {
+       /* setup memblock allocator */
+       setup_memory();
+
        unflatten_and_copy_device_tree();
 
        setup_cpuinfo();
@@ -278,9 +281,6 @@ void __init setup_arch(char **cmdline_p)
        }
 #endif
 
-       /* setup memblock allocator */
-       setup_memory();
-
        /* paging_init() sets up the MMU and marks all pages as reserved */
        paging_init();
 
This page took 0.050571 seconds and 4 git commands to generate.