Преглед на файлове

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 <matt@codeblueprint.co.uk>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Kweh Hock Leong <hock.leong.kweh@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: joeyli <jlee@suse.com>
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 <mingo@kernel.org>
Matt Fleming преди 9 години
родител
ревизия
87615a34d5
променени са 2 файла, в които са добавени 15 реда и са изтрити 0 реда
  1. 9 0
      arch/x86/kernel/reboot.c
  2. 6 0
      include/linux/efi.h

+ 9 - 0
arch/x86/kernel/reboot.c

@@ -535,6 +535,15 @@ static void native_machine_emergency_restart(void)
 	mode = reboot_mode == REBOOT_WARM ? 0x1234 : 0;
 	mode = reboot_mode == REBOOT_WARM ? 0x1234 : 0;
 	*((unsigned short *)__va(0x472)) = mode;
 	*((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 (;;) {
 	for (;;) {
 		/* Could also try the reset bit in the Hammer NB */
 		/* Could also try the reset bit in the Hammer NB */
 		switch (reboot_type) {
 		switch (reboot_type) {

+ 6 - 0
include/linux/efi.h

@@ -1085,6 +1085,12 @@ static inline bool efi_enabled(int feature)
 }
 }
 static inline void
 static inline void
 efi_reboot(enum reboot_mode reboot_mode, const char *__unused) {}
 efi_reboot(enum reboot_mode reboot_mode, const char *__unused) {}
+
+static inline bool
+efi_capsule_pending(int *reset_type)
+{
+	return false;
+}
 #endif
 #endif
 
 
 extern int efi_status_to_err(efi_status_t status);
 extern int efi_status_to_err(efi_status_t status);