public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] efi/x86: Ensure that EFI_RUNTIME_MAP is enabled for kexec
@ 2023-08-02 13:37 Ard Biesheuvel
  2023-08-02 14:25 ` Kirill A . Shutemov
  0 siblings, 1 reply; 3+ messages in thread
From: Ard Biesheuvel @ 2023-08-02 13:37 UTC (permalink / raw)
  To: linux-efi; +Cc: linux-kernel, x86, Ard Biesheuvel, Kirill A . Shutemov

CONFIG_EFI_RUNTIME_MAP needs to be enabled in order for kexec to be able
to provide the required information about the EFI runtime mappings to
the incoming kernel, regardless of whether kexec_load() or
kexec_file_load() is being used. Without this information, kexec boot in
EFI mode is not possible.

The CONFIG_EFI_RUNTIME_MAP option is currently directly configurable if
CONFIG_EXPERT is enabled, so that it can be turned on for debugging
purposes even if KEXEC is. However, the upshot of this is that it can
also be disabled even when it shouldn't.

So tweak the Kconfig declarations to avoid this situation.

Reported-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 arch/x86/Kconfig | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 7422db4097701c96..616498cdc91e8f01 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -2027,10 +2027,14 @@ config EFI_MAX_FAKE_MEM
 	  Ranges can be set up to this value using comma-separated list.
 	  The default value is 8.
 
+config EFI_NEED_RUNTIME_MAP
+	def_bool y
+	depends on EFI && KEXEC_CORE
+	select EFI_RUNTIME_MAP
+
 config EFI_RUNTIME_MAP
 	bool "Export EFI runtime maps to sysfs" if EXPERT
 	depends on EFI
-	default KEXEC_CORE
 	help
 	  Export EFI runtime memory regions to /sys/firmware/efi/runtime-map.
 	  That memory map is required by the 2nd kernel to set up EFI virtual
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] efi/x86: Ensure that EFI_RUNTIME_MAP is enabled for kexec
  2023-08-02 13:37 [PATCH] efi/x86: Ensure that EFI_RUNTIME_MAP is enabled for kexec Ard Biesheuvel
@ 2023-08-02 14:25 ` Kirill A . Shutemov
  2023-08-02 15:14   ` Ard Biesheuvel
  0 siblings, 1 reply; 3+ messages in thread
From: Kirill A . Shutemov @ 2023-08-02 14:25 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: linux-efi, linux-kernel, x86

On Wed, Aug 02, 2023 at 03:37:04PM +0200, Ard Biesheuvel wrote:
> CONFIG_EFI_RUNTIME_MAP needs to be enabled in order for kexec to be able
> to provide the required information about the EFI runtime mappings to
> the incoming kernel, regardless of whether kexec_load() or
> kexec_file_load() is being used. Without this information, kexec boot in
> EFI mode is not possible.
> 
> The CONFIG_EFI_RUNTIME_MAP option is currently directly configurable if
> CONFIG_EXPERT is enabled, so that it can be turned on for debugging
> purposes even if KEXEC is. However, the upshot of this is that it can
> also be disabled even when it shouldn't.
> 
> So tweak the Kconfig declarations to avoid this situation.
> 
> Reported-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>

With the patch 'make oldconfig' updates config to enable
EFI_NEED_RUNTIME_MAP.

Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

Thanks.
> ---
>  arch/x86/Kconfig | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 7422db4097701c96..616498cdc91e8f01 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -2027,10 +2027,14 @@ config EFI_MAX_FAKE_MEM
>  	  Ranges can be set up to this value using comma-separated list.
>  	  The default value is 8.
>  
> +config EFI_NEED_RUNTIME_MAP
> +	def_bool y
> +	depends on EFI && KEXEC_CORE
> +	select EFI_RUNTIME_MAP
> +

Just curious, why not extend 'config EFI' with 'select EFI_RUNTIME_MAP if KEXEC_CORE'?
It seems functionally equivalent, but more concise.

>  config EFI_RUNTIME_MAP
>  	bool "Export EFI runtime maps to sysfs" if EXPERT
>  	depends on EFI
> -	default KEXEC_CORE
>  	help
>  	  Export EFI runtime memory regions to /sys/firmware/efi/runtime-map.
>  	  That memory map is required by the 2nd kernel to set up EFI virtual
> -- 
> 2.39.2
> 

-- 
  Kiryl Shutsemau / Kirill A. Shutemov

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] efi/x86: Ensure that EFI_RUNTIME_MAP is enabled for kexec
  2023-08-02 14:25 ` Kirill A . Shutemov
@ 2023-08-02 15:14   ` Ard Biesheuvel
  0 siblings, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2023-08-02 15:14 UTC (permalink / raw)
  To: Kirill A . Shutemov; +Cc: linux-efi, linux-kernel, x86

On Wed, 2 Aug 2023 at 16:26, Kirill A . Shutemov
<kirill.shutemov@linux.intel.com> wrote:
>
> On Wed, Aug 02, 2023 at 03:37:04PM +0200, Ard Biesheuvel wrote:
> > CONFIG_EFI_RUNTIME_MAP needs to be enabled in order for kexec to be able
> > to provide the required information about the EFI runtime mappings to
> > the incoming kernel, regardless of whether kexec_load() or
> > kexec_file_load() is being used. Without this information, kexec boot in
> > EFI mode is not possible.
> >
> > The CONFIG_EFI_RUNTIME_MAP option is currently directly configurable if
> > CONFIG_EXPERT is enabled, so that it can be turned on for debugging
> > purposes even if KEXEC is. However, the upshot of this is that it can
> > also be disabled even when it shouldn't.
> >
> > So tweak the Kconfig declarations to avoid this situation.
> >
> > Reported-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> > Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
>
> With the patch 'make oldconfig' updates config to enable
> EFI_NEED_RUNTIME_MAP.
>
> Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
>
> Thanks.
> > ---
> >  arch/x86/Kconfig | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> > index 7422db4097701c96..616498cdc91e8f01 100644
> > --- a/arch/x86/Kconfig
> > +++ b/arch/x86/Kconfig
> > @@ -2027,10 +2027,14 @@ config EFI_MAX_FAKE_MEM
> >         Ranges can be set up to this value using comma-separated list.
> >         The default value is 8.
> >
> > +config EFI_NEED_RUNTIME_MAP
> > +     def_bool y
> > +     depends on EFI && KEXEC_CORE
> > +     select EFI_RUNTIME_MAP
> > +
>
> Just curious, why not extend 'config EFI' with 'select EFI_RUNTIME_MAP if KEXEC_CORE'?
> It seems functionally equivalent, but more concise.
>

Yeah, agreed - I didn't realize every arch has its own 'config EFI' definition.

> >  config EFI_RUNTIME_MAP
> >       bool "Export EFI runtime maps to sysfs" if EXPERT
> >       depends on EFI
> > -     default KEXEC_CORE
> >       help
> >         Export EFI runtime memory regions to /sys/firmware/efi/runtime-map.
> >         That memory map is required by the 2nd kernel to set up EFI virtual
> > --
> > 2.39.2
> >
>
> --
>   Kiryl Shutsemau / Kirill A. Shutemov

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-08-02 15:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-02 13:37 [PATCH] efi/x86: Ensure that EFI_RUNTIME_MAP is enabled for kexec Ard Biesheuvel
2023-08-02 14:25 ` Kirill A . Shutemov
2023-08-02 15:14   ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox