]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
x86/efi: Move runtime service initialization to arch/x86
authorAlexander Shishkin <alexander.shishkin@linux.intel.com>
Fri, 20 Jun 2025 13:53:12 +0000 (16:53 +0300)
committerDave Hansen <dave.hansen@linux.intel.com>
Fri, 20 Jun 2025 17:48:50 +0000 (10:48 -0700)
The EFI call in start_kernel() is guarded by #ifdef CONFIG_X86. Move
the thing to the arch_cpu_finalize_init() path on x86 and get rid of
the #ifdef in start_kernel().

No functional change intended.

Suggested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: Sohil Mehta <sohil.mehta@intel.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/all/20250620135325.3300848-5-kirill.shutemov%40linux.intel.com
arch/x86/kernel/cpu/common.c
init/main.c

index 8feb8fd2957adb13b4f8ce77425809a13c9681fe..4f430be285dedacdf47502b2810de3e333f9edf8 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/pgtable.h>
 #include <linux/stackprotector.h>
 #include <linux/utsname.h>
+#include <linux/efi.h>
 
 #include <asm/alternative.h>
 #include <asm/cmdline.h>
@@ -2529,6 +2530,12 @@ void __init arch_cpu_finalize_init(void)
        fpu__init_system();
        fpu__init_cpu();
 
+       /*
+        * This needs to follow the FPU initializtion, since EFI depends on it.
+        */
+       if (efi_enabled(EFI_RUNTIME_SERVICES))
+               efi_enter_virtual_mode();
+
        /*
         * Ensure that access to the per CPU representation has the initial
         * boot CPU configuration.
index 225a58279acd7ca15203af1e407b310bc2f315e7..f9f401b6fdfbcd02de8159d80a9acb22353bc881 100644 (file)
@@ -53,7 +53,6 @@
 #include <linux/cpuset.h>
 #include <linux/memcontrol.h>
 #include <linux/cgroup.h>
-#include <linux/efi.h>
 #include <linux/tick.h>
 #include <linux/sched/isolation.h>
 #include <linux/interrupt.h>
@@ -1068,10 +1067,6 @@ void start_kernel(void)
 
        pid_idr_init();
        anon_vma_init();
-#ifdef CONFIG_X86
-       if (efi_enabled(EFI_RUNTIME_SERVICES))
-               efi_enter_virtual_mode();
-#endif
        thread_stack_cache_init();
        cred_init();
        fork_init();