Re: [PATCH 1/4] dmaengine: stm32-dma3: clear flags before signaling transfer completion
From: Amelie Delaunay
Date: Mon Nov 23 2026 - 03:40:47 EST
On 11/20/26 18:48, Frank Li wrote:
On Fri, Nov 20, 2026 at 10:18:01AM +0100, Amelie Delaunay wrote:
From: Jerome Audu<jerome.audu@xxxxxx>Can you rephrase commit message. clean irq flags should just after
On a Transfer Complete event, a new transfer can be started from
stm32_dma3_chan_complete(). The new transfer may finish while the end of
stm32_dma3_chan_irq() is still executing, in which case the flag clearing
done at the end of the handler also clears the new transfer's Transfer
Complete flag without the end of that transfer being handled, which may
lead to a timeout.
Clear the flags before handling completion to make sure that if
stm32_dma3_chan_complete() starts an ultra-fast transfer, its TCF flag is
not accidentally cleared. This reordering is also safe for the other
handled interrupt conditions, since csr holds the channel status and is
used to select the handling path.
get status before do actually handle. Actual handle may cause new irqs.
It is quite common pattern for irq handler. Some thing like
Move clear irq state just after fetch state to avoid lost irq because
actual handle work (i.e stm32_dma3_chan_complete()) may issue new irq.
Frank
Hi Frank,
Thanks for reviewing. I'll rephrase it, keeping the concrete failure scenario but making it shorter for clarity.
Regards,
Amelie