[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181012160448.79018-4-zwisler@google.com>
Date: Fri, 12 Oct 2018 10:04:47 -0600
From: Ross Zwisler <zwisler@...gle.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Duncan Laurie <dlaurie@...omium.org>,
Furquan Shaikh <furquan@...omium.org>,
Guenter Roeck <groeck@...gle.com>,
linux-kernel@...r.kernel.org, Benson Leung <bleung@...omium.org>,
Ben Zhang <benzh@...omium.org>,
Filipe Brandenburger <filbranden@...omium.org>,
Furquan Shaikh <furquan@...gle.com>,
Ross Zwisler <zwisler@...gle.com>
Subject: [PATCH 3/4] gsmi: Remove autoselected dependency on EFI and EFI_VARS
From: Duncan Laurie <dlaurie@...omium.org>
Instead of selecting EFI and EFI_VARS automatically when GSMI is
enabled let that portion of the driver be conditionally compiled
if EFI and EFI_VARS are enabled.
This allows the rest of the driver (specifically event log) to
be used if EFI_VARS is not enabled.
To test:
1) verify that EFI_VARS is not automatically selected when
CONFIG_GOOGLE_GSMI is enabled
2) verify that the kernel boots on Link and that GSMI event log
is still available and functional
3) specifically boot the kernel on Alex to ensure it does not
try to load efivars and that gsmi also does not load because it
is not in the supported DMI table
Signed-off-by: Duncan Laurie <dlaurie@...omium.org>
Reviewed-by: Olof Johansson <olofj@...omium.org>
Signed-off-by: Benson Leung <bleung@...omium.org>
Signed-off-by: Ben Zhang <benzh@...omium.org>
Signed-off-by: Filipe Brandenburger <filbranden@...omium.org>
Signed-off-by: Furquan Shaikh <furquan@...gle.com>
Tested-by: Furquan Shaikh <furquan@...omium.org>
Reviewed-by: Aaron Durbin <adurbin@...omium.org>
[zwisler: update changelog for upstream]
Signed-off-by: Ross Zwisler <zwisler@...gle.com>
---
drivers/firmware/google/Kconfig | 6 +++---
drivers/firmware/google/gsmi.c | 16 ++++++++++++----
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/drivers/firmware/google/Kconfig b/drivers/firmware/google/Kconfig
index a456a000048b..9ac36762e503 100644
--- a/drivers/firmware/google/Kconfig
+++ b/drivers/firmware/google/Kconfig
@@ -10,12 +10,12 @@ if GOOGLE_FIRMWARE
config GOOGLE_SMI
tristate "SMI interface for Google platforms"
- depends on X86 && ACPI && DMI && EFI
- select EFI_VARS
+ depends on X86 && ACPI && DMI
help
Say Y here if you want to enable SMI callbacks for Google
platforms. This provides an interface for writing to and
- clearing the EFI event log and reading and writing NVRAM
+ clearing the event log. If EFI_VARS is also enabled this
+ driver provides an interface for reading and writing NVRAM
variables.
config GOOGLE_COREBOOT_TABLE
diff --git a/drivers/firmware/google/gsmi.c b/drivers/firmware/google/gsmi.c
index 252884787266..edab00cc6bba 100644
--- a/drivers/firmware/google/gsmi.c
+++ b/drivers/firmware/google/gsmi.c
@@ -289,6 +289,10 @@ static int gsmi_exec(u8 func, u8 sub)
return rc;
}
+#ifdef CONFIG_EFI_VARS
+
+static struct efivars efivars;
+
static efi_status_t gsmi_get_variable(efi_char16_t *name,
efi_guid_t *vendor, u32 *attr,
unsigned long *data_size,
@@ -466,6 +470,8 @@ static const struct efivar_operations efivar_ops = {
.get_next_variable = gsmi_get_next_variable,
};
+#endif /* CONFIG_EFI_VARS */
+
static ssize_t eventlog_write(struct file *filp, struct kobject *kobj,
struct bin_attribute *bin_attr,
char *buf, loff_t pos, size_t count)
@@ -767,7 +773,6 @@ static __init int gsmi_system_valid(void)
}
static struct kobject *gsmi_kobj;
-static struct efivars efivars;
static const struct platform_device_info gsmi_dev_info = {
.name = "gsmi",
@@ -891,11 +896,14 @@ static __init int gsmi_init(void)
goto out_remove_bin_file;
}
+#ifdef CONFIG_EFI_VARS
ret = efivars_register(&efivars, &efivar_ops, gsmi_kobj);
if (ret) {
printk(KERN_INFO "gsmi: Failed to register efivars\n");
- goto out_remove_sysfs_files;
+ sysfs_remove_files(gsmi_kobj, gsmi_attrs);
+ goto out_remove_bin_file;
}
+#endif
register_reboot_notifier(&gsmi_reboot_notifier);
register_die_notifier(&gsmi_die_notifier);
@@ -906,8 +914,6 @@ static __init int gsmi_init(void)
return 0;
-out_remove_sysfs_files:
- sysfs_remove_files(gsmi_kobj, gsmi_attrs);
out_remove_bin_file:
sysfs_remove_bin_file(gsmi_kobj, &eventlog_bin_attr);
out_err:
@@ -927,7 +933,9 @@ static void __exit gsmi_exit(void)
unregister_die_notifier(&gsmi_die_notifier);
atomic_notifier_chain_unregister(&panic_notifier_list,
&gsmi_panic_notifier);
+#ifdef CONFIG_EFI_VARS
efivars_unregister(&efivars);
+#endif
sysfs_remove_files(gsmi_kobj, gsmi_attrs);
sysfs_remove_bin_file(gsmi_kobj, &eventlog_bin_attr);
--
2.19.0.605.g01d371f741-goog
Powered by blists - more mailing lists