All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Koichiro Den" <den@valinux.co.jp>
Cc: dmaengine@vger.kernel.org, vkoul@kernel.org, Frank.Li@kernel.org
Subject: Re: [PATCH v5 02/14] dmaengine: dw-edma: Add per-channel interrupt routing control
Date: Fri, 17 Jul 2026 05:21:09 +0000	[thread overview]
Message-ID: <20260717052109.D9CAF1F00A3E@smtp.kernel.org> (raw)
In-Reply-To: <20260717050308.2144108-3-den@valinux.co.jp>

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

Pre-existing issues:
- [High] Cross-system read-modify-write (RMW) race on the shared `int_mask` register causes lost unmasks and DMA hangs. (Pre-existing)
--

--- Patch [2]: [PATCH v5 02/14] dmaengine: dw-edma: Add per-channel interrupt routing control ---
commit ce3c3f8c0117acd509b753117d45f3c2cf75e27d
Author: Koichiro Den <den@valinux.co.jp>
dmaengine: dw-edma: Add per-channel interrupt routing control

This patch adds per-channel interrupt routing control for the DesignWare
eDMA controller. It introduces a new routing mode to determine where a
channel should report completion and updates the interrupt masking and
generation logic accordingly.

> diff --git a/drivers/dma/dw-edma/dw-edma-v0-core.c b/drivers/dma/dw-edma/dw-edma-v0-core.c
> --- a/drivers/dma/dw-edma/dw-edma-v0-core.c
> +++ b/drivers/dma/dw-edma/dw-edma-v0-core.c
[ ... ]
> @@ -354,12 +360,17 @@ static void dw_edma_v0_core_ch_enable(struct dw_edma_chan *chan)
>  			break;
>  		}
>  	}
> -	/* Interrupt unmask - done, abort */
> +	/* Interrupt mask/unmask - done, abort */
>  	raw_spin_lock_irqsave(&dw->lock, flags);
>  
>  	tmp = GET_RW_32(dw, chan->dir, int_mask);
> -	tmp &= ~FIELD_PREP(EDMA_V0_DONE_INT_MASK, BIT(chan->id));
> -	tmp &= ~FIELD_PREP(EDMA_V0_ABORT_INT_MASK, BIT(chan->id));
> +	if (chan->irq_mode == DW_EDMA_CH_IRQ_REMOTE) {
> +		tmp |= FIELD_PREP(EDMA_V0_DONE_INT_MASK, BIT(chan->id));
> +		tmp |= FIELD_PREP(EDMA_V0_ABORT_INT_MASK, BIT(chan->id));
> +	} else {
> +		tmp &= ~FIELD_PREP(EDMA_V0_DONE_INT_MASK, BIT(chan->id));
> +		tmp &= ~FIELD_PREP(EDMA_V0_ABORT_INT_MASK, BIT(chan->id));
> +	}
>  	SET_RW_32(dw, chan->dir, int_mask, tmp);

[Severity: High]
This is a pre-existing issue, but does this read-modify-write sequence on the
shared int_mask register risk a race condition across the PCIe bus?

Since the PCIe Host and local endpoint drivers can independently execute
dw_edma_v0_core_ch_enable() concurrently, the local dw->lock does not
synchronize operations across the bus.

If the Host performs a read-modify-write that sets its mask bit to 1, could
this overwrite a concurrent read-modify-write by the endpoint clearing its
mask bit to 0? If the endpoint's unmask operation is reverted by the Host,
the endpoint's channel would remain masked, which appears to lead to a
lost interrupt and a DMA hang.

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

  reply	other threads:[~2026-07-17  5:21 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-17  5:02 [PATCH v5 00/14] dmaengine: dw-edma: Prepare for PCI EP DMA (part 1/3) Koichiro Den
2026-07-17  5:02 ` [PATCH v5 01/14] dmaengine: dw-edma: Factor out HDMA interrupt setup helper Koichiro Den
2026-07-17  5:02 ` [PATCH v5 02/14] dmaengine: dw-edma: Add per-channel interrupt routing control Koichiro Den
2026-07-17  5:21   ` sashiko-bot [this message]
2026-07-17  5:02 ` [PATCH v5 03/14] dmaengine: dw-edma: Add core quiesce operations Koichiro Den
2026-07-17  5:17   ` sashiko-bot
2026-07-17  5:02 ` [PATCH v5 04/14] dmaengine: dw-edma: Initialize IRQ data before requesting IRQs Koichiro Den
2026-07-17  5:16   ` sashiko-bot
2026-07-17  5:02 ` [PATCH v5 05/14] dmaengine: dw-edma: Add partial channel ownership mode Koichiro Den
2026-07-17  5:20   ` sashiko-bot
2026-07-17  5:03 ` [PATCH v5 06/14] dmaengine: dw-edma-pcie: Track non-LL mode in DMA data Koichiro Den
2026-07-17  5:03 ` [PATCH v5 07/14] dmaengine: dw-edma-pcie: Add capability match data Koichiro Den
2026-07-17  5:12   ` sashiko-bot
2026-07-17  5:03 ` [PATCH v5 08/14] dmaengine: dw-edma-pcie: Rename vsec_data to dma_data Koichiro Den
2026-07-17  5:03 ` [PATCH v5 09/14] dmaengine: dw-edma-pcie: Add platform ops to match data Koichiro Den
2026-07-17  5:03 ` [PATCH v5 10/14] dmaengine: dw-edma-pcie: Add register offset match flag Koichiro Den
2026-07-17  5:03 ` [PATCH v5 11/14] dmaengine: dw-edma-pcie: Factor out descriptor block address lookup Koichiro Den
2026-07-17  5:03 ` [PATCH v5 12/14] dmaengine: dw-edma-pcie: Handle optional data blocks Koichiro Den
2026-07-17  5:18   ` sashiko-bot
2026-07-17  5:03 ` [PATCH v5 13/14] dmaengine: dw-edma-pcie: Add chip flags to match data Koichiro Den
2026-07-17  5:03 ` [PATCH v5 14/14] dmaengine: dw-edma: Program endpoint function numbers Koichiro Den
2026-07-17  5:29   ` 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=20260717052109.D9CAF1F00A3E@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=den@valinux.co.jp \
    --cc=dmaengine@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.