From: Frank Li <Frank.li@oss.nxp.com>
To: James Hilliard <james.hilliard1@gmail.com>
Cc: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>,
Vinod Koul <vkoul@kernel.org>, Frank Li <Frank.Li@kernel.org>,
Sergey Khimich <serghox@gmail.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Sia Jee Heng <jee.heng.sia@intel.com>,
Mitch Barnett <mitch@accuratesound.ca>,
dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH v7 2/8] dmaengine: dw-axi-dmac: poll the correct enable bit during termination
Date: Wed, 18 Nov 2026 11:27:45 -0600 [thread overview]
Message-ID: <av3gERkhJ-loap-v@SMW015318> (raw)
In-Reply-To: <20261117-submit-dw-axi-dma-stop-pause-v1-v7-2-d5f2309afd72@gmail.com>
On Tue, Nov 17, 2026 at 05:07:41PM -0700, James Hilliard wrote:
> For channels 16 through 31, the channel enable bits occupy bits 32 through
> 47 of the extended DMAC_CHEN register. dma_chan_terminate_all() only reads
> the low word and tests BIT(chan->id), so it can conclude that an upper-bank
> channel has stopped while its actual enable bit remains set. Descriptors
> can then be freed while hardware still owns them.
>
> Poll axi_chan_is_hw_enable(), which already handles both register banks
> and the smaller channel layouts, instead of constructing another mask.
>
> Fixes: 495e18b16e3d ("dmaengine: dw-axi-dmac: Add support DMAX_NUM_CHANNELS > 16")
> Cc: stable@vger.kernel.org
> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
> ---
> drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
> index 6dae63024721..405ab9a78955 100644
> --- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
> +++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
> @@ -28,6 +28,7 @@
> #include <linux/property.h>
> #include <linux/reset.h>
> #include <linux/slab.h>
> +#include <linux/time64.h>
> #include <linux/types.h>
>
> #include "dw-axi-dmac.h"
> @@ -1179,17 +1180,17 @@ static irqreturn_t dw_axi_dma_interrupt(int irq, void *dev_id)
> static int dma_chan_terminate_all(struct dma_chan *dchan)
> {
> struct axi_dma_chan *chan = dchan_to_axi_dma_chan(dchan);
> - u32 chan_active = BIT(chan->id) << DMAC_CHAN_EN_SHIFT;
> unsigned long flags;
> - u32 val;
> + bool enabled;
> int ret;
> LIST_HEAD(head);
>
> axi_chan_disable(chan);
>
> - ret = readl_poll_timeout_atomic(chan->chip->regs + DMAC_CHEN, val,
> - !(val & chan_active), 1000, 50000);
> - if (ret == -ETIMEDOUT)
> + ret = readx_poll_timeout_atomic(axi_chan_is_hw_enable, chan,
This is hack usage
* readx_poll_timeout_atomic - Periodically poll an address until a condition is met or a timeout occurs
* @op: accessor function (takes @addr as its only argument)
* @addr: Address to poll
chan is not addr, although it is first arugment.
use read_poll_timeout_atomic(), just argument order is difference.
Frank
> + enabled, !enabled,
> + 1 * USEC_PER_MSEC, 50 * USEC_PER_MSEC);
> + if (ret)
> dev_warn(dmaengine_chan_dev(dchan),
> "%s failed to stop\n", axi_chan_name(chan));
>
>
> --
> 2.53.0
>
next prev parent reply other threads:[~2026-11-18 17:27 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 0:07 [PATCH v7 0/8] dmaengine: dw-axi-dmac: fix termination and pause acknowledgment James Hilliard
2026-11-18 0:07 ` [PATCH v7 1/8] dmaengine: dw-axi-dmac: keep cyclic mode in the descriptor James Hilliard
2026-11-18 17:20 ` Frank Li
2026-11-18 0:07 ` [PATCH v7 2/8] dmaengine: dw-axi-dmac: poll the correct enable bit during termination James Hilliard
2026-11-18 17:27 ` Frank Li [this message]
2026-11-18 0:07 ` [PATCH v7 3/8] dmaengine: dw-axi-dmac: retain descriptors when termination times out James Hilliard
2026-11-18 17:31 ` Frank Li
2026-11-18 0:07 ` [PATCH v7 4/8] dmaengine: dw-axi-dmac: use atomic polling for suspend acknowledgment James Hilliard
2026-11-18 17:32 ` Frank Li
2026-11-18 0:07 ` [PATCH v7 5/8] dmaengine: dw-axi-dmac: preserve pending pause requests James Hilliard
2026-11-18 0:07 ` [PATCH v7 6/8] dmaengine: dw-axi-dmac: retain descriptors until callbacks drain James Hilliard
2026-11-18 0:07 ` [PATCH v7 7/8] dmaengine: dw-axi-dmac: serialize interrupt status with channel reuse James Hilliard
2026-11-18 0:07 ` [PATCH v7 8/8] dmaengine: dw-axi-dmac: guard shared IRQs across the controller lifetime James Hilliard
2026-11-18 0:32 ` 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=av3gERkhJ-loap-v@SMW015318 \
--to=frank.li@oss.nxp.com \
--cc=Eugeniy.Paltsev@synopsys.com \
--cc=Frank.Li@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=james.hilliard1@gmail.com \
--cc=jee.heng.sia@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mitch@accuratesound.ca \
--cc=serghox@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.