2020-06-15 20:26:30

by Peter Jones

[permalink] [raw]
Subject: [PATCH] Make it possible to disable efivar_ssdt entirely

In most cases, such as CONFIG_ACPI_CUSTOM_DSDT and
CONFIG_ACPI_TABLE_UPGRADE, boot-time modifications to firmware tables
are tied to specific Kconfig options. Currently this is not the case
for modifying the ACPI SSDT via the efivar_ssdt kernel command line
option and associated EFI variable.

This patch adds CONFIG_EFI_CUSTOM_SSDT_OVERLAYS, which defaults
disabled, in order to allow enabling or disabling that feature during
the build.

Signed-off-by: Peter Jones <[email protected]>
---
drivers/firmware/efi/efi.c | 2 +-
drivers/firmware/efi/Kconfig | 11 +++++++++++
2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index 48d0188936c..4b12a598ccf 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -192,7 +192,7 @@ static void generic_ops_unregister(void)
efivars_unregister(&generic_efivars);
}

-#if IS_ENABLED(CONFIG_ACPI)
+#if IS_ENABLED(CONFIG_EFI_CUSTOM_SSDT_OVERLAYS)
#define EFIVAR_SSDT_NAME_MAX 16
static char efivar_ssdt[EFIVAR_SSDT_NAME_MAX] __initdata;
static int __init efivar_ssdt_setup(char *str)
diff --git a/drivers/firmware/efi/Kconfig b/drivers/firmware/efi/Kconfig
index 6b38f9e5d20..fe433f76b03 100644
--- a/drivers/firmware/efi/Kconfig
+++ b/drivers/firmware/efi/Kconfig
@@ -278,3 +278,14 @@ config EFI_EARLYCON
depends on SERIAL_EARLYCON && !ARM && !IA64
select FONT_SUPPORT
select ARCH_USE_MEMREMAP_PROT
+
+config EFI_CUSTOM_SSDT_OVERLAYS
+ bool "Load custom ACPI SSDT overlay from an EFI variable"
+ depends on EFI_VARS
+ default ACPI_TABLE_UPGRADE
+ help
+ Allow loading of an ACPI SSDT overlay from an EFI variable specified
+ by a kernel command line option.
+
+ See Documentation/admin-guide/acpi/ssdt-overlays.rst for more
+ information.
--
2.26.2


2020-06-15 22:50:20

by Ard Biesheuvel

[permalink] [raw]
Subject: Re: [PATCH] Make it possible to disable efivar_ssdt entirely

On Mon, 15 Jun 2020 at 22:24, Peter Jones <[email protected]> wrote:
>
> In most cases, such as CONFIG_ACPI_CUSTOM_DSDT and
> CONFIG_ACPI_TABLE_UPGRADE, boot-time modifications to firmware tables
> are tied to specific Kconfig options. Currently this is not the case
> for modifying the ACPI SSDT via the efivar_ssdt kernel command line
> option and associated EFI variable.
>
> This patch adds CONFIG_EFI_CUSTOM_SSDT_OVERLAYS, which defaults
> disabled, in order to allow enabling or disabling that feature during
> the build.
>
> Signed-off-by: Peter Jones <[email protected]>

Thanks Peter.

> ---
> drivers/firmware/efi/efi.c | 2 +-
> drivers/firmware/efi/Kconfig | 11 +++++++++++
> 2 files changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
> index 48d0188936c..4b12a598ccf 100644
> --- a/drivers/firmware/efi/efi.c
> +++ b/drivers/firmware/efi/efi.c
> @@ -192,7 +192,7 @@ static void generic_ops_unregister(void)
> efivars_unregister(&generic_efivars);
> }
>
> -#if IS_ENABLED(CONFIG_ACPI)
> +#if IS_ENABLED(CONFIG_EFI_CUSTOM_SSDT_OVERLAYS)
> #define EFIVAR_SSDT_NAME_MAX 16
> static char efivar_ssdt[EFIVAR_SSDT_NAME_MAX] __initdata;
> static int __init efivar_ssdt_setup(char *str)
> diff --git a/drivers/firmware/efi/Kconfig b/drivers/firmware/efi/Kconfig
> index 6b38f9e5d20..fe433f76b03 100644
> --- a/drivers/firmware/efi/Kconfig
> +++ b/drivers/firmware/efi/Kconfig
> @@ -278,3 +278,14 @@ config EFI_EARLYCON
> depends on SERIAL_EARLYCON && !ARM && !IA64
> select FONT_SUPPORT
> select ARCH_USE_MEMREMAP_PROT
> +
> +config EFI_CUSTOM_SSDT_OVERLAYS
> + bool "Load custom ACPI SSDT overlay from an EFI variable"
> + depends on EFI_VARS

Shouldn't this depend on ACPI too?

> + default ACPI_TABLE_UPGRADE
> + help
> + Allow loading of an ACPI SSDT overlay from an EFI variable specified
> + by a kernel command line option.
> +
> + See Documentation/admin-guide/acpi/ssdt-overlays.rst for more
> + information.
> --
> 2.26.2
>

2020-06-17 09:04:47

by Ard Biesheuvel

[permalink] [raw]
Subject: Re: [PATCH] Make it possible to disable efivar_ssdt entirely

