From: Matt Fleming <matt@codeblueprint.co.uk>
To: linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: joeyli <jlee@suse.com>, Matt Fleming <matt@codeblueprint.co.uk>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
Kweh Hock Leong <hock.leong.kweh@intel.com>,
Borislav Petkov <bp@alien8.de>, Ingo Molnar <mingo@kernel.org>,
"H. Peter Anvin" <hpa@zytor.com>,
Thomas Gleixner <tglx@linutronix.de>
Subject: [PATCH 3/4] x86/efi: Force EFI reboot to process pending capsules
Date: Thu, 17 Mar 2016 12:57:10 +0000 [thread overview]
Message-ID: <1458219431-24741-4-git-send-email-matt@codeblueprint.co.uk> (raw)
In-Reply-To: <1458219431-24741-1-git-send-email-matt@codeblueprint.co.uk>
If an EFI capsule has been sent to the firmware we must match the type
of EFI reset against that required by the capsule to ensure it is
processed correctly.
Force an EFI reboot if a capsule is pending for the next reset.
Cc: Kweh Hock Leong <hock.leong.kweh@intel.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
---
arch/x86/kernel/reboot.c | 9 +++++++++
include/linux/efi.h | 6 ++++++
2 files changed, 15 insertions(+)
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index ab0adc0fa5db..a9b31eb815f2 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -535,6 +535,15 @@ static void native_machine_emergency_restart(void)
mode = reboot_mode == REBOOT_WARM ? 0x1234 : 0;
*((unsigned short *)__va(0x472)) = mode;
+ /*
+ * If an EFI capsule has been registered with the firmware then
+ * override the reboot= parameter.
+ */
+ if (efi_capsule_pending(NULL)) {
+ pr_info("EFI capsule is pending, forcing EFI reboot.\n");
+ reboot_type = BOOT_EFI;
+ }
+
for (;;) {
/* Could also try the reset bit in the Hammer NB */
switch (reboot_type) {
diff --git a/include/linux/efi.h b/include/linux/efi.h
index a28053e71e99..290aa5673119 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -1028,6 +1028,12 @@ static inline bool efi_enabled(int feature)
}
static inline void
efi_reboot(enum reboot_mode reboot_mode, const char *__unused) {}
+
+static inline bool
+efi_capsule_pending(int *reset_type)
+{
+ return false;
+}
#endif
extern int efi_status_to_err(efi_status_t status);
--
2.6.2
next prev parent reply other threads:[~2016-03-17 12:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-17 12:57 [PATCH 0/4] EFI capsule update support Matt Fleming
2016-03-17 12:57 ` [PATCH 1/4] efi: Move efi_status_to_err() to drivers/firmware/efi/ Matt Fleming
2016-03-21 9:43 ` Ard Biesheuvel
2016-03-17 12:57 ` [PATCH 2/4] efi: Capsule update support Matt Fleming
2016-03-21 10:19 ` Ard Biesheuvel
2016-03-21 20:31 ` Matt Fleming
2016-03-29 12:26 ` Matt Fleming
2016-03-29 13:50 ` Ard Biesheuvel
2016-04-05 10:09 ` Matt Fleming
2016-03-17 12:57 ` Matt Fleming [this message]
2016-03-17 12:57 ` [PATCH 4/4] efi: A misc char interface to update EFI firmware Matt Fleming
2016-04-01 2:48 ` deckard
2016-04-05 9:48 ` Matt Fleming
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=1458219431-24741-4-git-send-email-matt@codeblueprint.co.uk \
--to=matt@codeblueprint.co.uk \
--cc=ard.biesheuvel@linaro.org \
--cc=bp@alien8.de \
--cc=hock.leong.kweh@intel.com \
--cc=hpa@zytor.com \
--cc=jlee@suse.com \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
/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
Powered by JetHome