Re: [PATCH v2 2/3] dmaengine: dw-axi-dmac: retain descriptors when termination times out
From: Andy Shevchenko
Date: Tue Nov 10 2026 - 02:50:36 EST
On Mon, Nov 09, 2026 at 08:06:01PM -0700, James Hilliard wrote:
> dma_chan_terminate_all() warns when the channel enable bit does not clear,
> but then frees the descriptors and returns success. Its synchronize
> callback only drains virtual-channel callbacks, so terminate_sync() can
> also report success while hardware still accesses the transfer.
>
> Return the polling error before detaching descriptors or changing the
> peripheral routing. This keeps the transfer resources available while
> the channel remains enabled and lets the caller retry termination without
> treating the timeout as a successful stop.
>
> Hold the channel lock across disabling, polling and descriptor detachment
> so an interrupt handler cannot restart the channel between the stop check
> and cleanup.
...
> ret = readx_poll_timeout_atomic(axi_chan_is_hw_enable, chan, enabled, !enabled,
> 1 * USEC_PER_MSEC, 50 * USEC_PER_MSEC);
> - if (ret == -ETIMEDOUT)
> + if (ret) {
Just noticed, this should be part of the previous patch.
> + spin_unlock_irqrestore(&chan->vc.lock, flags);
> dev_warn(dmaengine_chan_dev(dchan),
> "%s failed to stop\n", axi_chan_name(chan));
> + return ret;
> + }
--
With Best Regards,
Andy Shevchenko