History

efi/arm64: use UEFI for system reset and poweroff

If UEFI Runtime Services are available, they are preferred over direct PSCI calls or other methods to reset the system. For the reset case, we need to hook into machine_restart(), as the arm_pm_restart function pointer may be overwritten by modules.

Ard Biesheuvel committed 11 years ago

Commit 60c0d451 parent 285994a2 files · +17 −0Browse files

Unified · Split

2 files
  1. arch/arm64/kernel/efi.c +9 −0
  2. arch/arm64/kernel/process.c +8 −0
arch/arm64/kernel/efi.c+9−0
@@ -354,3 +354,12 @@ void efi_virtmap_unload(void) · 353 unmodified lines
354 efi_set_pgd(current->active_mm);354 efi_set_pgd(current->active_mm);
355 preempt_enable();355 preempt_enable();
356}356}
357
358/*
359 * UpdateCapsule() depends on the system being shutdown via
360 * ResetSystem().
361 */
362bool efi_poweroff_required(void)
363{
364 return efi_enabled(EFI_RUNTIME_SERVICES);
365}
arch/arm64/kernel/process.c+8−0
@@ -21,6 +21,7 @@ · 20 unmodified lines
21#include <stdarg.h>21#include <stdarg.h>
22 22
23#include <linux/compat.h>23#include <linux/compat.h>
24#include <linux/efi.h>
24#include <linux/export.h>25#include <linux/export.h>
25#include <linux/sched.h>26#include <linux/sched.h>
26#include <linux/kernel.h>27#include <linux/kernel.h>
@@ -150,6 +151,13 @@ void machine_restart(char *cmd) · 123 unmodified lines
150 local_irq_disable();151 local_irq_disable();
151 smp_send_stop();152 smp_send_stop();
152 153
154 /*
155 * UpdateCapsule() depends on the system being reset via
156 * ResetSystem().
157 */
158 if (efi_enabled(EFI_RUNTIME_SERVICES))
159 efi_reboot(reboot_mode, NULL);
160
153 /* Now call the architecture specific reboot code. */161 /* Now call the architecture specific reboot code. */
154 if (arm_pm_restart)162 if (arm_pm_restart)
155 arm_pm_restart(reboot_mode, cmd);163 arm_pm_restart(reboot_mode, cmd);