Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Koichiro Den" <den@valinux.co.jp>
Cc: linux-pci@vger.kernel.org, Frank.Li@kernel.org,
	dmaengine@vger.kernel.org, vkoul@kernel.org
Subject: Re: [PATCH v4 5/6] dmaengine: dw-edma: Add delegated channel request helpers
Date: Fri, 10 Jul 2026 10:43:52 +0000	[thread overview]
Message-ID: <20260710104352.C9D671F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260710082156.2395844-6-den@valinux.co.jp>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Critical] The patch references nonexistent constants, functions, and struct fields, which will cause an immediate compilation failure.
- [Medium] The `irq_mode` field is modified without holding `chan->vc.lock` during channel release, violating the locking discipline established during delegation.
--

--- Patch [5]: [PATCH v4 5/6] dmaengine: dw-edma: Add delegated channel request helpers ---
commit 15a8e802b8e938899858a00862b359f85ce5f547
Author: Koichiro Den <den@valinux.co.jp>

dmaengine: dw-edma: Add delegated channel request helpers

This commit adds DW eDMA-specific helpers that request a write/read
hardware channel through DMAengine. It switches the selected endpoint-local
channel to remote interrupt routing after reservation, and restores default
routing upon release.

> diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c
> index 89a4c498a17b8..cbf6f539d4369 100644
> --- a/drivers/dma/dw-edma/dw-edma-core.c
> +++ b/drivers/dma/dw-edma/dw-edma-core.c
[ ... ]
> @@ -1178,6 +1178,92 @@ int dw_edma_remove(struct dw_edma_chip *chip)
[ ... ]
> +static int dw_edma_delegate_chan(struct dma_chan *dchan)
> +{
> +	struct dw_edma_chan *chan = dchan2dw_edma_chan(dchan);
> +	unsigned long flags;
> +	int ret = 0;
> +
> +	if (!(chan->dw->chip->flags & DW_EDMA_CHIP_LOCAL))
> +		return -EINVAL;
> +
> +	spin_lock_irqsave(&chan->vc.lock, flags);
> +	if (chan->configured || chan->status != EDMA_ST_IDLE ||
> +	    chan->request != EDMA_REQ_NONE)
> +		ret = -EBUSY;
> +	else
> +		chan->irq_mode = DW_EDMA_CH_IRQ_REMOTE;

[Severity: Critical]
Are we missing a prerequisite patch in this series? The field irq_mode does
not seem to exist in struct dw_edma_chan, and the DW_EDMA_CH_IRQ_REMOTE
macro appears to be undefined, which will cause a build regression here.

> +	spin_unlock_irqrestore(&chan->vc.lock, flags);
> +
> +	return ret;
> +}
[ ... ]
> +void dw_edma_release_delegated_chan(struct dma_chan *dchan, bool quiesce)
> +{
> +	struct dw_edma_chan *chan;
> +
> +	if (!dchan)
> +		return;
> +
> +	chan = dchan2dw_edma_chan(dchan);
> +	if (quiesce)
> +		dw_edma_core_ch_quiesce(chan);
> +	chan->irq_mode = dw_edma_get_default_irq_mode(chan);

[Severity: Critical]
Are there missing prerequisites for this code as well? 
dw_edma_core_ch_quiesce() and dw_edma_get_default_irq_mode() appear to be
undeclared functions in this tree.

[Severity: Medium]
Does chan->irq_mode need to be protected by chan->vc.lock here?

In dw_edma_delegate_chan() above, chan->irq_mode is modified while holding
the chan->vc.lock. Here, it is modified locklessly. 

If quiesce is false, could an ongoing interrupt handler concurrently read
irq_mode while it is being restored?

> +	dma_release_channel(dchan);
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260710082156.2395844-1-den@valinux.co.jp?part=5

  reply	other threads:[~2026-07-10 10:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-10  8:21 [PATCH v4 0/6] PCI: endpoint: Expose endpoint DMA resources (part 2/3) Koichiro Den
2026-07-10  8:21 ` [PATCH v4 1/6] PCI: endpoint: Define endpoint DMA BAR metadata format Koichiro Den
2026-07-10  8:24   ` sashiko-bot
2026-07-10  8:21 ` [PATCH v4 2/6] PCI: endpoint: Add DMA auxiliary resource metadata Koichiro Den
2026-07-10  8:27   ` sashiko-bot
2026-07-10  8:21 ` [PATCH v4 3/6] PCI: endpoint: Add API to delegate EPC DMA channels to the host Koichiro Den
2026-07-10  8:32   ` sashiko-bot
2026-07-10  8:21 ` [PATCH v4 4/6] PCI: dwc: Expose endpoint DMA resources Koichiro Den
2026-07-10  8:29   ` sashiko-bot
2026-07-10  8:21 ` [PATCH v4 5/6] dmaengine: dw-edma: Add delegated channel request helpers Koichiro Den
2026-07-10 10:43   ` sashiko-bot [this message]
2026-07-10  8:21 ` [PATCH v4 6/6] PCI: dwc: Implement endpoint DMA channel delegation Koichiro Den
2026-07-10  8:30   ` 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=20260710104352.C9D671F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=den@valinux.co.jp \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vkoul@kernel.org \
    /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