Message ID | 20241028160917.1380714-5-alexander.shishkin@linux.intel.com |
---|---|
State | New |
Headers | show |
Series | Enable Linear Address Space Separation support | expand |
On Mon, 28 Oct 2024 at 17:10, Alexander Shishkin <alexander.shishkin@linux.intel.com> wrote: > > 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. > > Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> > Suggested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> > --- > arch/x86/kernel/cpu/common.c | 7 +++++++ > init/main.c | 5 ----- > 2 files changed, 7 insertions(+), 5 deletions(-) > Acked-by: Ard Biesheuvel <ardb@kernel.org> > diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c > index 8f41ab219cf1..b24ad418536e 100644 > --- a/arch/x86/kernel/cpu/common.c > +++ b/arch/x86/kernel/cpu/common.c > @@ -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> > @@ -2382,6 +2383,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. > diff --git a/init/main.c b/init/main.c > index c4778edae797..1d3a0a82d136 100644 > --- a/init/main.c > +++ b/init/main.c > @@ -51,7 +51,6 @@ > #include <linux/cpu.h> > #include <linux/cpuset.h> > #include <linux/cgroup.h> > -#include <linux/efi.h> > #include <linux/tick.h> > #include <linux/sched/isolation.h> > #include <linux/interrupt.h> > @@ -1072,10 +1071,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(); > -- > 2.45.2 >
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 8f41ab219cf1..b24ad418536e 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -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> @@ -2382,6 +2383,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. diff --git a/init/main.c b/init/main.c index c4778edae797..1d3a0a82d136 100644 --- a/init/main.c +++ b/init/main.c @@ -51,7 +51,6 @@ #include <linux/cpu.h> #include <linux/cpuset.h> #include <linux/cgroup.h> -#include <linux/efi.h> #include <linux/tick.h> #include <linux/sched/isolation.h> #include <linux/interrupt.h> @@ -1072,10 +1071,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();
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. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Suggested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> --- arch/x86/kernel/cpu/common.c | 7 +++++++ init/main.c | 5 ----- 2 files changed, 7 insertions(+), 5 deletions(-)