Re: [PATCH v2 1/9] pmdomain: arm: Fix -EINVAL from scmi_pd_set_perf_state() on state 0

[email protected]
Newsgroups gmane.linux.serial
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Returning success for performance state 0 without notifying the SCMI hardware causes a power leak and genpd state desynchronization.
--

commit 2b6c1834f31c5a0d438704d927e8d116c0dd29ad
Author: Praveen Talari <[email protected]>

pmdomain: arm: Fix -EINVAL from scmi_pd_set_perf_state() on state 0

The commit modifies scmi_pd_set_perf_state() to return 0 (success) instead
of -EINVAL when the requested performance state is 0. This change aims to
accommodate the OPP framework which uses state 0 when a device is runtime
suspended.

> diff --git a/drivers/pmdomain/arm/scmi_perf_domain.c b/drivers/pmdomain/arm/scmi_perf_domain.c
> index 3693423459c9c..e390f902a4442 100644
> --- a/drivers/pmdomain/arm/scmi_perf_domain.c
> +++ b/drivers/pmdomain/arm/scmi_perf_domain.c
> @@ -33,7 +33,7 @@ scmi_pd_set_perf_state(struct generic_pm_domain *genpd, unsigned int state)
>  		return 0;
>  
>  	if (!state)
> -		return -EINVAL;
> +		return 0;

[Severity: Medium]
Will this return 0 without notifying the SCMI hardware of the state change?

Since SCMI performance domains are marked with GENPD_FLAG_ALWAYS_ON, they are
never actually powered off. When all devices in the domain suspend and genpd
aggregates the state to 0, it invokes scmi_pd_set_perf_state() with state 0.

If we immediately return 0 here without calling pd->perf_ops->level_set(),
no request is sent to the firmware.

Does this cause the hardware to get stuck at its last requested
high-performance level instead of scaling down, leading to a silent power
leak and a desynchronization between genpd software state and the hardware?

>  
>  	ret = pd->perf_ops->level_set(pd->ph, pd->domain_id, state, false);
>  	if (ret)

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260827-derive_clk_perf_tbl_from_perf_domain_opp_table-v2-0-091697dbeb02@oss.qualcomm.com?part=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.