linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Bradford <robert.bradford@intel.com>
To: x86@kernel.org
Cc: Rob Bradford <robert.bradford@intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>, Rik van Riel <riel@surriel.com>,
	Juergen Gross <jgross@suse.com>,
	Jian-Hong Pan <jian-hong@endlessm.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] x86/reboot: Avoid EFI reboot when not running on EFI
Date: Thu, 29 Aug 2019 11:11:18 +0100	[thread overview]
Message-ID: <20190829101119.7345-1-robert.bradford@intel.com> (raw)

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>
---
 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 09d6bded3c1e..0b0a7fccdb00 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -500,7 +500,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;
-- 
2.21.0


             reply	other threads:[~2019-08-29 10:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-29 10:11 Rob Bradford [this message]
2019-08-29 12:18 ` [PATCH] x86/reboot: Avoid EFI reboot when not running on EFI Thomas Gleixner
2019-08-29 14:34   ` Bradford, Robert
2019-09-12 12:40     ` Bradford, Robert
2019-09-13 18:54     ` Ard Biesheuvel

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=20190829101119.7345-1-robert.bradford@intel.com \
    --to=robert.bradford@intel.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=jgross@suse.com \
    --cc=jian-hong@endlessm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=riel@surriel.com \
    --cc=tglx@linutronix.de \
    --cc=x86@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;
as well as URLs for NNTP newsgroup(s).