From: Frank Li <Frank.li@oss.nxp.com>
To: Amelie Delaunay <amelie.delaunay@foss.st.com>
Cc: Vinod Koul <vkoul@kernel.org>, Frank Li <Frank.Li@kernel.org>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
dmaengine@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Jerome Audu <jerome.audu@st.com>,
stable@vger.kernel.org
Subject: Re: [PATCH v2 1/4] dmaengine: stm32-dma3: clear flags before signaling transfer completion
Date: Mon, 23 Nov 2026 11:32:36 -0600 [thread overview]
Message-ID: <awR4tDIV-FvXG1jb@SMW015318> (raw)
In-Reply-To: <20261123-dma3-fixes-v2-1-0a5b013f79d2@foss.st.com>
On Mon, Nov 23, 2026 at 10:17:05AM +0100, Amelie Delaunay wrote:
> From: Jerome Audu <jerome.audu@st.com>
>
> The interrupt handler clears channel flags after handling the captured
> status. However, stm32_dma3_chan_complete() can start another transfer.
> If that transfer completes before the flags are cleared, its Transfer
> Complete flag is cleared without handling its completion, potentially
> causing a timeout.
>
> Clear the captured interrupt flags immediately after reading the channel
> status and interrupt enables, before handling the events. This prevents
> the handler from clearing a completion flag raised by a newly started
> transfer.
>
> Fixes: f561ec8b2b33 ("dmaengine: Add STM32 DMA3 support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Jerome Audu <jerome.audu@st.com>
> Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
>
> ---
> Changes in v2:
> - Commit message rephrased according to Frank Li's review
> ---
> drivers/dma/stm32/stm32-dma3.c | 19 +++++++++----------
> 1 file changed, 9 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/dma/stm32/stm32-dma3.c b/drivers/dma/stm32/stm32-dma3.c
> index 4fe226541efa..a464e0cefd64 100644
> --- a/drivers/dma/stm32/stm32-dma3.c
> +++ b/drivers/dma/stm32/stm32-dma3.c
> @@ -1008,7 +1008,7 @@ static irqreturn_t stm32_dma3_chan_irq(int irq, void *devid)
> {
> struct stm32_dma3_chan *chan = devid;
> struct stm32_dma3_ddata *ddata = to_stm32_dma3_ddata(chan);
> - u32 misr, csr, ccr;
> + u32 misr, csr, ccr, cfcr;
>
> spin_lock(&chan->vchan.lock);
>
> @@ -1021,6 +1021,14 @@ static irqreturn_t stm32_dma3_chan_irq(int irq, void *devid)
> csr = readl_relaxed(ddata->base + STM32_DMA3_CSR(chan->id));
> ccr = readl_relaxed(ddata->base + STM32_DMA3_CCR(chan->id)) & CCR_ALLIE;
>
> + /*
> + * Half Transfer Interrupt may be disabled but Half Transfer Flag can be set,
> + * ensure HTF flag to be cleared, with other flags.
> + */
> + cfcr = csr & (ccr | CCR_HTIE);
> + if (cfcr)
> + writel_relaxed(cfcr, ddata->base + STM32_DMA3_CFCR(chan->id));
> +
> if (csr & CSR_TCF && ccr & CCR_TCIE) {
> if (chan->swdesc->cyclic)
> vchan_cyclic_callback(&chan->swdesc->vdesc);
> @@ -1050,15 +1058,6 @@ static irqreturn_t stm32_dma3_chan_irq(int irq, void *devid)
> stm32_dma3_chan_reset(chan);
> }
>
> - /*
> - * Half Transfer Interrupt may be disabled but Half Transfer Flag can be set,
> - * ensure HTF flag to be cleared, with other flags.
> - */
> - csr &= (ccr | CCR_HTIE);
> -
> - if (csr)
> - writel_relaxed(csr, ddata->base + STM32_DMA3_CFCR(chan->id));
> -
> spin_unlock(&chan->vchan.lock);
>
> return IRQ_HANDLED;
>
> --
> 2.43.0
>
next prev parent reply other threads:[~2026-11-23 17:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 9:17 [PATCH v2 0/4] dmaengine: stm32-dma3: fix IRQ flag race and linked-list handling Amelie Delaunay
2026-11-23 9:17 ` [PATCH v2 1/4] dmaengine: stm32-dma3: clear flags before signaling transfer completion Amelie Delaunay
2026-11-23 17:32 ` Frank Li [this message]
2026-11-23 9:17 ` [PATCH v2 2/4] dmaengine: stm32-dma3: set LL base address when transfer starts Amelie Delaunay
2026-11-23 9:17 ` [PATCH v2 3/4] dmaengine: stm32-dma3: validate LLI pool allocations and fix cleanup Amelie Delaunay
2026-11-23 9:25 ` sashiko-bot
2026-11-23 9:17 ` [PATCH v2 4/4] dmaengine: stm32-dma3: replace hardcoded LLI size with aligned descriptor size Amelie Delaunay
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=awR4tDIV-FvXG1jb@SMW015318 \
--to=frank.li@oss.nxp.com \
--cc=Frank.Li@kernel.org \
--cc=alexandre.torgue@foss.st.com \
--cc=amelie.delaunay@foss.st.com \
--cc=dmaengine@vger.kernel.org \
--cc=jerome.audu@st.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=stable@vger.kernel.org \
--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.