From: sashiko-bot@kernel.org
To: "Koichiro Den" <den@valinux.co.jp>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v6 4/6] dmaengine: dw-edma: Add delegated channel request helpers
Date: Tue, 04 Aug 2026 03:52:29 +0000 [thread overview]
Message-ID: <20260804035230.538CD1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260804033855.2115817-5-den@valinux.co.jp>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Releasing a single delegated channel with `quiesce=true` on eDMA v0 hardware causes a data race on `engine_en` and incorrectly shuts down the entire DMA direction, disrupting all other local channels.
--
--- Patch [4]: [PATCH v6 4/6] dmaengine: dw-edma: Add delegated channel request helpers ---
commit 0987248b986738e4870e25b1f36d8c9f2eb69d8b
Author: Koichiro Den <den@valinux.co.jp>
dmaengine: dw-edma: Add delegated channel request helpers
This commit adds DesignWare eDMA-specific helpers to request and release
hardware channels for delegation to a remote host. The release helper
supports quiescing the channel before restoring default routing and
releasing the DMAengine reservation.
> diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c
> index 1f893dc54c793..4c0d2bba755b5 100644
> --- a/drivers/dma/dw-edma/dw-edma-core.c
> +++ b/drivers/dma/dw-edma/dw-edma-core.c
[ ... ]
> +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))
[Severity: High]
Does releasing a delegated channel with quiesce set to true unintentionally
disrupt all other active local channels in the same direction?
If an endpoint driver uses some channels locally while delegating others to a
remote host, this call to dw_edma_core_ch_quiesce() appears to escalate to a
direction-wide shutdown on eDMA v0 hardware:
drivers/dma/dw-edma/dw-edma-v0-core.c:dw_edma_v0_core_ch_quiesce() {
...
return dw_edma_v0_core_dir_off(chan->dw, chan->dir);
}
dw_edma_v0_core_dir_off() forcefully masks interrupts for all channels in the
direction and locklessly clears the engine_en register via
dw_edma_v0_core_engine_disable():
drivers/dma/dw-edma/dw-edma-v0-core.c:dw_edma_v0_core_engine_disable() {
...
SET_RW_32(dw, dir, engine_en, 0);
}
Since the per-channel delegation API does not enforce exclusive ownership of
the direction, does this cause a data race and abort ongoing DMA transfers on
unrelated active local channels?
> + dev_warn(chan->dw->chip->dev,
> + "failed to quiesce delegated %s channel %u\n",
> + chan->dir == EDMA_DIR_WRITE ? "write" : "read",
> + chan->id);
> +
> + scoped_guard(spinlock_irqsave, &chan->vc.lock)
> + chan->irq_mode = dw_edma_get_default_irq_mode(chan);
> +
> + dma_release_channel(dchan);
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260804033855.2115817-1-den@valinux.co.jp?part=4
next prev parent reply other threads:[~2026-08-04 3:52 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 3:38 [PATCH v6 0/6] PCI: endpoint: Expose endpoint DMA resources (part 2/3) Koichiro Den
2026-08-04 3:38 ` [PATCH v6 1/6] PCI: endpoint: Define endpoint DMA BAR metadata format Koichiro Den
2026-08-04 3:41 ` sashiko-bot
2026-08-04 15:23 ` Frank Li
2026-08-05 2:03 ` Koichiro Den
2026-08-04 3:38 ` [PATCH v6 2/6] PCI: endpoint: Add DMA auxiliary resource metadata Koichiro Den
2026-08-04 3:41 ` sashiko-bot
2026-08-04 15:26 ` Frank Li
2026-08-04 3:38 ` [PATCH v6 3/6] PCI: endpoint: Add API to delegate EPC DMA channels to the host Koichiro Den
2026-08-04 3:44 ` sashiko-bot
2026-08-04 16:06 ` Frank Li
2026-08-04 3:38 ` [PATCH v6 4/6] dmaengine: dw-edma: Add delegated channel request helpers Koichiro Den
2026-08-04 3:52 ` sashiko-bot [this message]
2026-08-05 2:15 ` Koichiro Den
2026-08-04 16:23 ` Frank Li
2026-08-05 2:05 ` Koichiro Den
2026-08-05 18:47 ` Frank Li
2026-08-06 3:45 ` Koichiro Den
2026-08-06 16:50 ` Frank Li
2026-08-04 3:38 ` [PATCH v6 5/6] PCI: dwc: Implement endpoint DMA channel delegation Koichiro Den
2026-08-04 3:46 ` sashiko-bot
2026-08-04 3:38 ` [PATCH v6 6/6] PCI: dwc: Expose endpoint DMA resources Koichiro Den
2026-08-04 3:54 ` sashiko-bot
2026-08-04 16:29 ` Frank Li
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=20260804035230.538CD1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=den@valinux.co.jp \
--cc=linux-pci@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).