summaryrefslogtreecommitdiffstats
path: root/patches/boot_time_opt_guest/0051-x86-reboot-Avoid-EFI-reboot-when-not-running-on-EFI.patch
blob: 7cabf0882f5629bc6dd953fe103328cde0d15d9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Rob Bradford <robert.bradford@intel.com>
Date: Thu, 29 Aug 2019 11:11:18 +0100
Subject: [PATCH] x86/reboot: Avoid EFI reboot when not running on EFI

Replace the check using efi_runtime_disabled() which only checks if EFI
runtime was disabled on the kernel command line with a call to
efi_enabled(EFI_RUNTIME_SERVICES) to check if EFI runtime services are
available.

In the situation where the kernel was booted without an EFI environment
then only efi_enabled(EFI_RUNTIME_SERVICES) correctly represents that no
EFI is available. Setting "noefi" or "efi=noruntime" on the commandline
continue to have the same effect as efi_enabled(EFI_RUNTIME_SERVICES)
will return false.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
Link: https://lore.kernel.org/lkml/20190829101119.7345-1-robert.bradford@intel.com
---
 arch/x86/kernel/reboot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index a515e2d230b7..7bf48675d9fc 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -508,7 +508,7 @@ static int __init reboot_init(void)
 	 */
 	rv = dmi_check_system(reboot_dmi_table);
 
-	if (!rv && efi_reboot_required() && !efi_runtime_disabled())
+	if (!rv && efi_reboot_required() && efi_enabled(EFI_RUNTIME_SERVICES))
 		reboot_type = BOOT_EFI;
 
 	return 0;
-- 
https://clearlinux.org