From: Jiale Yao <yaojiale02@163.com>
To: Laxman Dewangan <ldewangan@nvidia.com>,
Jon Hunter <jonathanh@nvidia.com>, Vinod Koul <vkoul@kernel.org>,
Frank Li <Frank.Li@kernel.org>,
Thierry Reding <thierry.reding@kernel.org>,
Akhil R <akhilrajeev@nvidia.com>,
Pavan Kunapuli <pkunapuli@nvidia.com>,
Rajesh Gumasta <rgumasta@nvidia.com>,
dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Jiale Yao <yaojiale02@163.com>
Subject: [PATCH] dmaengine: tegra186-gpc-dma: Fix queued transfer stall
Date: Sun, 27 Sep 2026 00:02:12 +0800 [thread overview]
Message-ID: <20260926160212.91438-1-yaojiale02@163.com> (raw)
tegra_dma_issue_pending() returns before taking vc.lock whenever a
descriptor is active. This skips vchan_issue_pending(), so descriptors
submitted while a transfer is running remain on desc_submitted. The
completion path clears dma_desc but never starts a queued descriptor,
leaving the transfer stalled until another issue_pending() call.
Always publish submitted descriptors under the lock, and only start a
new descriptor when the channel is idle. After a non-cyclic descriptor
completes, start the next issued descriptor. Centralize the start of a new
descriptor so cyclic preconfiguration is also performed when the
completion path starts it.
Fixes: ee17028009d4 ("dmaengine: tegra: Add tegra gpcdma driver")
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
drivers/dma/tegra186-gpc-dma.c | 34 +++++++++++++++++++---------------
1 file changed, 19 insertions(+), 15 deletions(-)
diff --git a/drivers/dma/tegra186-gpc-dma.c b/drivers/dma/tegra186-gpc-dma.c
index 64cedef1050a..4f4fdbda5e56 100644
--- a/drivers/dma/tegra186-gpc-dma.c
+++ b/drivers/dma/tegra186-gpc-dma.c
@@ -553,6 +553,21 @@ static void tegra_dma_start(struct tegra_dma_channel *tdc)
sg_req->csr | TEGRA_GPCDMA_CSR_ENB);
}
+static void tegra_dma_start_next(struct tegra_dma_channel *tdc)
+{
+ tegra_dma_start(tdc);
+
+ /*
+ * For cyclic DMA transfers, program the second
+ * transfer parameters as soon as the first DMA
+ * transfer is started inorder for the DMA
+ * controller to trigger the second transfer
+ * with the correct parameters.
+ */
+ if (tdc->dma_desc && tdc->dma_desc->cyclic)
+ tegra_dma_configure_next_sg(tdc);
+}
+
static void tegra_dma_xfer_complete(struct tegra_dma_channel *tdc)
{
vchan_cookie_complete(&tdc->dma_desc->vd);
@@ -560,6 +575,8 @@ static void tegra_dma_xfer_complete(struct tegra_dma_channel *tdc)
tegra_dma_sid_free(tdc);
tdc->dma_desc = NULL;
tdc->status = DMA_COMPLETE;
+
+ tegra_dma_start_next(tdc);
}
static void tegra_dma_chan_decode_error(struct tegra_dma_channel *tdc,
@@ -653,22 +670,9 @@ static void tegra_dma_issue_pending(struct dma_chan *dc)
struct tegra_dma_channel *tdc = to_tegra_dma_chan(dc);
unsigned long flags;
- if (tdc->dma_desc)
- return;
-
spin_lock_irqsave(&tdc->vc.lock, flags);
- if (vchan_issue_pending(&tdc->vc))
- tegra_dma_start(tdc);
-
- /*
- * For cyclic DMA transfers, program the second
- * transfer parameters as soon as the first DMA
- * transfer is started inorder for the DMA
- * controller to trigger the second transfer
- * with the correct parameters.
- */
- if (tdc->dma_desc && tdc->dma_desc->cyclic)
- tegra_dma_configure_next_sg(tdc);
+ if (vchan_issue_pending(&tdc->vc) && !tdc->dma_desc)
+ tegra_dma_start_next(tdc);
spin_unlock_irqrestore(&tdc->vc.lock, flags);
}
--
2.34.1
reply other threads:[~2026-09-26 16:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260926160212.91438-1-yaojiale02@163.com \
--to=yaojiale02@163.com \
--cc=Frank.Li@kernel.org \
--cc=akhilrajeev@nvidia.com \
--cc=dmaengine@vger.kernel.org \
--cc=jonathanh@nvidia.com \
--cc=ldewangan@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=pkunapuli@nvidia.com \
--cc=rgumasta@nvidia.com \
--cc=thierry.reding@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