Skip to content

Commit

Permalink
loongarch/reset: use general efi poweroff
Browse files Browse the repository at this point in the history
Currently efi_shutdown_init can register a general sys_off handler,
efi_power_off, which will be called during do_kernel_power_off and shut
the machine off via efi runtime services. So enable this by providing
efi_poweroff_required, like arm and x86, and prevent directly calling
efi.reset_system in machine_power_off.

Signed-off-by: Miao Wang <[email protected]>
  • Loading branch information
shankerwangmiao authored and MingcongBai committed Aug 9, 2024
1 parent 3abcb04 commit 1c9622e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 5 additions & 0 deletions arch/loongarch/kernel/efi.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ struct screen_info screen_info __section(".data");
EXPORT_SYMBOL_GPL(screen_info);
#endif

bool efi_poweroff_required(void)
{
return efi_enabled(EFI_RUNTIME_SERVICES);
}

static void __init init_screen_info(void)
{
struct screen_info *si;
Expand Down
3 changes: 0 additions & 3 deletions arch/loongarch/kernel/reset.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ void machine_power_off(void)
enable_pci_wakeup();
#endif
do_kernel_power_off();
#ifdef CONFIG_EFI
efi.reset_system(EFI_RESET_SHUTDOWN, EFI_SUCCESS, 0, NULL);
#endif

while (true) {
__arch_cpu_idle();
Expand Down

0 comments on commit 1c9622e

Please sign in to comment.