Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Icenowy Zheng" <zhengxingda@iscas.ac.cn>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH 3/6] arm64: dts: qcom: sc8280xp-lenovo-thinkpad-x13s: set GPI DMA channels
Date: Tue, 02 Jun 2026 08:42:24 +0000	[thread overview]
Message-ID: <20260602084225.13E201F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260602081451.3808833-4-zhengxingda@iscas.ac.cn>

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

Pre-existing issues:
- [High] Incorrect channel reference in error cleanup path of gpi_ch_init causes resource leaks and hardware state inconsistency.
--

commit de0b4a765a18a5d7af04a98b890d09dd31cb2362
Author: Icenowy Zheng <zhengxingda@iscas.ac.cn>

arm64: dts: qcom: sc8280xp-lenovo-thinkpad-x13s: set GPI DMA channels

This commit adds GPI interface availability information to the device tree by
setting the dma-channel-mask and marking the status as okay. This ensures
that HLOS does not touch restricted GPI interfaces, preventing system hangs.

> diff --git a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> index d84ca010ab9dc..119eeb1560e16 100644
> --- a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> +++ b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> @@ -704,14 +704,17 @@ &dispcc0 {
>  };
>  
>  &gpi_dma0 {
> +	dma-channel-mask = <0x3>;

[Severity: High]
This is a pre-existing issue, but since this patch enables GPI DMA interfaces
that might fail to initialize, it could expose an error cleanup bug in the
GPI driver itself.

Looking at the error paths in drivers/dma/qcom/gpi.c:gpi_ch_init():

    error_start_chan:
        for (i = i - 1; i >= 0; i--) {
            gpi_stop_chan(&gpii->gchan[i]);
            gpi_send_cmd(gpii, gchan, GPI_CH_CMD_RESET);
        }
        i = 2;
    error_alloc_chan:
        for (i = i - 1; i >= 0; i--)
            gpi_reset_chan(gchan, GPI_CH_CMD_DE_ALLOC);

Are these loops referencing the correct channel during cleanup?

By using the fixed function argument gchan instead of the iterated channel
&gpii->gchan[i] in gpi_send_cmd() and gpi_reset_chan(), it appears this path
would repeatedly issue reset and de-alloc commands to the same fixed channel
while entirely skipping the cleanup for the successfully allocated or started
channels.

Could this leak the previously initialized DMA channels and leave their
hardware state active, potentially causing hardware lockups?

>  	status = "okay";
>  };

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260602081451.3808833-1-zhengxingda@iscas.ac.cn?part=3

  reply	other threads:[~2026-06-02  8:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-02  8:14 [PATCH 0/6] arm64: dts: qcom: sc8280xp: set GPI DMA channels according to DSDT Icenowy Zheng
2026-06-02  8:14 ` [PATCH 1/6] arm64: dts: qcom: sc8280xp-crd: set GPI DMA channels Icenowy Zheng
2026-06-02  8:14 ` [PATCH 2/6] arm64: dts: qcom: sc8280xp-huawei-gaokun3: " Icenowy Zheng
2026-06-02  8:14 ` [PATCH 3/6] arm64: dts: qcom: sc8280xp-lenovo-thinkpad-x13s: " Icenowy Zheng
2026-06-02  8:42   ` sashiko-bot [this message]
2026-06-02  8:14 ` [PATCH 4/6] arm64: dts: qcom: sc8280xp-microsoft-arcata: " Icenowy Zheng
2026-06-02  8:14 ` [PATCH 5/6] arm64: dts: qcom: sc8280xp-microsoft-blackrock: " Icenowy Zheng
2026-06-02  8:14 ` [PATCH 6/6] arm64: dts: qcom: sc8280xp: remove GPI DMA channel masks Icenowy Zheng
2026-06-02  9:01   ` sashiko-bot
2026-06-02 12:53 ` [PATCH 0/6] arm64: dts: qcom: sc8280xp: set GPI DMA channels according to DSDT Pengyu Luo
2026-06-02 13:21   ` Icenowy Zheng

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=20260602084225.13E201F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=zhengxingda@iscas.ac.cn \
    /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