Skip to content

Instantly share code, notes, and snippets.

@rbradford
Created June 12, 2020 15:56
Show Gist options
  • Save rbradford/1888ddd5574bf5591bffeb80a4835a09 to your computer and use it in GitHub Desktop.
Save rbradford/1888ddd5574bf5591bffeb80a4835a09 to your computer and use it in GitHub Desktop.
From e2c7e11c1de7917b2104e27fd222a28ac117319f Mon Sep 17 00:00:00 2001
From: Rob Bradford <[email protected]>
Date: Fri, 12 Jun 2020 16:52:25 +0100
Subject: [PATCH] arch/x86: Only try EFI reboot if booted via EFI
As well as checking for the presence of "noefi" field via
efi_runtime_disabled() also check that the kernel was booted with EFI.
This fixes an issue on Cloud Hypervisor (which uses ACPI
Hardware-Reduced) where the kernel tries to reboot via EFI even though
the kernel was loaded directly into the VM via the PVH entry point. It
should try an use ACPI instead.
Signed-off-by: Rob Bradford <[email protected]>
---
arch/x86/kernel/reboot.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 0cc7c0b106bbf..fc3baa7a84b49 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -500,7 +500,8 @@ 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_runtime_disabled() &&
+ efi_enabled(EFI_RUNTIME_SERVICES))
reboot_type = BOOT_EFI;
return 0;
--
2.26.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment