From: Miao Wang via B4 Relay <devnull+shankerwangmiao.gmail.com@kernel.org>
To: loongarch@lists.linux.dev, linux-efi@vger.kernel.org
Cc: Jiaxun Yang <jiaxun.yang@flygoat.com>,
Huacai Chen <chenhuacai@kernel.org>,
WANG Xuerui <kernel@xen0n.name>,
Ard Biesheuvel <ardb@kernel.org>
Subject: [PATCH] loongarch/reset: use general efi poweroff
Date: Fri, 26 Jul 2024 17:17:53 +0800 [thread overview]
Message-ID: <4113cec4-4b4a-11ef-9897-937fbcdc8b5d@innull.com> (raw)
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
next reply other threads:[~2024-07-26 12:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-26 9:17 Miao Wang via B4 Relay [this message]
[not found] <66a39687.050a0220.396642.1e5cSMTPIN_ADDED_BROKEN@mx.google.com>
2024-07-26 14:09 ` [PATCH] loongarch/reset: use general efi poweroff Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4113cec4-4b4a-11ef-9897-937fbcdc8b5d@innull.com \
--to=devnull+shankerwangmiao.gmail.com@kernel.org \
--cc=ardb@kernel.org \
--cc=chenhuacai@kernel.org \
--cc=jiaxun.yang@flygoat.com \
--cc=kernel@xen0n.name \
--cc=linux-efi@vger.kernel.org \
--cc=loongarch@lists.linux.dev \
--cc=shankerwangmiao@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox