All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clk: qcom: smd-rpm: Skip proxy votes on clocks for QCM2290
@ 2026-09-10 13:44 Imran Shaik
  2026-09-10 13:53 ` sashiko-bot
  2026-09-11  9:06 ` Konrad Dybcio
  0 siblings, 2 replies; 3+ messages in thread
From: Imran Shaik @ 2026-09-10 13:44 UTC (permalink / raw)
  To: Bjorn Andersson, Stephen Boyd, Brian Masney, Jerome Brunet,
	Rob Herring, Georgi Djakov
  Cc: Ajit Pandey, Taniya Das, Jagadeesh Kona, Stephen Boyd,
	linux-arm-msm, linux-clk, linux-kernel, Imran Shaik

clk_smd_rpm_handoff() votes both active and sleep RPM resource states for
every clock, keeping them non-zero until a consumer takes over. If there
is no consumer, those clocks will remain active in the idle scenario as
well, and the sleep vote is never cleared, blocking XO shutdown.

Introduce the skip_clks_handoff flag to handle this on QCM2290 clocks,
keeping other targets unaffected.

Fixes: 00f64b58874e ("clk: qcom: Add support for SMD-RPM Clocks")
Signed-off-by: Imran Shaik <imran.shaik@oss.qualcomm.com>
---
This patch is dependent on [1], as crypto driver earlier was surviving on
the proxy votes on Qualcomm Shikra SoC and dropping the proxy votes will
impact the bootup. Now patch series [1] takes care of the resource
voting from the crypto driver side.

[1] https://lore.kernel.org/linux-arm-msm/20260907-b4-shikra_crypto_changse-v6-0-0676f61894b3@oss.qualcomm.com/
---
 drivers/clk/qcom/clk-smd-rpm.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/clk/qcom/clk-smd-rpm.c b/drivers/clk/qcom/clk-smd-rpm.c
index 487d715ed5d2..b78c8cc730b5 100644
--- a/drivers/clk/qcom/clk-smd-rpm.c
+++ b/drivers/clk/qcom/clk-smd-rpm.c
@@ -183,6 +183,7 @@ struct rpm_smd_clk_desc {
 	const struct clk_smd_rpm ** const icc_clks;
 	size_t num_icc_clks;
 	bool scaling_before_handover;
+	bool skip_clks_handoff;
 };
 
 static DEFINE_MUTEX(rpm_smd_clk_lock);
@@ -1280,7 +1281,8 @@ static const struct rpm_smd_clk_desc rpm_clk_qcm2290 = {
 	.clks = qcm2290_clks,
 	.num_clks = ARRAY_SIZE(qcm2290_clks),
 	.icc_clks = qcm2290_icc_clks,
-	.num_icc_clks = ARRAY_SIZE(qcm2290_icc_clks)
+	.num_icc_clks = ARRAY_SIZE(qcm2290_icc_clks),
+	.skip_clks_handoff = true,
 };
 
 static const struct of_device_id rpm_smd_clk_match_table[] = {
@@ -1358,13 +1360,15 @@ static int rpm_smd_clk_probe(struct platform_device *pdev)
 			goto err;
 	}
 
