From: Frank Li <Frank.li@oss.nxp.com>
To: Koichiro Den <den@valinux.co.jp>
Cc: Manivannan Sadhasivam <mani@kernel.org>,
Vinod Koul <vkoul@kernel.org>, Frank Li <Frank.Li@kernel.org>,
Cai Huoqing <cai.huoqing@linux.dev>,
Serge Semin <fancer.lancer@gmail.com>,
Gustavo Pimentel <Gustavo.Pimentel@synopsys.com>,
Devendra K Verma <devendra.verma@amd.com>,
dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 4/9] dmaengine: dw-edma: Complete descriptors before pausing
Date: Wed, 15 Jul 2026 13:56:55 -0500 [thread overview]
Message-ID: <alfX957qgxB08Ohd@SMW015318> (raw)
In-Reply-To: <20260715175740.1110404-5-den@valinux.co.jp>
On Thu, Jul 16, 2026 at 02:57:35AM +0900, Koichiro Den wrote:
> If PAUSE is requested while the final chunk of a descriptor is in
> flight, the DONE interrupt takes the PAUSE path without checking whether
> the descriptor has been depleted. The depleted descriptor remains on the
> issued list and the channel enters EDMA_ST_PAUSE.
>
> On resume, dw_edma_start_transfer() finds the descriptor but no chunk to
> start and returns 0. The caller ignores that result and leaves the
> channel stuck in EDMA_ST_BUSY with no transfer running.
>
> Check for descriptor completion before acknowledging PAUSE. If there is
> no work to start on resume, leave the channel idle. Also ignore DONE
> interrupts while the channel is paused so a stale or repeated interrupt
> cannot change its state or start queued work.
>
> Fixes: e63d79d1ffcd ("dmaengine: Add Synopsys eDMA IP core driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Koichiro Den <den@valinux.co.jp>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> Changes in v3:
> - New patch for a pre-existing PAUSE completion issue. (Sashiko)
>
> drivers/dma/dw-edma/dw-edma-core.c | 20 ++++++++++++++------
> 1 file changed, 14 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c
> index 272b03405746..b06b299661c0 100644
> --- a/drivers/dma/dw-edma/dw-edma-core.c
> +++ b/drivers/dma/dw-edma/dw-edma-core.c
> @@ -327,7 +327,8 @@ static int dw_edma_device_resume(struct dma_chan *dchan)
> err = -EPERM;
> } else {
> chan->status = EDMA_ST_BUSY;
> - dw_edma_start_transfer(chan);
> + if (!dw_edma_start_transfer(chan))
> + chan->status = EDMA_ST_IDLE;
> }
>
> return err;
> @@ -691,10 +692,16 @@ static void dw_edma_done_interrupt(struct dw_edma_chan *chan)
> unsigned long flags;
>
> spin_lock_irqsave(&chan->vc.lock, flags);
> + if (chan->status == EDMA_ST_PAUSE) {
> + spin_unlock_irqrestore(&chan->vc.lock, flags);
> + return;
> + }
> +
> vd = vchan_next_desc(&chan->vc);
> if (vd) {
> switch (chan->request) {
> case EDMA_REQ_NONE:
> + case EDMA_REQ_PAUSE:
> desc = vd2dw_edma_desc(vd);
> if (!desc->chunks_alloc) {
> dw_hdma_set_callback_result(vd,
> @@ -703,6 +710,12 @@ static void dw_edma_done_interrupt(struct dw_edma_chan *chan)
> vchan_cookie_complete(vd);
> }
>
> + if (chan->request == EDMA_REQ_PAUSE) {
> + chan->request = EDMA_REQ_NONE;
> + chan->status = EDMA_ST_PAUSE;
> + break;
> + }
> +
> /* Continue transferring if there are remaining chunks or issued requests.
> */
> chan->status = dw_edma_start_transfer(chan) ? EDMA_ST_BUSY : EDMA_ST_IDLE;
> @@ -714,11 +727,6 @@ static void dw_edma_done_interrupt(struct dw_edma_chan *chan)
> chan->status = EDMA_ST_IDLE;
> break;
>
> - case EDMA_REQ_PAUSE:
> - chan->request = EDMA_REQ_NONE;
> - chan->status = EDMA_ST_PAUSE;
> - break;
> -
> default:
> break;
> }
> --
> 2.51.0
>
next prev parent reply other threads:[~2026-07-15 18:57 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-15 17:57 [PATCH v3 0/9] dmaengine: dw-edma: Fixes and interrupt-path groundwork Koichiro Den
2026-07-15 17:57 ` [PATCH v3 1/9] dmaengine: dw-edma: Fix HDMA channel status register access Koichiro Den
2026-07-15 17:57 ` [PATCH v3 2/9] dmaengine: dw-edma: Terminate all descriptors without callbacks Koichiro Den
2026-07-15 18:24 ` sashiko-bot
2026-07-15 18:54 ` Frank Li
2026-07-15 17:57 ` [PATCH v3 3/9] dmaengine: dw-edma: Serialize abort state updates Koichiro Den
2026-07-15 18:15 ` sashiko-bot
2026-07-15 18:55 ` Frank Li
2026-07-15 17:57 ` [PATCH v3 4/9] dmaengine: dw-edma: Complete descriptors before pausing Koichiro Den
2026-07-15 18:15 ` sashiko-bot
2026-07-15 18:56 ` Frank Li [this message]
2026-07-15 17:57 ` [PATCH v3 5/9] dmaengine: dw-edma: Serialize channel state checks Koichiro Den
2026-07-15 18:19 ` sashiko-bot
2026-07-15 18:58 ` Frank Li
2026-07-15 17:57 ` [PATCH v3 6/9] dmaengine: dw-edma: Clear stale requests on termination Koichiro Den
2026-07-15 18:19 ` sashiko-bot
2026-07-15 19:00 ` Frank Li
2026-07-15 17:57 ` [PATCH v3 7/9] dmaengine: dw-edma-pcie: Drop redundant pci_free_irq_vectors() Koichiro Den
2026-07-15 17:57 ` [PATCH v3 8/9] dmaengine: dw-edma: Snapshot the v0 interrupt status once per handler pass Koichiro Den
2026-07-15 17:57 ` [PATCH v3 9/9] dmaengine: dw-edma: Defer channel IRQ handling to workqueue Koichiro Den
2026-07-15 18:33 ` sashiko-bot
2026-07-15 19:02 ` Frank Li
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=alfX957qgxB08Ohd@SMW015318 \
--to=frank.li@oss.nxp.com \
--cc=Frank.Li@kernel.org \
--cc=Gustavo.Pimentel@synopsys.com \
--cc=cai.huoqing@linux.dev \
--cc=den@valinux.co.jp \
--cc=devendra.verma@amd.com \
--cc=dmaengine@vger.kernel.org \
--cc=fancer.lancer@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mani@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox