[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<PA4PR04MB9485507CCC21354B5ED55C3792182@PA4PR04MB9485.eurprd04.prod.outlook.com>
Date: Tue, 14 Jan 2025 16:09:13 +0000
From: Ranjani Vaidyanathan <ranjani.vaidyanathan@....com>
To: Sudeep Holla <sudeep.holla@....com>
CC: Peng Fan <peng.fan@....com>, "Peng Fan (OSS)" <peng.fan@....nxp.com>,
"cristian.marussi@....com" <cristian.marussi@....com>,
"ulf.hansson@...aro.org" <ulf.hansson@...aro.org>, "arm-scmi@...r.kernel.org"
<arm-scmi@...r.kernel.org>, "linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, "linux-pm@...r.kernel.org"
<linux-pm@...r.kernel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>
Subject: RE: [EXT] Re: [PATCH] pmdomain: arm: scmi_pm_domain: Initialize state
as off
Hello Sudeep,
Comments below.
Regards,
Ranjani Vaidyanathan
-----Original Message-----
From: Sudeep Holla [mailto:sudeep.holla@....com]
Sent: Tuesday, January 14, 2025 9:24 AM
To: Ranjani Vaidyanathan <ranjani.vaidyanathan@....com>
Cc: Peng Fan <peng.fan@....com>; Peng Fan (OSS) <peng.fan@....nxp.com>; cristian.marussi@....com; Sudeep Holla <sudeep.holla@....com>; ulf.hansson@...aro.org; arm-scmi@...r.kernel.org; linux-arm-kernel@...ts.infradead.org; linux-pm@...r.kernel.org; linux-kernel@...r.kernel.org
Subject: Re: [EXT] Re: [PATCH] pmdomain: arm: scmi_pm_domain: Initialize state as off
Caution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button
Hi Ranjani,
On Mon, Jan 13, 2025 at 07:54:06PM +0000, Ranjani Vaidyanathan wrote:
> Hello Sudeep,
>
> Will try to explain the situation we are facing.
> 1. We have multiple agents running, Agent-A is booted up first before
> Linux is booted and powers up a shared power domain PD-X.
> 2. Linux boots and gets the power state of PD-X. And its already ON.
> And then PD -X is initialized with a default ON state.
> 3. When the driver that needs PD-X is probed, Linux sees that the
> power domain status is ON and never makes an SCMI call to power up the
> PD-X for Linux Agent.
> 4. Agent-A now is shutdown/suspends. Linux will crash because the
> platform disables PD-X because it has no other requests for PD-X.
>
Thanks for the detailed explanation. I understand the issue now.
I would like to discuss if the below alternative approach works for you.
We can debate the pros and cons. I see with the approach in this patch proposed by Peng we would avoid querying and setting genpd all together during the genpd initialisation which is good. But if there are any genpd left on by the platform or bootloader(same agent), it will not get turned off when Linux tries to turn off the unused genpds(IIRC this could be the reason for the current state of code). While your platform may find sending those commands unnecessary, there was some usecase where SCMI platform kept all resources ON by default for faster boot and expects OSPM to turn off unused resources. So we need to support both the cases. I hope my below patch should suffice.
[RV] Linux can still make the call to disable unused power domains, even if it never explicitly made a request to power it on. The platform will aggregate the request from all agents and will power off the resource if no other agent has enabled it. From Linux point of view it has disabled all unused power domains.
Your patch below may also work, but feels like a workaround to artificially (for lack of a better word) enable a resource. And also makes unnecessary SCMI calls (expensive) for every resource immaterial of it power state (maybe can be improved by a conditional check).
Regards,
Sudeep
---->8
>From dc755fa02d351e71c727da1c396e2d346b496096 Mon Sep 17 00:00:00 2001
From: Sudeep Holla <sudeep.holla@....com>
Date: Tue, 14 Jan 2025 15:08:44 +0000
Subject: [PATCH] pmdomain: arm: scmi_pm_domain: Send an explicit request to set the current state
On a system with multiple active SCMI agents, one agent(other than OSPM/ Linux or bootloader) would request to turn on a shared power domain before the Linux boots/initialise the genpds. So when the Linux boots and gets the power state as already ON, it just registers the genpd with a default ON state.
However, when the driver that needs this shared power domain is probed genpd 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 request 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 powered ON requests to power it OFF as it no longer needs it, the SCMI platform firmware needs to turn it off if there are no active users of it which in the 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 genpds as default OFF, but it can't handle the scenario on certain platforms where SCMI platform keeps all the power domains turned ON by default for faster boot and expect the OSPM to turn off the unused domains if power saving is required.
Signed-off-by: Sudeep Holla <sudeep.holla@....com>
---
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/scmi_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 = i;
scmi_pd->ph = ph;
scmi_pd->name = power_ops->name_get(ph, i);
--
2.34.1
Powered by blists - more mailing lists