All of lore.kernel.org
 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 7/8] i2c: qcom-geni: Use common GENI resource initialization helper
Date: Thu, 15 Oct 2026 13:20:10 +0000	[thread overview]
Message-ID: <sashiko-outbox-172924@kernel.org> (raw)
In-Reply-To: <20261015-derive_clk_perf_tbl_from_perf_domain_opp_table-v3-7-5da1096243c9@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] i2c: qcom-geni: uninitialized src_freq bypasses OPP vote before hw access
- [High] i2c: qcom-geni: severe lock contention by calling icc_set_bw per-transfer
- [Medium] i2c: qcom-geni: leak of GPI DMA channels on clk map error path
--

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

i2c: qcom-geni: Use common GENI resource initialization helper

This commit replaces a custom resource initialization callback with
geni_se_resources_init(). It moves clock frequency validation and ICC
bandwidth vote programming to probe and qcom_geni_i2c_conf() respectively.

> diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
> index a6fe89d0934f6..dbe344719b86c 100644
> --- a/drivers/i2c/busses/i2c-qcom-geni.c
> +++ b/drivers/i2c/busses/i2c-qcom-geni.c
> @@ -275,7 +275,9 @@ static int qcom_geni_i2c_conf(struct geni_se *se, unsigned long freq)
>  	trace_geni_i2c_bus_setup(gi2c->se.dev, gi2c->clk_freq_out,
>  				 itr->clk_div, itr->t_high_cnt,
>  				 itr->t_low_cnt, itr->t_cycle_cnt);
> -	return 0;
> +
> +	return geni_icc_set_bw_ab(&gi2c->se, GENI_DEFAULT_BW, GENI_DEFAULT_BW,
> +				  Bps_to_icc(gi2c->clk_freq_out));
>  }

[Severity: High]
Could this introduce severe lock contention?

The geni_i2c_xfer() handler invokes this configuration function on every batch
of messages. Moving geni_icc_set_bw_ab() into qcom_geni_i2c_conf() means
icc_set_bw() is now called on every I2C transfer.

Because icc_set_bw() unconditionally acquires the global icc_bw_lock mutex
and iterates through interconnect nodes, will this rapidly acquire and
release a global interconnect lock during normal I2C operations, throttling
the rest of the system?

[ ... ]

> @@ -1251,6 +1237,11 @@ static int geni_i2c_probe(struct platform_device *pdev)
>  	if (ret < 0)
>  		return ret;
>  
> +	ret = geni_i2c_clk_map_idx(gi2c);

[Severity: High]
Does moving geni_i2c_clk_map_idx() after geni_i2c_init() leave gi2c->src_freq
uninitialized when hardware is first accessed?

When geni_i2c_init() calls pm_runtime_resume_and_get(), it triggers
geni_i2c_runtime_resume() which checks gi2c->src_freq:

	if (gi2c->src_freq) {
		ret = dev_pm_opp_set_rate(dev, gi2c->src_freq);
		if (ret)
			return ret;
	}

Because gi2c->src_freq is 0 at this point, the OPP performance state vote is
silently bypassed. geni_i2c_init() then immediately accesses hardware registers.
On Qualcomm platforms, could this un-voted access result in a NoC timeout or
system crash?

> +	if (ret)
> +		return dev_err_probe(gi2c->se.dev, ret, "Invalid clk frequency %d Hz\n",
> +				     gi2c->clk_freq_out);

[Severity: Medium]
Does this path leak the GPI DMA channels?

geni_i2c_init() allocates RX and TX channels via setup_gpi_dma() when the
device is in GPI mode. When geni_i2c_clk_map_idx() fails here, we return
the error directly without calling release_gpi_dma() to clean up the
allocated channels, unlike the i2c_add_adapter() error path directly below it.

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

  reply	other threads:[~2026-10-15 13:20 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
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 [this message]
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-172924@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 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.