Skip to contentSkip to conversation

qcom: EFI PSCI runtime reset handling and config update

PATCH Superseded Aswin Murugan 2 participants 6 messages Jan 14 – Feb 13

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover qcom: EFI PSCI runtime reset handling and config update

This series refactors the EFI runtime PSCI reset handling:

1. Introduce EFI_PSCI_RESET_RUNTIME config to control PSCI-based EFI reset logic in U-Boot. This allows platforms to disable U-Boot’s runtime reset handling when the kernel needs to manage specialized reboot modes.

2. Disable CONFIG_EFI_PSCI_RESET_RUNTIME in qcom_defconfig so that the kernel retains full control over reset modes (e.g., EDL, bootloader), ensuring correct behavior for advanced reboot requests.

---
Changes in v2:
- As per review comments made default y for EFI_PSCI_RESET_RUNTIME config
- Disabled the EFI_PSCI_RESET_RUNTIME config for qualcomm platforms
- Link to v1: https://lore.kernel.org/all/[email protected]/
---

Aswin Murugan (2):
firmware: psci: Refactor EFI runtime PSCI reset handling
qcom_defconfig: Disable CONFIG_EFI_PSCI_RESET_RUNTIME

 configs/qcom_defconfig  |  1 +
 drivers/firmware/psci.c |  4 ++--
 lib/efi_loader/Kconfig  | 11 +++++++++++
 3 files changed, 14 insertions(+), 2 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/2 firmware: psci: Refactor EFI runtime PSCI reset handling

Previously, U-Boot’s PSCI-based implementation of efi_reset_system() was always enabled when CONFIG_PSCI_RESET was set, but it did not handle additional arguments required for specialized reset modes. This caused issues where special reboot requests (e.g., bootloader, EDL) were ignored, resulting in a normal reboot.

This change introduces a new configuration option, CONFIG_EFI_PSCI_RESET_RUNTIME, to explicitly control whether the runtime PSCI-specific EFI reset implementation is enabled. By default, the PSCI EFI reset is enabled, it can be disabled at platform defconfig allowing the kernel to handle the reset logic and pass the necessary arguments for the intended reset mode correctly.

---
Changes in v2:
- As per review comments made default y for EFI_PSCI_RESET_RUNTIME config

---
 drivers/firmware/psci.c |  4 ++--
 lib/efi_loader/Kconfig  | 11 +++++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)
drivers/firmware/psci.c +2 -2
index 2e3223e1c32..009c6153d0c 100644
@@ -244,7 +244,7 @@ static void __maybe_unused do_psci_probe(void)
 	uclass_get_device_by_name(UCLASS_FIRMWARE, DRIVER_NAME, &dev);
 }
 
-#if IS_ENABLED(CONFIG_EFI_LOADER) && IS_ENABLED(CONFIG_PSCI_RESET)
+#if IS_ENABLED(CONFIG_EFI_PSCI_RESET_RUNTIME)
 efi_status_t efi_reset_system_init(void)
 {
 	do_psci_probe();
@@ -266,7 +266,7 @@ void __efi_runtime EFIAPI efi_reset_system(enum efi_reset_type reset_type,
 	while (1)
 		;
 }
-#endif /* IS_ENABLED(CONFIG_EFI_LOADER) && IS_ENABLED(CONFIG_PSCI_RESET) */
+#endif /* IS_ENABLED(CONFIG_EFI_PSCI_RESET_RUNTIME) */
 
 #ifdef CONFIG_PSCI_RESET
 void reset_misc(void)
lib/efi_loader/Kconfig +11 -0
index 13e44be1d06..712905a56eb 100644
@@ -106,6 +106,17 @@ config EFI_HAVE_RUNTIME_RESET
 	depends on ARCH_BCM283X || FSL_LAYERSCAPE || PSCI_RESET || \
 		   SANDBOX || SYSRESET_SBI || SYSRESET_X86
 
+config EFI_PSCI_RESET_RUNTIME
+	bool "EFI Runtime PSCI Reset Support"
+	default y if EFI_LOADER && PSCI_RESET
+	depends on ARM_PSCI_FW
+	help
+	  Enable PSCI-based reset implementation for EFI runtime services.
+	  This allows the EFI runtime to perform system resets and power-off
+	  operations using the ARM Power State Coordination Interface (PSCI)
+	  firmware interface, providing a standardized method for system
+	  power management across different ARM platforms.
+
 endmenu
 
 menu "UEFI Variables"
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH v2 1/2] firmware: psci: Refactor EFI runtime PSCI reset handling

