From: Sumit Garg <sumit.garg@kernel.org>
To: linux-arm-kernel@lists.infradead.org, linux-efi@vger.kernel.org,
linux-arm-msm@vger.kernel.org
Cc: catalin.marinas@arm.com, will@kernel.org, ardb@kernel.org,
mark.rutland@arm.com, andersson@kernel.org,
konradybcio@kernel.org, dmitry.baryshkov@oss.qualcomm.com,
shivendra.pratap@oss.qualcomm.com,
leif.lindholm@oss.qualcomm.com, linux-kernel@vger.kernel.org,
Sumit Garg <sumit.garg@oss.qualcomm.com>
Subject: [PATCH 1/2] efi/reboot: Add support for EFI_RESET_PLATFORM_SPECIFIC
Date: Fri, 14 Nov 2025 14:20:57 +0530 [thread overview]
Message-ID: <20251114085058.2195900-2-sumit.garg@kernel.org> (raw)
In-Reply-To: <20251114085058.2195900-1-sumit.garg@kernel.org>
From: Sumit Garg <sumit.garg@oss.qualcomm.com>
UEFI specification provides support for EfiResetPlatformSpecific reset
type as follows:
"
ResetSystem:
Calling this interface with ResetType of EfiResetPlatformSpecific
causes a system-wide reset. The exact type of the reset is defined
by the EFI_GUID that follows the Null-terminated Unicode string passed
into ResetData. If the platform does not recognize the EFI_GUID in
ResetData the platform must pick a supported reset type to perform.
The platform may optionally log the parameters from any non-normal
reset that occurs.
"
Lets use the ResetData to pass the platform specific reboot command
issued and leave it's interpretation to UEFI implementation following
the specification.
Signed-off-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
---
drivers/firmware/efi/reboot.c | 25 +++++++++++++++----------
include/linux/efi.h | 5 +++--
2 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/drivers/firmware/efi/reboot.c b/drivers/firmware/efi/reboot.c
index ceae84c19d22..23a2fc68e9c9 100644
--- a/drivers/firmware/efi/reboot.c
+++ b/drivers/firmware/efi/reboot.c
@@ -10,7 +10,7 @@ static struct sys_off_handler *efi_sys_off_handler;
int efi_reboot_quirk_mode = -1;
-void efi_reboot(enum reboot_mode reboot_mode, const char *__unused)
+void efi_reboot(enum reboot_mode reboot_mode, const char *data)
{
const char *str[] = { "cold", "warm", "shutdown", "platform" };
int efi_mode, cap_reset_mode;
@@ -18,14 +18,18 @@ void efi_reboot(enum reboot_mode reboot_mode, const char *__unused)
if (!efi_rt_services_supported(EFI_RT_SUPPORTED_RESET_SYSTEM))
return;
- switch (reboot_mode) {
- case REBOOT_WARM:
- case REBOOT_SOFT:
- efi_mode = EFI_RESET_WARM;
- break;
- default:
- efi_mode = EFI_RESET_COLD;
- break;
+ if (data) {
+ efi_mode = EFI_RESET_PLATFORM_SPECIFIC;
+ } else {
+ switch (reboot_mode) {
+ case REBOOT_WARM:
+ case REBOOT_SOFT:
+ efi_mode = EFI_RESET_WARM;
+ break;
+ default:
+ efi_mode = EFI_RESET_COLD;
+ break;
+ }
}
/*
@@ -43,7 +47,8 @@ void efi_reboot(enum reboot_mode reboot_mode, const char *__unused)
efi_mode = cap_reset_mode;
}
- efi.reset_system(efi_mode, EFI_SUCCESS, 0, NULL);
+ efi.reset_system(efi_mode, EFI_SUCCESS, sizeof(data),
+ (efi_char16_t *)data);
}
bool __weak efi_poweroff_required(void)
diff --git a/include/linux/efi.h b/include/linux/efi.h
index a98cc39e7aaa..5324db1518b6 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -256,6 +256,7 @@ typedef union efi_boot_services efi_boot_services_t;
#define EFI_RESET_COLD 0
#define EFI_RESET_WARM 1
#define EFI_RESET_SHUTDOWN 2
+#define EFI_RESET_PLATFORM_SPECIFIC 3
/*
* EFI Runtime Services table
@@ -874,7 +875,7 @@ static inline bool efi_enabled(int feature)
{
return test_bit(feature, &efi.flags) != 0;
}
-extern void efi_reboot(enum reboot_mode reboot_mode, const char *__unused);
+extern void efi_reboot(enum reboot_mode reboot_mode, const char *data);
bool __pure __efi_soft_reserve_enabled(void);
@@ -895,7 +896,7 @@ static inline bool efi_enabled(int feature)
return false;
}
static inline void
-efi_reboot(enum reboot_mode reboot_mode, const char *__unused) {}
+efi_reboot(enum reboot_mode reboot_mode, const char *data) {}
static inline bool efi_soft_reserve_enabled(void)
{
--
2.48.1
next prev parent reply other threads:[~2025-11-14 8:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-14 8:50 [PATCH 0/2] efi/reboot: Enable platform specific reset on arm64 Sumit Garg
2025-11-14 8:50 ` Sumit Garg [this message]
2025-11-14 21:39 ` [PATCH 1/2] efi/reboot: Add support for EFI_RESET_PLATFORM_SPECIFIC Konrad Dybcio
2025-11-14 21:41 ` Ard Biesheuvel
2025-11-14 8:50 ` [PATCH 2/2] arm64: efi: Pass reboot cmd parameter to efi_reboot() Sumit Garg
2025-11-14 9:26 ` Ard Biesheuvel
2025-11-14 9:31 ` Sumit Garg
2025-11-14 9:33 ` Ard Biesheuvel
2025-11-14 9:35 ` Ard Biesheuvel
2025-11-14 12:16 ` Sumit Garg
2025-11-14 15:47 ` Ard Biesheuvel
2025-11-17 6:43 ` Sumit Garg
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=20251114085058.2195900-2-sumit.garg@kernel.org \
--to=sumit.garg@kernel.org \
--cc=andersson@kernel.org \
--cc=ardb@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=konradybcio@kernel.org \
--cc=leif.lindholm@oss.qualcomm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=shivendra.pratap@oss.qualcomm.com \
--cc=sumit.garg@oss.qualcomm.com \
--cc=will@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).