Skip to contentSkip to conversation

loongarch/reset: use general efi poweroff

PATCH New Miao Wang 1 participant 1 message Jul 26, 2024

Subsystems (2)
lore
Share & tools
lore

Miao Wang

author
#0 lore raw

PATCH 1/1 loongarch/reset: use general efi poweroff

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.

---
 arch/loongarch/kernel/efi.c   | 5 +++++
 arch/loongarch/kernel/reset.c | 3 ---
 2 files changed, 5 insertions(+), 3 deletions(-)
arch/loongarch/kernel/efi.c +5 -0
index 000825406c1f..df57c2674758 100644
@@ -73,6 +73,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;
arch/loongarch/kernel/reset.c +0 -3
index 1ef8c6383535..9c8156798e8d 100644
@@ -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();
Signature · 1 line
2.39.2