Hi Aswin,

Quoted 7 lines · Aswin Murugan

Previously, U-Boot’s PSCI-based implementation of efi_reset_system() was always enabled when CONFIG_PSCI_RESET was set, but it did not handle additional arguments required for specialized reset modes. This caused issues where special reboot requests (e.g., bootloader, EDL) were ignored, resulting in a normal reboot.

This change introduces a new configuration option,

Be imperative rather than descriptive: "Introduce a new configuration option". See
https://docs.kernel.org/process/submitting-patches.html#describe-your-changes

Quoted 45 lines

CONFIG_EFI_PSCI_RESET_RUNTIME, to explicitly control whether the runtime PSCI-specific EFI reset implementation is enabled. By default, the PSCI EFI reset is enabled, it can be disabled at platform defconfig allowing the kernel to handle the reset logic and pass the necessary arguments for the intended reset mode correctly.

---
Changes in v2:
- As per review comments made default y for EFI_PSCI_RESET_RUNTIME config

---
 drivers/firmware/psci.c |  4 ++--
 lib/efi_loader/Kconfig  | 11 +++++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)
drivers/firmware/psci.c +2 -2
index 2e3223e1c32..009c6153d0c 100644
@@ -244,7 +244,7 @@ static void __maybe_unused do_psci_probe(void)
 	uclass_get_device_by_name(UCLASS_FIRMWARE, DRIVER_NAME, &dev);
 }
 
