* [PATCH] loongarch/reset: use general efi poweroff
@ 2024-07-26 9:17 Miao Wang via B4 Relay
0 siblings, 0 replies; 2+ messages in thread
From: Miao Wang via B4 Relay @ 2024-07-26 9:17 UTC (permalink / raw)
To: loongarch, linux-efi
Cc: Jiaxun Yang, Huacai Chen, WANG Xuerui, Ard Biesheuvel
From: Miao Wang <shankerwangmiao@gmail.com>
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 <shankerwangmiao@gmail.com>
---
arch/loongarch/kernel/efi.c | 5 +++++
arch/loongarch/kernel/reset.c | 3 ---
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/arch/loongarch/kernel/efi.c b/arch/loongarch/kernel/efi.c
index 000825406c1f..df57c2674758 100644
--- a/arch/loongarch/kernel/efi.c
+++ b/arch/loongarch/kernel/efi.c
@@ -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;
diff --git a/arch/loongarch/kernel/reset.c b/arch/loongarch/kernel/reset.c
index 1ef8c6383535..9c8156798e8d 100644
--- a/arch/loongarch/kernel/reset.c
+++ b/arch/loongarch/kernel/reset.c
@@ -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();
--
2.39.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] loongarch/reset: use general efi poweroff
[not found] <66a39687.050a0220.396642.1e5cSMTPIN_ADDED_BROKEN@mx.google.com>
@ 2024-07-26 14:09 ` Ard Biesheuvel
0 siblings, 0 replies; 2+ messages in thread
From: Ard Biesheuvel @ 2024-07-26 14:09 UTC (permalink / raw)
To: shankerwangmiao
Cc: loongarch, linux-efi, Jiaxun Yang, Huacai Chen, WANG Xuerui
On Fri, 26 Jul 2024 at 14:28, Miao Wang via B4 Relay
<devnull+shankerwangmiao.gmail.com@kernel.org> wrote:
>
> From: Miao Wang <shankerwangmiao@gmail.com>
>
> 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 <shankerwangmiao@gmail.com>
> ---
> arch/loongarch/kernel/efi.c | 5 +++++
> arch/loongarch/kernel/reset.c | 3 ---
> 2 files changed, 5 insertions(+), 3 deletions(-)
>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
> diff --git a/arch/loongarch/kernel/efi.c b/arch/loongarch/kernel/efi.c
> index 000825406c1f..df57c2674758 100644
> --- a/arch/loongarch/kernel/efi.c
> +++ b/arch/loongarch/kernel/efi.c
> @@ -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;
> diff --git a/arch/loongarch/kernel/reset.c b/arch/loongarch/kernel/reset.c
> index 1ef8c6383535..9c8156798e8d 100644
> --- a/arch/loongarch/kernel/reset.c
> +++ b/arch/loongarch/kernel/reset.c
> @@ -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();
> --
> 2.39.2
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-07-26 14:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-26 9:17 [PATCH] loongarch/reset: use general efi poweroff Miao Wang via B4 Relay
[not found] <66a39687.050a0220.396642.1e5cSMTPIN_ADDED_BROKEN@mx.google.com>
2024-07-26 14:09 ` Ard Biesheuvel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox