Linux Serial subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Praveen Talari" <praveen.talari@oss.qualcomm.com>
Cc: linux-serial@vger.kernel.org
Subject: Re: [PATCH v3 6/8] i2c: qcom-geni: Vote for SE clock rate using OPP
Date: Thu, 15 Oct 2026 13:18:35 +0000	[thread overview]
Message-ID: <sashiko-outbox-172909@kernel.org> (raw)
In-Reply-To: <20261015-derive_clk_perf_tbl_from_perf_domain_opp_table-v3-6-5da1096243c9@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] i2c: qcom-geni: missing power_off rollback on opp_set_rate failure in resume
- [High] i2c: qcom-geni: PM state desync on opp_set_rate failure in suspend
- [High] i2c: PM desync in suspend causes unclocked access crash
--

commit e5bbe927d2b6dbf7ee2cdbdeb6104c05147c9959
Author: Praveen Talari <praveen.talari@oss.qualcomm.com>

i2c: qcom-geni: Vote for SE clock rate using OPP
    
The GENI I2C driver selects a source clock based on the requested bus
frequency and programs the corresponding clock selector. However, it
does not request the selected source clock rate when OPP-based clock
scaling is used.
    
Store the matched source clock frequency and vote for it through
dev_pm_opp_set_rate() before programming the clock selector. Also remove
and restore the vote during runtime suspend and resume.

> diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
> index 5f3d260a3913b..a6fe89d0934f6 100644
> --- a/drivers/i2c/busses/i2c-qcom-geni.c
> +++ b/drivers/i2c/busses/i2c-qcom-geni.c

[ ... ]

> @@ -255,6 +257,11 @@ static int qcom_geni_i2c_conf(struct geni_se *se, unsigned long freq)
>  	struct geni_i2c_dev *gi2c = dev_get_drvdata(se->dev);
>  	const struct geni_i2c_clk_fld *itr = gi2c->clk_fld;
>  	u32 val;
> +	int ret;
> +
> +	ret = dev_pm_opp_set_rate(se->dev, gi2c->src_freq);
> +	if (ret)
> +		return ret;
>  
>  	writel_relaxed(gi2c->clk_idx, gi2c->se.base + SE_GENI_CLK_SEL);

[Severity: High]
If dev_pm_opp_set_rate(dev, 0) fails during geni_i2c_runtime_suspend(), the
PM core will leave the device state as RPM_ACTIVE even though the physical
clocks were disabled.

On the next transfer, pm_runtime_resume_and_get() would see RPM_ACTIVE and
skip calling geni_i2c_runtime_resume(). This leads to qcom_geni_i2c_conf()
where dev_pm_opp_set_rate(dev, gi2c->src_freq) succeeds, but writel_relaxed()
is executed while the physical hardware is still unclocked.

Could this sequence trigger a fatal bus error?

[ ... ]

> @@ -1286,7 +1293,7 @@ static int geni_i2c_runtime_suspend(struct device *dev)
>  		}
>  	}
>  
> -	return 0;
> +	return dev_pm_opp_set_rate(dev, 0);

[Severity: High]
If dev_pm_opp_set_rate(dev, 0) fails here, the error is returned to the
runtime PM core. Does this leave the PM core thinking the device is RPM_ACTIVE
while the hardware clocks were already physically turned off by the preceding
gi2c->dev_data->power_off() call?

>  }
>  
>  static int geni_i2c_runtime_resume(struct device *dev)
> @@ -1300,6 +1307,12 @@ static int geni_i2c_runtime_resume(struct device *dev)
>  			return ret;
>  	}
>  
> +	if (gi2c->src_freq) {
> +		ret = dev_pm_opp_set_rate(dev, gi2c->src_freq);
> +		if (ret)
> +			return ret;

[Severity: High]
If dev_pm_opp_set_rate() fails, this returns immediately. Does this skip the
gi2c->dev_data->power_off() rollback and enable_irq() calls, leaving the
hardware resources enabled indefinitely while the PM core marks the device as
RPM_SUSPENDED?

> +	}
> +
>  	enable_irq(gi2c->irq);
>  
>  	return 0;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261015-derive_clk_perf_tbl_from_perf_domain_opp_table-v3-0-5da1096243c9@oss.qualcomm.com?part=6

  reply	other threads:[~2026-10-15 13:18 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15 12:58 [PATCH v3 0/8] soc: qcom: geni: Derive SE clock configuration from OPP table on SA8255P Praveen Talari
2026-10-15 12:58 ` [PATCH v3 1/8] soc: qcom: geni-se: Populate clk_perf_tbl with SE source clock frequencies from perf OPP table Praveen Talari
2026-10-15 13:10   ` sashiko-bot
2026-10-15 12:58 ` [PATCH v3 2/8] soc: qcom: geni-se: Add helper to set SE clock rate via OPP Praveen Talari
2026-10-15 13:06   ` sashiko-bot
2026-10-15 12:58 ` [PATCH v3 3/8] soc: qcom: geni-se: Remove OPP rate reset from resource deactivation Praveen Talari
2026-10-15 13:16   ` sashiko-bot
2026-10-15 12:58 ` [PATCH v3 4/8] serial: qcom-geni: Use geni_se_set_rate() for source clock configuration Praveen Talari
2026-10-15 13:15   ` sashiko-bot
2026-10-15 12:58 ` [PATCH v3 5/8] spi: qcom-geni: Use geni_se_set_rate() for setting source clock frequency Praveen Talari
2026-10-15 13:09   ` sashiko-bot
2026-10-15 12:58 ` [PATCH v3 6/8] i2c: qcom-geni: Vote for SE clock rate using OPP Praveen Talari
2026-10-15 13:18   ` sashiko-bot [this message]
2026-10-15 12:58 ` [PATCH v3 7/8] i2c: qcom-geni: Use common GENI resource initialization helper Praveen Talari
2026-10-15 13:20   ` sashiko-bot
2026-10-15 12:58 ` [PATCH v3 8/8] i2c: qcom-geni: Use geni_se_set_rate() for setting source clock frequency Praveen Talari
2026-10-15 13:24   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-172909@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=praveen.talari@oss.qualcomm.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox