From: Ard Biesheuvel <ardb@google.com>
To: linux-efi@vger.kernel.org
Cc: N3verG0nnaGiveYouUp+LinuxKernel@disroot.org,
Ard Biesheuvel <ardb@kernel.org>,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Subject: [PATCH] efi/x86: Disable buggy QueryVariableInfo() on HP ProBook x360
Date: Mon, 11 Sep 2023 08:10:25 +0000 [thread overview]
Message-ID: <20230911081024.3489875-2-ardb@google.com> (raw)
From: Ard Biesheuvel <ardb@kernel.org>
Some HP ProBook x360 machines appear to have a buggy UEFI implementation
that crashes in the firmware when QueryVariableInfo() is invoked. So add
a DMI based quirk that marks this runtime service as unavailable on
those machines.
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=217898
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
DodoLedev,
Please check whether this patch gives you a working efibootmgr when
applied onto 6.4 or earlier. There is another patch [0] under discussion
that will combine with this one to fix the 6.5 regression as well.
[0] https://lore.kernel.org/all/20230910045445.41632-1-heinrich.schuchardt@canonical.com/
arch/x86/platform/efi/quirks.c | 31 ++++++++++++++++++--
1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/arch/x86/platform/efi/quirks.c b/arch/x86/platform/efi/quirks.c
index f0cc00032751..7103bec7bc86 100644
--- a/arch/x86/platform/efi/quirks.c
+++ b/arch/x86/platform/efi/quirks.c
@@ -162,8 +162,9 @@ efi_status_t efi_query_variable_store(u32 attributes, unsigned long size,
efi_status_t status;
u64 storage_size, remaining_size, max_size;
- if (!(attributes & EFI_VARIABLE_NON_VOLATILE))
- return 0;
+ if (!(attributes & EFI_VARIABLE_NON_VOLATILE) ||
+ !efi_rt_services_supported(EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO))
+ return EFI_SUCCESS;
if (nonblocking)
return query_variable_store_nonblocking(attributes, size);
@@ -779,3 +780,29 @@ void efi_crash_gracefully_on_page_fault(unsigned long phys_addr)
schedule();
}
}
+
+static int __init
+disable_buggy_query_variable_info(const struct dmi_system_id *id)
+{
+ pr_info("Detected %s machine, disabling EFI QueryVariableInfo()\n",
+ id->ident);
+ efi.runtime_supported_mask &= ~EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO;
+ return 1;
+}
+
+static int __init efi_dmi_check(void)
+{
+ static const struct dmi_system_id dmi_ids[] __initconst = {
+ {
+ .callback = disable_buggy_query_variable_info,
+ .ident = "HP ProBook x360",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "HP"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "HP ProBook x360 11 G1 EE"),
+ },
+ },
+ { } /* terminating entry */
+ };
+ return dmi_check_system(dmi_ids);
+}
+subsys_initcall(efi_dmi_check);
--
2.42.0.283.g2d96d420d3-goog
reply other threads:[~2023-09-11 8:10 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230911081024.3489875-2-ardb@google.com \
--to=ardb@google.com \
--cc=N3verG0nnaGiveYouUp+LinuxKernel@disroot.org \
--cc=ardb@kernel.org \
--cc=heinrich.schuchardt@canonical.com \
--cc=ilias.apalodimas@linaro.org \
--cc=linux-efi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.