x86/of: Move the x86_flattree_get_config() call out of x86_dtb_init()
authorSaurabh Sengar <ssengar@linux.microsoft.com>
Fri, 25 Aug 2023 07:47:36 +0000 (00:47 -0700)
committerIngo Molnar <mingo@kernel.org>
Mon, 2 Oct 2023 19:30:09 +0000 (21:30 +0200)
Fetching the device tree configuration before initmem_init() is necessary
to allow the parsing of NUMA node information. However moving the entire
x86_dtb_init() call before initmem_init() is not correct as APIC/IO-APIC enumeration
has to be after initmem_init().

Thus, move the x86_flattree_get_config() call out of x86_dtb_init(),
into setup_arch(), to call it before initmem_init(), and
leave the ACPI/IOAPIC registration sequence as-is.

[ mingo: Updated the changelog for clarity. ]

Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Link: https://lore.kernel.org/r/1692949657-16446-1-git-send-email-ssengar@linux.microsoft.com
arch/x86/include/asm/prom.h
arch/x86/kernel/devicetree.c
arch/x86/kernel/setup.c

index b716d291d0d4442e688d8313a4138e4b5013a487..65dee24206240641172ad509e6e06358e6fcf41f 100644 (file)
@@ -31,6 +31,11 @@ static inline void x86_dtb_init(void) { }
 #define of_ioapic 0
 #endif
 
+#ifdef CONFIG_OF_EARLY_FLATTREE
+void x86_flattree_get_config(void);
+#else
+static inline void x86_flattree_get_config(void) { }
+#endif
 extern char cmd_line[COMMAND_LINE_SIZE];
 
 #endif /* __ASSEMBLY__ */
index 87d38f17ff5c9c832931950c87803b02abc6e1e2..afd09924094eca5e444fd1beaf20c7e02f888e85 100644 (file)
@@ -278,7 +278,7 @@ static void __init dtb_apic_setup(void)
 }
 
 #ifdef CONFIG_OF_EARLY_FLATTREE
-static void __init x86_flattree_get_config(void)
+void __init x86_flattree_get_config(void)
 {
        u32 size, map_len;
        void *dt;
@@ -300,14 +300,10 @@ static void __init x86_flattree_get_config(void)
        unflatten_and_copy_device_tree();
        early_memunmap(dt, map_len);
 }
-#else
-static inline void x86_flattree_get_config(void) { }
 #endif
 
 void __init x86_dtb_init(void)
 {
-       x86_flattree_get_config();
-
        if (!of_have_populated_dt())
                return;
 
index b9145a63da77d83586eb6fe608bfa0ff617ddd9b..ef73704fa27f98730b430e7cc58daa9635630091 100644 (file)
@@ -1221,6 +1221,8 @@ void __init setup_arch(char **cmdline_p)
 
        early_acpi_boot_init();
 
+       x86_flattree_get_config();
+
        initmem_init();
        dma_contiguous_reserve(max_pfn_mapped << PAGE_SHIFT);