[PATCH] pmdomain: arm: scmi_pm_domain: Send an explicit request to= set the current state
From: Sudeep Holla
Date: Tue Jan 14 2025 - 10:08:44 EST
On a system with multiple active SCMI agents, one agent(other than OSPM/ Li=
nux or bootloader) would request to turn on a shared power domain before th=
e Linux boots/initialise the genpds. So when the Linux boots and gets the p=
ower state as already ON, it just registers the genpd with a default ON sta=
te.
However, when the driver that needs this shared power domain is probed genp=
d sees that the power domain status is ON and never makes any SCMI call to =
power it up which is correct. But, since Linux didn't make an explicit requ=
est to turn on the shared power domain, the SCMI platform firmware will not=
know if the OSPM agent is actively using it.
Suppose the other agent that requested the shared power domain to be powere=
d ON requests to power it OFF as it no longer needs it, the SCMI platform f=
irmware needs to turn it off if there are no active users of it which in th=
e above scenaro is the case.
As a result of SCMI platform firmware turning off the resource, OSPM/ Linux=
will crash the moment as it expects the shared power domain to be powered =
ON.
Send an explicit request to set the current state when setting up the genpd=
power domains. The other option is to not read the state and set the genpd=
s as default OFF, but it can't handle the scenario on certain platforms whe=
re SCMI platform keeps all the power domains turned ON by default for faste=
r boot and expect the OSPM to turn off the unused domains if power saving i=
s required.
Signed-off-by: Sudeep Holla <sudeep.holla@xxxxxxx>
---
drivers/pmdomain/arm/scmi_pm_domain.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/pmdomain/arm/scmi_pm_domain.c b/drivers/pmdomain/arm/s=
cmi_pm_domain.c
index a7784a8bb5db..255c8c36a15c 100644
--- a/drivers/pmdomain/arm/scmi_pm_domain.c
+++ b/drivers/pmdomain/arm/scmi_pm_domain.c
@@ -96,6 +96,8 @@ static int scmi_pm_domain_probe(struct scmi_device *sdev)
continue;
}
+ power_ops->state_set(ph, i, state);
+
scmi_pd->domain =3D i;
scmi_pd->ph =3D ph;
scmi_pd->name =3D power_ops->name_get(ph, i);
--
2.34.1