From: Ross Zwisler <zwisler@google.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Duncan Laurie <dlaurie@chromium.org>,
Furquan Shaikh <furquan@chromium.org>,
Guenter Roeck <groeck@google.com>,
linux-kernel@vger.kernel.org, Benson Leung <bleung@chromium.org>,
Ben Zhang <benzh@chromium.org>,
Filipe Brandenburger <filbranden@chromium.org>,
Furquan Shaikh <furquan@google.com>,
Ross Zwisler <zwisler@google.com>
Subject: [PATCH 3/4] gsmi: Remove autoselected dependency on EFI and EFI_VARS
Date: Fri, 12 Oct 2018 10:04:47 -0600 [thread overview]
Message-ID: <20181012160448.79018-4-zwisler@google.com> (raw)
In-Reply-To: <20181012160448.79018-1-zwisler@google.com>
From: Duncan Laurie <dlaurie@chromium.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@chromium.org>
Reviewed-by: Olof Johansson <olofj@chromium.org>
Signed-off-by: Benson Leung <bleung@chromium.org>
Signed-off-by: Ben Zhang <benzh@chromium.org>
Signed-off-by: Filipe Brandenburger <filbranden@chromium.org>
Signed-off-by: Furquan Shaikh <furquan@google.com>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
[zwisler: update changelog for upstream]
Signed-off-by: Ross Zwisler <zwisler@google.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
next prev parent reply other threads:[~2018-10-12 16:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-12 16:04 [PATCH 0/4] gsmi: Google specific firmware patches Ross Zwisler
2018-10-12 16:04 ` [PATCH 1/4] gsmi: Fix bug in append_to_eventlog sysfs handler Ross Zwisler
2018-10-12 16:04 ` [PATCH 2/4] gsmi: Add coreboot to list of matching BIOS vendors Ross Zwisler
2018-10-12 16:04 ` Ross Zwisler [this message]
2018-10-12 16:04 ` [PATCH 4/4] gsmi: Add GSMI commands to log S0ix info Ross Zwisler
[not found] ` <CABXOdTfUKWejqTxvtcH_O6SKaWDRGcu5qCVafTstm-r8y7ke1Q@mail.gmail.com>
2018-10-15 18:30 ` [PATCH 0/4] gsmi: Google specific firmware patches Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181012160448.79018-4-zwisler@google.com \
--to=zwisler@google.com \
--cc=benzh@chromium.org \
--cc=bleung@chromium.org \
--cc=dlaurie@chromium.org \
--cc=filbranden@chromium.org \
--cc=furquan@chromium.org \
--cc=furquan@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=groeck@google.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox