Re: [PATCH v6 4/6] dmaengine: dw-edma: Add delegated channel request helpers
[email protected] Tue, 04 Aug 2026 03:52:29 +0000
| Newsgroups | org.kernel.vger.linux-pci |
|---|---|
| Message-ID | <[email protected]> |
Thank you for your contribution! Sashiko AI review found 1 potential issue(= s) to consider: - [High] Releasing a single delegated channel with `quiesce=3Dtrue` on eDMA= v0 hardware causes a data race on `engine_en` and incorrectly shuts down t= he entire DMA direction, disrupting all other local channels. -- --- Patch [4]: [PATCH v6 4/6] dmaengine: dw-edma: Add delegated channel req= uest helpers --- commit 0987248b986738e4870e25b1f36d8c9f2eb69d8b Author: Koichiro Den <[email protected]> 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 =3D 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 t= he 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 =3D=3D EDMA_DIR_WRITE ? "write" : "read", > + chan->id); > + > + scoped_guard(spinlock_irqsave, &chan->vc.lock) > + chan->irq_mode =3D dw_edma_get_default_irq_mode(chan); > + > + dma_release_channel(dchan); > +} --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20260804033855.2115= [email protected]?part=3D4