efi/arm64: use UEFI for system reset and poweroff
PATCH v2 1/1 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.
--- arch/arm64/kernel/efi.c | 9 +++++++++ arch/arm64/kernel/process.c | 8 ++++++++ 2 files changed, 17 insertions(+)
arch/arm64/kernel/efi.c +9 -0
@@ -354,3 +354,12 @@ void efi_virtmap_unload(void)efi_set_pgd (current->active_mm);preempt_enable (); } + +/* +* UpdateCapsule() depends on the system being shutdown via +* ResetSystem(). +*/ +bool efi_poweroff_required (void ) +{ +return efi_enabled (EFI_RUNTIME_SERVICES ); +}
arch/arm64/kernel/process.c +8 -0
@@ -21,6 +21,7 @@#include <stdarg.h> #include <linux/compat.h> +#include <linux/efi.h> #include <linux/export.h> #include <linux/sched.h> #include <linux/kernel.h>
@@ -150,6 +151,13 @@ void machine_restart(char *cmd)local_irq_disable ();smp_send_stop (); +/* +* UpdateCapsule() depends on the system being reset via +* ResetSystem(). +*/ +if (efi_enabled (EFI_RUNTIME_SERVICES )) +efi_reboot (reboot_mode,NULL ); +/* Now call the architecture specific reboot code. */ if (arm_pm_restart)arm_pm_restart (reboot_mode, cmd);
Signature · 1 line
1.8.3.2
PATCH v2 1/1 efi/arm64: use UEFI for system reset and poweroff
Quoted 6 lines · Ard Biesheuvel
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 thearm_pm_restartfunction pointer may be overwritten by modules.
Quoted 7 lines
Tested-by Mark Rutland <[email protected]>Reviewed-by Mark Rutland <[email protected]>Signed-off-by Ard Biesheuvel <[email protected]>--- arch/arm64/kernel/efi.c | 9 +++++++++ arch/arm64/kernel/process.c | 8 ++++++++ 2 files changed, 17 insertions(+)
Looks good to me.
Catalin, are you picking this up?
Signature · 1 line
Matt Fleming, Intel Open Source Technology Center
Catalin Marinas
maintainerPATCH v2 1/1 efi/arm64: use UEFI for system reset and poweroff
Quoted 15 lines · Matt Fleming
Quoted 6 lines · Ard Biesheuvel
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 thearm_pm_restartfunction pointer may be overwritten by modules.Quoted 7 lines
Tested-by Mark Rutland <[email protected]>Reviewed-by Mark Rutland <[email protected]>Signed-off-by Ard Biesheuvel <[email protected]>--- arch/arm64/kernel/efi.c | 9 +++++++++ arch/arm64/kernel/process.c | 8 ++++++++ 2 files changed, 17 insertions(+)
Quoted 5 lines
Looks good to me.
Reviewed-by Matt Fleming <[email protected]>Catalin, are you picking this up?
Yes, I will. Thanks.
Signature · 1 line
Catalin