]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.9.177/x86-reboot-efi-use-efi-reboot-for-acer-travelmate-x5.patch
Fix up backported ptrace patch
[thirdparty/kernel/stable-queue.git] / releases / 4.9.177 / x86-reboot-efi-use-efi-reboot-for-acer-travelmate-x5.patch
CommitLineData
27d6b7f2
SL
1From b1b93ae6629c6f960829b1b7c9b87ab4cda72d3d Mon Sep 17 00:00:00 2001
2From: Jian-Hong Pan <jian-hong@endlessm.com>
3Date: Fri, 12 Apr 2019 16:01:53 +0800
4Subject: x86/reboot, efi: Use EFI reboot for Acer TravelMate X514-51T
5
6[ Upstream commit 0082517fa4bce073e7cf542633439f26538a14cc ]
7
8Upon reboot, the Acer TravelMate X514-51T laptop appears to complete the
9shutdown process, but then it hangs in BIOS POST with a black screen.
10
11The problem is intermittent - at some points it has appeared related to
12Secure Boot settings or different kernel builds, but ultimately we have
13not been able to identify the exact conditions that trigger the issue to
14come and go.
15
16Besides, the EFI mode cannot be disabled in the BIOS of this model.
17
18However, after extensive testing, we observe that using the EFI reboot
19method reliably avoids the issue in all cases.
20
21So add a boot time quirk to use EFI reboot on such systems.
22
23Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=203119
24Signed-off-by: Jian-Hong Pan <jian-hong@endlessm.com>
25Signed-off-by: Daniel Drake <drake@endlessm.com>
26Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
27Cc: Borislav Petkov <bp@alien8.de>
28Cc: Linus Torvalds <torvalds@linux-foundation.org>
29Cc: Matt Fleming <matt@codeblueprint.co.uk>
30Cc: Peter Zijlstra <peterz@infradead.org>
31Cc: Thomas Gleixner <tglx@linutronix.de>
32Cc: linux-efi@vger.kernel.org
33Cc: linux@endlessm.com
34Link: http://lkml.kernel.org/r/20190412080152.3718-1-jian-hong@endlessm.com
35[ Fix !CONFIG_EFI build failure, clarify the code and the changelog a bit. ]
36Signed-off-by: Ingo Molnar <mingo@kernel.org>
37Signed-off-by: Sasha Levin <sashal@kernel.org>
38---
39 arch/x86/kernel/reboot.c | 21 +++++++++++++++++++++
40 include/linux/efi.h | 7 ++++++-
41 2 files changed, 27 insertions(+), 1 deletion(-)
42
43diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
44index 4a12362a194af..c55b11fe8e9f6 100644
45--- a/arch/x86/kernel/reboot.c
46+++ b/arch/x86/kernel/reboot.c
47@@ -82,6 +82,19 @@ static int __init set_bios_reboot(const struct dmi_system_id *d)
48 return 0;
49 }
50
51+/*
52+ * Some machines don't handle the default ACPI reboot method and
53+ * require the EFI reboot method:
54+ */
55+static int __init set_efi_reboot(const struct dmi_system_id *d)
56+{
57+ if (reboot_type != BOOT_EFI && !efi_runtime_disabled()) {
58+ reboot_type = BOOT_EFI;
59+ pr_info("%s series board detected. Selecting EFI-method for reboot.\n", d->ident);
60+ }
61+ return 0;
62+}
63+
64 void __noreturn machine_real_restart(unsigned int type)
65 {
66 local_irq_disable();
67@@ -167,6 +180,14 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
68 DMI_MATCH(DMI_PRODUCT_NAME, "AOA110"),
69 },
70 },
71+ { /* Handle reboot issue on Acer TravelMate X514-51T */
72+ .callback = set_efi_reboot,
73+ .ident = "Acer TravelMate X514-51T",
74+ .matches = {
75+ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
76+ DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate X514-51T"),
77+ },
78+ },
79
80 /* Apple */
81 { /* Handle problems with rebooting on Apple MacBook5 */
82diff --git a/include/linux/efi.h b/include/linux/efi.h
83index 80b1b8faf503f..e6711bf9f0d12 100644
84--- a/include/linux/efi.h
85+++ b/include/linux/efi.h
86@@ -1433,7 +1433,12 @@ efi_status_t efi_setup_gop(efi_system_table_t *sys_table_arg,
87 struct screen_info *si, efi_guid_t *proto,
88 unsigned long size);
89
90-bool efi_runtime_disabled(void);
91+#ifdef CONFIG_EFI
92+extern bool efi_runtime_disabled(void);
93+#else
94+static inline bool efi_runtime_disabled(void) { return true; }
95+#endif
96+
97 extern void efi_call_virt_check_flags(unsigned long flags, const char *call);
98
99 /*
100--
1012.20.1
102