On Tue, 16 Jun 2020 at 00:47, Ard Biesheuvel <[email protected]> wrote:
>
> On Mon, 15 Jun 2020 at 22:24, Peter Jones <[email protected]> wrote:
> >
> > In most cases, such as CONFIG_ACPI_CUSTOM_DSDT and
> > CONFIG_ACPI_TABLE_UPGRADE, boot-time modifications to firmware tables
> > are tied to specific Kconfig options. Currently this is not the case
> > for modifying the ACPI SSDT via the efivar_ssdt kernel command line
> > option and associated EFI variable.
> >
> > This patch adds CONFIG_EFI_CUSTOM_SSDT_OVERLAYS, which defaults
> > disabled, in order to allow enabling or disabling that feature during
> > the build.
> >
> > Signed-off-by: Peter Jones <[email protected]>
>
> Thanks Peter.
>
> > ---
> > drivers/firmware/efi/efi.c | 2 +-
> > drivers/firmware/efi/Kconfig | 11 +++++++++++
> > 2 files changed, 12 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
> > index 48d0188936c..4b12a598ccf 100644
> > --- a/drivers/firmware/efi/efi.c
> > +++ b/drivers/firmware/efi/efi.c
> > @@ -192,7 +192,7 @@ static void generic_ops_unregister(void)
> > efivars_unregister(&generic_efivars);
> > }
> >
> > -#if IS_ENABLED(CONFIG_ACPI)
> > +#if IS_ENABLED(CONFIG_EFI_CUSTOM_SSDT_OVERLAYS)
> > #define EFIVAR_SSDT_NAME_MAX 16
> > static char efivar_ssdt[EFIVAR_SSDT_NAME_MAX] __initdata;
> > static int __init efivar_ssdt_setup(char *str)
> > diff --git a/drivers/firmware/efi/Kconfig b/drivers/firmware/efi/Kconfig
> > index 6b38f9e5d20..fe433f76b03 100644
> > --- a/drivers/firmware/efi/Kconfig
> > +++ b/drivers/firmware/efi/Kconfig
> > @@ -278,3 +278,14 @@ config EFI_EARLYCON
> > depends on SERIAL_EARLYCON && !ARM && !IA64
> > select FONT_SUPPORT
> > select ARCH_USE_MEMREMAP_PROT
> > +
> > +config EFI_CUSTOM_SSDT_OVERLAYS
> > + bool "Load custom ACPI SSDT overlay from an EFI variable"
> > + depends on EFI_VARS
>
> Shouldn't this depend on ACPI too?
>

I'll pick this up as a fix (with the ACPI dependency added)

> > + default ACPI_TABLE_UPGRADE
> > + help
> > + Allow loading of an ACPI SSDT overlay from an EFI variable specified
> > + by a kernel command line option.
> > +
> > + See Documentation/admin-guide/acpi/ssdt-overlays.rst for more
> > + information.
> > --
> > 2.26.2
> >

Subject: [tip: efi/urgent] efi: Make it possible to disable efivar_ssdt entirely

The following commit has been merged into the efi/urgent branch of tip:

Commit-ID: 435d1a471598752446a72ad1201b3c980526d869
Gitweb: https://git.kernel.org/tip/435d1a471598752446a72ad1201b3c980526d869
Author: Peter Jones <[email protected]>
AuthorDate: Mon, 15 Jun 2020 16:24:08 -04:00
Committer: Ard Biesheuvel <[email protected]>
CommitterDate: Tue, 16 Jun 2020 11:01:07 +02:00

efi: Make it possible to disable efivar_ssdt entirely

In most cases, such as CONFIG_ACPI_CUSTOM_DSDT and
CONFIG_ACPI_TABLE_UPGRADE, boot-time modifications to firmware tables
are tied to specific Kconfig options. Currently this is not the case
for modifying the ACPI SSDT via the efivar_ssdt kernel command line
option and associated EFI variable.

This patch adds CONFIG_EFI_CUSTOM_SSDT_OVERLAYS, which defaults
disabled, in order to allow enabling or disabling that feature during
the build.

Cc: <[email protected]>
Signed-off-by: Peter Jones <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Ard Biesheuvel <[email protected]>
---
drivers/firmware/efi/Kconfig | 11 +++++++++++
drivers/firmware/efi/efi.c | 2 +-
2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/Kconfig b/drivers/firmware/efi/Kconfig
index e6fc022..3939699 100644
--- a/drivers/firmware/efi/Kconfig
+++ b/drivers/firmware/efi/Kconfig
@@ -278,3 +278,14 @@ config EFI_EARLYCON
depends on SERIAL_EARLYCON && !ARM && !IA64
select FONT_SUPPORT
select ARCH_USE_MEMREMAP_PROT
+
+config EFI_CUSTOM_SSDT_OVERLAYS
+ bool "Load custom ACPI SSDT overlay from an EFI variable"
+ depends on EFI_VARS && ACPI
+ default ACPI_TABLE_UPGRADE
+ help
+ Allow loading of an ACPI SSDT overlay from an EFI variable specified
+ by a kernel command line option.
+
+ See Documentation/admin-guide/acpi/ssdt-overlays.rst for more
+ information.
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index edc5d36..5114cae 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -189,7 +189,7 @@ static void generic_ops_unregister(void)
efivars_unregister(&generic_efivars);
}

-#if IS_ENABLED(CONFIG_ACPI)
+#ifdef CONFIG_EFI_CUSTOM_SSDT_OVERLAYS
#define EFIVAR_SSDT_NAME_MAX 16
static char efivar_ssdt[EFIVAR_SSDT_NAME_MAX] __initdata;
static int __init efivar_ssdt_setup(char *str)