-	for (i = 0; i < num_clks; i++) {
-		if (!rpm_smd_clks[i])
-			continue;
+	if (!desc->skip_clks_handoff) {
+		for (i = 0; i < num_clks; i++) {
+			if (!rpm_smd_clks[i])
+				continue;
 
-		ret = clk_smd_rpm_handoff(rpm_smd_clks[i]);
-		if (ret)
-			goto err;
+			ret = clk_smd_rpm_handoff(rpm_smd_clks[i]);
+			if (ret)
+				goto err;
+		}
 	}
 
 	for (i = 0; i < desc->num_icc_clks; i++) {

---
base-commit: c68a982815dcce5464e3bf2a31ac94f5146c04ca
change-id: 20260909-clk-smd-rpm-skip-proxy-7725549ea74d
prerequisite-change-id: 20260701-b4-shikra_crypto_changse-f2d6d5bf04b5:v6
prerequisite-patch-id: e24447d3ab70f48b099251c3d6c1307e0aee9d2c
prerequisite-patch-id: 64e9302a1de7a654ffa65af12daff3866531a00c

Best regards,
--  
Imran Shaik <imran.shaik@oss.qualcomm.com>


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

* Re: [PATCH] clk: qcom: smd-rpm: Skip proxy votes on clocks for QCM2290
  2026-09-10 13:44 [PATCH] clk: qcom: smd-rpm: Skip proxy votes on clocks for QCM2290 Imran Shaik
@ 2026-09-10 13:53 ` sashiko-bot
  2026-09-11  9:06 ` Konrad Dybcio
  1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-09-10 13:53 UTC (permalink / raw)
  To: Imran Shaik; +Cc: linux-clk

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] `clk_smd_rpm_set_rate` silently ignores rate updates when the clock is disabled, leading to incorrect hardware state upon enable.
--

commit 8065b2a650b0e543b5eb4069b2bca8805e5bbb71
Author: Imran Shaik <imran.shaik@oss.qualcomm.com>

    clk: qcom: smd-rpm: Skip proxy votes on clocks for QCM2290
    
    clk_smd_rpm_handoff() votes both active and sleep RPM resource states for
    every clock, keeping them non-zero until a consumer takes over. If there
    is no consumer, those clocks will remain active in the idle scenario as
    well, and the sleep vote is never cleared, blocking XO shutdown.
    
    Introduce the skip_clks_handoff flag to handle this on QCM2290 clocks,
    keeping other targets unaffected.

> diff --git a/drivers/clk/qcom/clk-smd-rpm.c b/drivers/clk/qcom/clk-smd-rpm.c
> index 487d715ed5d21..b78c8cc730b59 100644
> --- a/drivers/clk/qcom/clk-smd-rpm.c
> +++ b/drivers/clk/qcom/clk-smd-rpm.c

[ ... ]

> @@ -1358,13 +1360,15 @@ static int rpm_smd_clk_probe(struct platform_device *pdev)
>  			goto err;
>  	}
>  
> -	for (i = 0; i < num_clks; i++) {
> -		if (!rpm_smd_clks[i])
> -			continue;
> +	if (!desc->skip_clks_handoff) {
> +		for (i = 0; i < num_clks; i++) {
> +			if (!rpm_smd_clks[i])
> +				continue;
>  
> -		ret = clk_smd_rpm_handoff(rpm_smd_clks[i]);
> -		if (ret)
> -			goto err;
> +			ret = clk_smd_rpm_handoff(rpm_smd_clks[i]);
> +			if (ret)
> +				goto err;
> +		}
>  	}
>  

[Severity: High]
This isn't a bug introduced by this patch, but I noticed a potential issue in
how rate updates are handled for disabled clocks. In clk_smd_rpm_set_rate():

drivers/clk/qcom/clk-smd-rpm.c:clk_smd_rpm_set_rate() {
	...
	if (!r->enabled)
		return 0;
	...
	r->rate = rate;

	return 0;
}

If a consumer calls clk_set_rate() on a disabled clock and then calls
clk_prepare_enable(), doesn't the early return in clk_smd_rpm_set_rate() skip
saving the requested rate?

Since r->rate = rate is bypassed, wouldn't the subsequent enable operation
transmit the stale initialization rate to the RPM hardware instead of the newly
requested rate?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260910-clk-smd-rpm-skip-proxy-v1-1-1cb5694a99d9@oss.qualcomm.com?part=1

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

* Re: [PATCH] clk: qcom: smd-rpm: Skip proxy votes on clocks for QCM2290
  2026-09-10 13:44 [PATCH] clk: qcom: smd-rpm: Skip proxy votes on clocks for QCM2290 Imran Shaik
  2026-09-10 13:53 ` sashiko-bot
@ 2026-09-11  9:06 ` Konrad Dybcio
  1 sibling, 0 replies; 3+ messages in thread
From: Konrad Dybcio @ 2026-09-11  9:06 UTC (permalink / raw)
  To: Imran Shaik, Bjorn Andersson, Stephen Boyd, Brian Masney,
	Jerome Brunet, Rob Herring, Georgi Djakov
  Cc: Ajit Pandey, Taniya Das, Jagadeesh Kona, Stephen Boyd,
	linux-arm-msm, linux-clk, linux-kernel

On 9/10/26 3:44 PM, Imran Shaik wrote:
> clk_smd_rpm_handoff() votes both active and sleep RPM resource states for
> every clock, keeping them non-zero until a consumer takes over. If there
> is no consumer, those clocks will remain active in the idle scenario as
> well, and the sleep vote is never cleared, blocking XO shutdown.
> 
> Introduce the skip_clks_handoff flag to handle this on QCM2290 clocks,
> keeping other targets unaffected.
> 
> Fixes: 00f64b58874e ("clk: qcom: Add support for SMD-RPM Clocks")
> Signed-off-by: Imran Shaik <imran.shaik@oss.qualcomm.com>
> ---

Are you booting with clk_ignore_unused?

Konrad

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

end of thread, other threads:[~2026-09-11  9:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-10 13:44 [PATCH] clk: qcom: smd-rpm: Skip proxy votes on clocks for QCM2290 Imran Shaik
2026-09-10 13:53 ` sashiko-bot
2026-09-11  9:06 ` Konrad Dybcio

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.