Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Yemike Abhilash Chandra" <y-abhilashchandra@ti.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org,
	imx@lists.linux.dev, Frank.Li@kernel.org
Subject: Re: [PATCH v2 05/18] arm64: dts: ti: k3-am62p-j722s: Add multiple channels for CSI2RX DMA
Date: Mon, 13 Jul 2026 11:49:28 +0000	[thread overview]
Message-ID: <20260713114929.604271F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260713113423.2310443-6-y-abhilashchandra@ti.com>

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

New issues:
- [Medium] Incomplete multistream implementation for J722S SoC: missing DMA channels for CSI2RX instances 1, 2, and 3.

Pre-existing issues:
- [High] The driver j721e-csi2rx.c leaks DMA channels on probe error, remove, and runtime_resume.
--

--- Patch [5]: [PATCH v2 05/18] arm64: dts: ti: k3-am62p-j722s: Add multiple channels for CSI2RX DMA ---
commit 57c14c001a8a9799dd013f93cc44d67678cdb58d
Author: Vaishnav Achath <vaishnav.a@ti.com>

arm64: dts: ti: k3-am62p-j722s: Add multiple channels for CSI2RX DMA
    
J721E CSI2RX SHIM layer can support up to 32 DMA channel contexts. This patch
adds additional DMA channels to enable multistream support for CSI2RX.

