mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] firmware: psci: handle unsupported SET_SUSPEND_MODE in PC mode
@ 2026-10-29 18:16 Patrick Delaunay
  2026-10-30  8:32 ` Sudeep Holla
  0 siblings, 1 reply; 3+ messages in thread
From: Patrick Delaunay @ 2026-10-29 18:16 UTC (permalink / raw)
  To: Mark Rutland, Lorenzo Pieralisi, Sudeep Holla, Ulf Hansson
  Cc: dario.binacchi, Linux STM32, Patrick Delaunay, linux-arm-kernel,
	linux-kernel

The PSCI specification makes PSCI_SET_SUSPEND_MODE optional. If it
returns NOT_SUPPORTED when Linux requests platform-coordinated (PC)
mode, Linux can assume that PC mode is in effect. Treat this response
as success so PSCI power-domain providers can initialize when firmware
does not support OS-initiated (OSI) mode.

Continue to report an error when OSI mode is requested but
SET_SUSPEND_MODE is not supported.

Fixes: 49fdcd7577ef ("firmware: psci: Export functions to manage the OSI mode")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
---
This patch allows to Start Linux kernel with
- device tree using PSCI power domains
- with TF-A BL31 compiled without PSCI OSI support (PSCI_OS_INIT_MODE=0)

For example, since commit
9c8d852dabbd ("arm64: dts: st: add power domain on stm32mp25")

we have errors on STM32MP25 boards with latest TF-A (v2.15.0):

[    0.041800] psci: [Firmware Bug]: failed to set PC mode: -1
[    0.041814] PM: power-domain-retention: unable to remove subdomain power-domain-cluster
[    0.042130] PM: genpd_remove: unable to remove power-domain-cluster
[    0.042313] PM: genpd_remove: unable to remove power-domain-retention
[    0.042455] CPUidle PSCI: failed to create CPU PM domains ret=-95
[    0.042465] psci-cpuidle-domain psci: probe with driver psci-cpuidle-domain failed with error -95

and the associated devices are deferred, for example:

[   10.974374] platform 40130000.i2c: deferred probe pending: platform: wait for supplier /psci/power-domain-cluster

 drivers/firmware/psci/psci.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c
index e73bae6cb23a..610756e81363 100644
--- a/drivers/firmware/psci/psci.c
+++ b/drivers/firmware/psci/psci.c
@@ -167,6 +167,11 @@ int psci_set_osi_mode(bool enable)
 			PSCI_1_0_SUSPEND_MODE_PC;
 
 	err = invoke_psci_fn(PSCI_1_0_FN_SET_SUSPEND_MODE, suspend_mode, 0, 0);
+
+	/* when optional PSCI_SET_SUSPEND_MODE is not supported, assume PC mode */
+	if (err ==  PSCI_RET_NOT_SUPPORTED && !enable)
+		err = 0;
+
 	if (err < 0)
 		pr_info(FW_BUG "failed to set %s mode: %d\n",
 				enable ? "OSI" : "PC", err);
---
base-commit: c339f4010dea8b0d754f84ace70cd1b089878ef8
branch: master

-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-30 10:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-29 18:16 [PATCH] firmware: psci: handle unsupported SET_SUSPEND_MODE in PC mode Patrick Delaunay
2026-10-30  8:32 ` Sudeep Holla
2026-10-30 10:04   ` Patrick DELAUNAY

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®