@@ -366,7 +366,6 @@ void __init platform_init(void)
acpi_gbl_use_default_register_widths = false;
acpi_boot_table_init();
#endif
- unflatten_and_copy_device_tree();
#ifdef CONFIG_NUMA
init_numa_memory();
@@ -626,6 +625,7 @@ void __init setup_arch(char **cmdline_p)
paging_init();
+ unflatten_and_copy_device_tree();
#ifdef CONFIG_KASAN
kasan_init();
#endif
@@ -667,7 +667,6 @@ static void __init arch_mem_init(char **cmdline_p)
mips_reserve_vmcore();
mips_parse_crashkernel();
- device_tree_init();
/*
* In order to reduce the possibility of kernel panic when failed to
@@ -798,6 +797,8 @@ void __init setup_arch(char **cmdline_p)
cpu_cache_init();
paging_init();
+ device_tree_init();
+
memblock_dump_all();
setup_rng_seed();
@@ -169,8 +169,6 @@ void __init setup_arch(char **cmdline_p)
early_init_fdt_reserve_self();
early_init_fdt_scan_reserved_mem();
- unflatten_and_copy_device_tree();
-
setup_cpuinfo();
copy_exception_handler(cpuinfo.exception_addr);
@@ -189,4 +187,6 @@ void __init setup_arch(char **cmdline_p)
* get kmalloc into gear
*/
paging_init();
+
+ unflatten_and_copy_device_tree();
}
@@ -255,8 +255,6 @@ void calibrate_delay(void)
void __init setup_arch(char **cmdline_p)
{
- unflatten_and_copy_device_tree();
-
setup_cpuinfo();
#ifdef CONFIG_SMP
@@ -284,6 +282,8 @@ void __init setup_arch(char **cmdline_p)
/* paging_init() sets up the MMU and marks all pages as reserved */
paging_init();
+ unflatten_and_copy_device_tree();
+
*cmdline_p = boot_command_line;
printk(KERN_INFO "OpenRISC Linux -- http://openrisc.io\n");
@@ -986,6 +986,9 @@ void __init setup_arch(char **cmdline_p)
paging_init();
+ /* Unflatten the device-tree passed by prom_init or kexec */
+ unflatten_device_tree();
+
/* Initialize the MMU context management stuff. */
mmu_context_init();
@@ -322,6 +322,8 @@ void __init setup_arch(char **cmdline_p)
/* Let earlyprintk output early console messages */
sh_early_platform_driver_probe("earlyprintk", 1, 1);
+ paging_init();
+
#ifdef CONFIG_OF_EARLY_FLATTREE
#ifdef CONFIG_USE_BUILTIN_DTB
unflatten_and_copy_device_tree();
@@ -329,9 +331,6 @@ void __init setup_arch(char **cmdline_p)
unflatten_device_tree();
#endif
#endif
-
- paging_init();
-
/* Perform the machine specific initialisation */
if (likely(sh_mv.mv_setup))
sh_mv.mv_setup(cmdline_p);
@@ -26,7 +26,6 @@ void uml_dtb_init(void)
}
early_init_fdt_scan_reserved_mem();
- unflatten_device_tree();
}
static int __init uml_dtb_setup(char *line, int *add)
@@ -7,6 +7,7 @@
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/mm.h>
+#include <linux/of_fdt.h>
#include <linux/ctype.h>
#include <linux/module.h>
#include <linux/panic_notifier.h>
@@ -421,6 +422,7 @@ void __init setup_arch(char **cmdline_p)
read_initrd();
paging_init();
+ unflatten_device_tree();
strscpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
*cmdline_p = command_line;
setup_hostinfo(host_info, sizeof host_info);
@@ -355,13 +355,15 @@ void __init setup_arch(char **cmdline_p)
parse_early_param();
bootmem_init();
kasan_init();
- unflatten_and_copy_device_tree();
#ifdef CONFIG_SMP
smp_init_cpus();
#endif
paging_init();
+
+ unflatten_and_copy_device_tree();
+
zones_init();
#ifdef CONFIG_VT
Switch call to unflatten_device_tree() to after paging_init() on other archs to follow new order in which the reserved_mem regions are processed. Signed-off-by: Oreoluwa Babatunde <quic_obabatun@quicinc.com> --- arch/loongarch/kernel/setup.c | 2 +- arch/mips/kernel/setup.c | 3 ++- arch/nios2/kernel/setup.c | 4 ++-- arch/openrisc/kernel/setup.c | 4 ++-- arch/powerpc/kernel/setup-common.c | 3 +++ arch/sh/kernel/setup.c | 5 ++--- arch/um/kernel/dtb.c | 1 - arch/um/kernel/um_arch.c | 2 ++ arch/xtensa/kernel/setup.c | 4 +++- 9 files changed, 17 insertions(+), 11 deletions(-)