-#if IS_ENABLED(CONFIG_EFI_LOADER) && IS_ENABLED(CONFIG_PSCI_RESET)
+#if IS_ENABLED(CONFIG_EFI_PSCI_RESET_RUNTIME)
 efi_status_t efi_reset_system_init(void)
 {
 	do_psci_probe();
@@ -266,7 +266,7 @@ void __efi_runtime EFIAPI efi_reset_system(enum efi_reset_type reset_type,
 	while (1)
 		;
 }
-#endif /* IS_ENABLED(CONFIG_EFI_LOADER) && IS_ENABLED(CONFIG_PSCI_RESET) */
+#endif /* IS_ENABLED(CONFIG_EFI_PSCI_RESET_RUNTIME) */
 
 #ifdef CONFIG_PSCI_RESET
 void reset_misc(void)
lib/efi_loader/Kconfig +0 -0
index 13e44be1d06..712905a56eb 100644
@@ -106,6 +106,17 @@ config EFI_HAVE_RUNTIME_RESET
 	depends on ARCH_BCM283X || FSL_LAYERSCAPE || PSCI_RESET || \
 		   SANDBOX || SYSRESET_SBI || SYSRESET_X86
 

lib/efi_loader/Kconfig config EFI_HAVE_RUNTIME_RESET · line 118

Quoted 10 lines
lib/efi_loader/Kconfig +10 -0
+config EFI_PSCI_RESET_RUNTIME
+	bool "EFI Runtime PSCI Reset Support"
+	default y if EFI_LOADER && PSCI_RESET
+	depends on ARM_PSCI_FW
+	help
+	  Enable PSCI-based reset implementation for EFI runtime services.
+	  This allows the EFI runtime to perform system resets and power-off
+	  operations using the ARM Power State Coordination Interface (PSCI)
+	  firmware interface, providing a standardized method for system
+	  power management across different ARM platforms.

The last 4 lines could be simplified to something like "This allows the OS to reset the system through EFI runtime calls"

Kind regards,> +

Quoted 3 lines
lib/efi_loader/Kconfig +0 -0
 endmenu
 
 menu "UEFI Variables"
Signature · 1 line
// Casey (she/her)
#3 lore raw

PATCH v2 2/2 qcom_defconfig: Disable CONFIG_EFI_PSCI_RESET_RUNTIME

In reply to Aswin Murugan

Disable CONFIG_EFI_PSCI_RESET_RUNTIME in qcom_defconfig to let the kernel manage reset modes and handle specialized reboot requests correctly.

---
 configs/qcom_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/qcom_defconfig +1 -0
index a210f4dc5e6..0bd87b1f5a1 100644
@@ -6,6 +6,7 @@ CONFIG_ARCH_SNAPDRAGON=y
 CONFIG_NR_DRAM_BANKS=24
 CONFIG_DEFAULT_DEVICE_TREE="qcom/sdm845-db845c"
 CONFIG_SYS_LOAD_ADDR=0xA0000000
+CONFIG_EFI_PSCI_RESET_RUNTIME=n
 CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y
 CONFIG_EFI_CAPSULE_ON_DISK=y
 CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
Signature · 1 line
2.34.1
#4 lore raw

Re: [PATCH v2 2/2] qcom_defconfig: Disable CONFIG_EFI_PSCI_RESET_RUNTIME

Quoted 2 lines · Aswin Murugan

Disable CONFIG_EFI_PSCI_RESET_RUNTIME in qcom_defconfig to let the kernel manage reset modes and handle specialized reboot requests correctly.

Please disable this in kconfig instead. Could you validate that this doesn't cause issues on an older platform like sdm845?

Kind regards,>

Quoted 17 lines
---
 configs/qcom_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/qcom_defconfig +1 -0
index a210f4dc5e6..0bd87b1f5a1 100644
@@ -6,6 +6,7 @@ CONFIG_ARCH_SNAPDRAGON=y
 CONFIG_NR_DRAM_BANKS=24
 CONFIG_DEFAULT_DEVICE_TREE="qcom/sdm845-db845c"
 CONFIG_SYS_LOAD_ADDR=0xA0000000
+CONFIG_EFI_PSCI_RESET_RUNTIME=n
 CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y
 CONFIG_EFI_CAPSULE_ON_DISK=y
 CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
Signature · 1 line
// Casey (she/her)
#5 lore raw

Re: [PATCH v2 2/2] qcom_defconfig: Disable CONFIG_EFI_PSCI_RESET_RUNTIME

Quoted 8 lines · Casey Connolly
Quoted 2 lines · Aswin Murugan

Disable CONFIG_EFI_PSCI_RESET_RUNTIME in qcom_defconfig to let the kernel manage reset modes and handle specialized reboot requests correctly.

Please disable this in kconfig instead. Could you validate that this doesn't cause issues on an older platform like sdm845?

Kind regards,>

Thanks for the feedback.
In v1 of this patch, Tom requested that the option be enabled by default in Kconfig so that existing behavior on other platforms would not be affected [1]. Based on that guidance, in v2 enabled the new config by default in Kconfig and explicitly disabled it for Qualcomm in |qcom_defconfig|.

Regarding validation on sdm845: I currently don’t have access to sdm845 hardware, so I’m unable to test it directly. From the nature of the change, it shouldn’t impact older Qualcomm platforms, as the reset path is typically managed by the OS/bootloader independently.

I will address the remaining comments and respin the patch.

[1] https://lore.kernel.org/all/20260108143742.GT3416603@bill-the-cat

Thanks,
Aswin

Quoted 17 lines
Quoted 17 lines
---
  configs/qcom_defconfig | 1 +
  1 file changed, 1 insertion(+)
configs/qcom_defconfig +1 -0
index a210f4dc5e6..0bd87b1f5a1 100644
@@ -6,6 +6,7 @@ CONFIG_ARCH_SNAPDRAGON=y
  CONFIG_NR_DRAM_BANKS=24
  CONFIG_DEFAULT_DEVICE_TREE="qcom/sdm845-db845c"
  CONFIG_SYS_LOAD_ADDR=0xA0000000
+CONFIG_EFI_PSCI_RESET_RUNTIME=n
  CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y
  CONFIG_EFI_CAPSULE_ON_DISK=y
  CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y