Skip to content

Commit 60c0d45

Browse files
Ard Biesheuvelctmarinas
authored andcommitted
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. Tested-by: Mark Rutland <mark.rutland@arm.com> Reviewed-by: Mark Rutland <mark.rutland@arm.com> Reviewed-by: Matt Fleming <matt.fleming@intel.com> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent 285994a commit 60c0d45

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

arch/arm64/kernel/efi.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,3 +354,12 @@ void efi_virtmap_unload(void)
354354
efi_set_pgd(current->active_mm);
355355
preempt_enable();
356356
}
357+
358+
/*
359+
* UpdateCapsule() depends on the system being shutdown via
360+
* ResetSystem().
361+
*/
362+
bool efi_poweroff_required(void)
363+
{
364+
return efi_enabled(EFI_RUNTIME_SERVICES);
365+
}

arch/arm64/kernel/process.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <stdarg.h>
2222

2323
#include <linux/compat.h>
24+
#include <linux/efi.h>
2425
#include <linux/export.h>
2526
#include <linux/sched.h>
2627
#include <linux/kernel.h>
@@ -150,6 +151,13 @@ void machine_restart(char *cmd)
150151
local_irq_disable();
151152
smp_send_stop();
152153

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+
153161
/* Now call the architecture specific reboot code. */
154162
if (arm_pm_restart)
155163
arm_pm_restart(reboot_mode, cmd);

0 commit comments

Comments
 (0)