Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753468AbcD1KmQ (ORCPT ); Thu, 28 Apr 2016 06:42:16 -0400 Received: from terminus.zytor.com ([198.137.202.10]:48098 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752604AbcD1KmM (ORCPT ); Thu, 28 Apr 2016 06:42:12 -0400 Date: Thu, 28 Apr 2016 03:41:17 -0700 From: tip-bot for Matt Fleming Message-ID: Cc: jlee@suse.com, hock.leong.kweh@intel.com, ard.biesheuvel@linaro.org, linux-kernel@vger.kernel.org, mingo@kernel.org, matt@codeblueprint.co.uk, tglx@linutronix.de, hpa@zytor.com, bp@alien8.de, peterz@infradead.org Reply-To: bp@alien8.de, peterz@infradead.org, hpa@zytor.com, tglx@linutronix.de, hock.leong.kweh@intel.com, jlee@suse.com, matt@codeblueprint.co.uk, linux-kernel@vger.kernel.org, mingo@kernel.org, ard.biesheuvel@linaro.org In-Reply-To: <1461614832-17633-29-git-send-email-matt@codeblueprint.co.uk> References: <1461614832-17633-29-git-send-email-matt@codeblueprint.co.uk> To: linux-tip-commits@vger.kernel.org Subject: [tip:efi/core] x86/efi: Force EFI reboot to process pending capsules Git-Commit-ID: 87615a34d561ef59bd0cffc73256a21220dfdffd X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2273 Lines: 67 Commit-ID: 87615a34d561ef59bd0cffc73256a21220dfdffd Gitweb: http://git.kernel.org/tip/87615a34d561ef59bd0cffc73256a21220dfdffd Author: Matt Fleming AuthorDate: Mon, 25 Apr 2016 21:07:00 +0100 Committer: Ingo Molnar CommitDate: Thu, 28 Apr 2016 11:34:04 +0200 x86/efi: Force EFI reboot to process pending capsules 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. Signed-off-by: Matt Fleming Cc: Ard Biesheuvel Cc: Borislav Petkov Cc: Kweh Hock Leong Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: joeyli Cc: linux-efi@vger.kernel.org Link: http://lkml.kernel.org/r/1461614832-17633-29-git-send-email-matt@codeblueprint.co.uk Signed-off-by: Ingo Molnar --- 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 ab0adc0..a9b31eb 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 a3b4c1e..aa36fb8 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h @@ -1085,6 +1085,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);