> diff --git a/arch/arm64/boot/dts/ti/k3-am62p-j722s-common-main.dtsi b/arch/arm64/boot/dts/ti/k3-am62p-j722s-common-main.dtsi
> index f130c7cb998d7..ecb537b96fcaa 100644
> --- a/arch/arm64/boot/dts/ti/k3-am62p-j722s-common-main.dtsi
> +++ b/arch/arm64/boot/dts/ti/k3-am62p-j722s-common-main.dtsi
> @@ -1053,8 +1053,10 @@ ti_csi2rx0: ticsi2rx@30102000 {
>  		ranges;
>  		#address-cells = <2>;
>  		#size-cells = <2>;
> -		dmas = <&main_bcdma_csi 0 0x5000 0>;
> -		dma-names = "rx0";
> +		dmas = <&main_bcdma_csi 0 0x5000 0>, <&main_bcdma_csi 0 0x5001 0>,
> +		       <&main_bcdma_csi 0 0x5002 0>, <&main_bcdma_csi 0 0x5003 0>,
> +		       <&main_bcdma_csi 0 0x5004 0>, <&main_bcdma_csi 0 0x5005 0>;
> +		dma-names = "rx0", "rx1", "rx2", "rx3", "rx4", "rx5";

[Severity: High]
This isn't a bug introduced by this patch, but increasing the number of DMA
channels here heavily amplifies a channel leak in the j721e-csi2rx.c driver.

When probe fails after channels are requested, ti_csi2rx_cleanup_ctx() checks
the PM runtime status:

drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c:ti_csi2rx_cleanup_ctx() {
        if (!pm_runtime_status_suspended(ctx->csi->dev))
                dma_release_channel(ctx->dma.chan);
}

Since the PM status is default suspended during a probe failure, the channels
are never released.

Similarly, during driver removal, the driver calls pm_runtime_set_suspended()
before cleaning up contexts, causing the same leak for active devices:

drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c:ti_csi2rx_remove() {
        if (!pm_runtime_status_suspended(&pdev->dev))
                pm_runtime_set_suspended(&pdev->dev);

        for (unsigned int i = 0; i < csi->num_ctx; i++)
                ti_csi2rx_cleanup_ctx(&csi->ctx[i]);
}

Finally, by increasing the context count to 6 here, this activates a mid-loop
failure path in ti_csi2rx_runtime_resume() that was impossible with 1 channel:

drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c:ti_csi2rx_runtime_resume() {
        for (unsigned int i = 0; i < csi->num_ctx; i++) {
                ret = ti_csi2rx_init_dma(&csi->ctx[i]);
                if (ret)
                        return ret;
        }
}

If ti_csi2rx_init_dma() fails at i=1, does this return without releasing the
channel successfully requested at i=0? Would it be possible to address these
leaks in the driver prior to or alongside expanding the channel counts in
the DT?

[Severity: Medium]
Are there missing multistream DMA channel definitions for the other CSI2RX
instances?

The J722S SoC has four identical instances (ti_csi2rx0 through ti_csi2rx3).
While this updates ti_csi2rx0 in k3-am62p-j722s-common-main.dtsi, the other
instances in k3-j722s-main.dtsi appear to still only have one DMA context:

arch/arm64/boot/dts/ti/k3-j722s-main.dtsi:ti_csi2rx1() {
        ...
        dmas = <&main_bcdma_csi 0 0x5100 0>;
        dma-names = "rx0";
        ...
}

If a user connects a multistream camera to CSI ports 1, 2, or 3, will they
be prevented from using multistream capture because rx1 through rx5 are not
defined? Should instances 1 through 3 be updated to match ti_csi2rx0?

>  		power-domains = <&k3_pds 182 TI_SCI_PD_EXCLUSIVE>;
>  		status = "disabled";

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260713113423.2310443-1-y-abhilashchandra@ti.com?part=5

  reply	other threads:[~2026-07-13 11:49 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-13 11:34 [PATCH v2 00/18] Add DT support for CSI2RX multi-stream Yemike Abhilash Chandra
2026-07-13 11:34 ` [PATCH v2 01/18] arm64: dts: ti: k3-{j721e/j721s2}-main: Fix indentation in CSI2RX node Yemike Abhilash Chandra
2026-07-13 11:34 ` [PATCH v2 02/18] arm64: dts: ti: k3-j721e-main: Add multiple channels for CSI2RX DMA Yemike Abhilash Chandra
2026-07-13 11:47   ` sashiko-bot
2026-07-13 11:34 ` [PATCH v2 03/18] arm64: dts: ti: k3-j721s2-main: " Yemike Abhilash Chandra
2026-07-13 11:48   ` sashiko-bot
2026-07-13 11:34 ` [PATCH v2 04/18] arm64: dts: ti: k3-j784s4-j742s2-main-common: " Yemike Abhilash Chandra
2026-07-13 11:50   ` sashiko-bot
2026-07-13 11:34 ` [PATCH v2 05/18] arm64: dts: ti: k3-am62p-j722s: " Yemike Abhilash Chandra
2026-07-13 11:49   ` sashiko-bot [this message]
2026-07-13 11:34 ` [PATCH v2 06/18] arm64: dts: ti: k3-j722s-main: " Yemike Abhilash Chandra
2026-07-13 11:34 ` [PATCH v2 07/18] arm64: dts: ti: k3-j721e: Add overlay for fusion application daughter board Yemike Abhilash Chandra
2026-07-13 11:34 ` [PATCH v2 08/18] arm64: dts: ti: k3-j721s2: " Yemike Abhilash Chandra
2026-07-13 11:34 ` [PATCH v2 09/18] arm64: dts: ti: k3-j721e-sk: " Yemike Abhilash Chandra
2026-07-13 11:34 ` [PATCH v2 10/18] arm64: dts: ti: k3-j722s-evm: " Yemike Abhilash Chandra
2026-07-13 11:34 ` [PATCH v2 11/18] arm64: dts: ti: k3-am68-sk: Add overlay for dual Arducam V3link fusion Yemike Abhilash Chandra
2026-07-13 11:47   ` sashiko-bot
2026-07-13 11:34 ` [PATCH v2 12/18] arm64: dts: ti: k3-j722s-evm: " Yemike Abhilash Chandra
2026-07-13 11:45   ` sashiko-bot
2026-07-13 11:34 ` [PATCH v2 13/18] arm64: dts: ti: k3-j784s4-evm: Add overlay for J7EXPA01EVM Fusion2 Yemike Abhilash Chandra
2026-07-13 11:45   ` sashiko-bot
2026-07-13 11:34 ` [PATCH v2 14/18] arm64: dts: ti: k3-j722s-evm: " Yemike Abhilash Chandra
2026-07-13 11:47   ` sashiko-bot
2026-07-13 11:34 ` [PATCH v2 15/18] arm64: dts: ti: k3-j721s2: Add overlay for DS90UB954-Q1EVM Yemike Abhilash Chandra
2026-07-13 11:34 ` [PATCH v2 16/18] arm64: dts: ti: k3-j721e: " Yemike Abhilash Chandra
2026-07-13 11:34 ` [PATCH v2 17/18] arm64: dts: ti: k3-v3link: Add overlay for IMX219+UB953 serializer Yemike Abhilash Chandra
2026-07-13 11:34 ` [PATCH v2 18/18] arm64: defconfig: Enable DS90UB960 deserializer and DS90UB953 serializer Yemike Abhilash Chandra

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=20260713114929.604271F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=y-abhilashchandra@ti.com \
    /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