RE: [EXT] Re: [PATCH] pmdomain: arm: scmi_pm_domain: Initialize state as off
From: Ranjani Vaidyanathan
Date: Tue Jan 14 2025 - 11:09:37 EST
Hello Sudeep,
Comments below.
Regards,
Ranjani Vaidyanathan
-----Original Message-----
From: Sudeep Holla [mailto:sudeep.holla@xxxxxxx]
Sent: Tuesday, January 14, 2025 9:24 AM
To: Ranjani Vaidyanathan <ranjani.vaidyanathan@xxxxxxx>
Cc: Peng Fan <peng.fan@xxxxxxx>; Peng Fan (OSS) <peng.fan@xxxxxxxxxxx>; cristian.marussi@xxxxxxx; Sudeep Holla <sudeep.holla@xxxxxxx>; ulf.hansson@xxxxxxxxxx; arm-scmi@xxxxxxxxxxxxxxx; linux-arm-kernel@xxxxxxxxxxxxxxxxxxx; linux-pm@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
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