dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] dmaengine: dw-edma: Fix to change for continuous transfer
@ 2023-04-11 10:17 Shunsuke Mie
  2023-04-11 10:17 ` [PATCH v2 2/2] dmaengine: dw-edma: Fix to enable to issue dma request on DMA processing Shunsuke Mie
  2023-04-12 17:15 ` [PATCH v2 1/2] dmaengine: dw-edma: Fix to change for continuous transfer Vinod Koul
  0 siblings, 2 replies; 3+ messages in thread
From: Shunsuke Mie @ 2023-04-11 10:17 UTC (permalink / raw)
  To: Gustavo Pimentel; +Cc: Vinod Koul, dmaengine, linux-kernel, Shunsuke Mie

The dw-edma driver stops after processing a DMA request even if a request
remains in the issued queue, which is not the expected behavior. The DMA
engine API requires continuous processing.

Add a trigger to start after one processing finished if there are requests
remain.

Fixes: e63d79d1ffcd ("dmaengine: Add Synopsys eDMA IP core driver")
Signed-off-by: Shunsuke Mie <mie@igel.co.jp>
---
Changes

v2:
- Refactor code
- Rebase to next-20230411

v1: https://lore.kernel.org/dmaengine/20221223022608.550697-1-mie@igel.co.jp/
- Initial patch

 drivers/dma/dw-edma/dw-edma-core.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c
index 1906a836f0aa..26a395d02f5d 100644
--- a/drivers/dma/dw-edma/dw-edma-core.c
+++ b/drivers/dma/dw-edma/dw-edma-core.c
@@ -181,7 +181,7 @@ static void vchan_free_desc(struct virt_dma_desc *vdesc)
 	dw_edma_free_desc(vd2dw_edma_desc(vdesc));
 }
 
-static void dw_edma_start_transfer(struct dw_edma_chan *chan)
+static int dw_edma_start_transfer(struct dw_edma_chan *chan)
 {
 	struct dw_edma_chunk *child;
 	struct dw_edma_desc *desc;
@@ -189,16 +189,16 @@ static void dw_edma_start_transfer(struct dw_edma_chan *chan)
 
 	vd = vchan_next_desc(&chan->vc);
 	if (!vd)
-		return;
+		return 0;
 
 	desc = vd2dw_edma_desc(vd);
 	if (!desc)
-		return;
+		return 0;
 
 	child = list_first_entry_or_null(&desc->chunk->list,
 					 struct dw_edma_chunk, list);
 	if (!child)
-		return;
+		return 0;
 
 	dw_edma_v0_core_start(child, !desc->xfer_sz);
 	desc->xfer_sz += child->ll_region.sz;
@@ -206,6 +206,8 @@ static void dw_edma_start_transfer(struct dw_edma_chan *chan)
 	list_del(&child->list);
 	kfree(child);
 	desc->chunks_alloc--;
+
+	return 1;
 }
 
 static void dw_edma_device_caps(struct dma_chan *dchan,
@@ -602,14 +604,14 @@ static void dw_edma_done_interrupt(struct dw_edma_chan *chan)
 		switch (chan->request) {
 		case EDMA_REQ_NONE:
 			desc = vd2dw_edma_desc(vd);
-			if (desc->chunks_alloc) {
-				chan->status = EDMA_ST_BUSY;
-				dw_edma_start_transfer(chan);
-			} else {
+			if (!desc->chunks_alloc) {
 				list_del(&vd->node);
 				vchan_cookie_complete(vd);
-				chan->status = EDMA_ST_IDLE;
 			}
+
+			/* Continue transferring if there are remaining chunks or issued requests.
+			 */
+			chan->status = dw_edma_start_transfer(chan) ? EDMA_ST_BUSY : EDMA_ST_IDLE;
 			break;
 
 		case EDMA_REQ_STOP:
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v2 2/2] dmaengine: dw-edma: Fix to enable to issue dma request on DMA processing
  2023-04-11 10:17 [PATCH v2 1/2] dmaengine: dw-edma: Fix to change for continuous transfer Shunsuke Mie
@ 2023-04-11 10:17 ` Shunsuke Mie
  2023-04-12 17:15 ` [PATCH v2 1/2] dmaengine: dw-edma: Fix to change for continuous transfer Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Shunsuke Mie @ 2023-04-11 10:17 UTC (permalink / raw)
  To: Gustavo Pimentel; +Cc: Vinod Koul, dmaengine, linux-kernel, Shunsuke Mie

The issue_pending request is ignored while driver is processing a DMA
request. Fix to issue the pending requests on any dma channel status.

Fixes: e63d79d1ffcd ("dmaengine: Add Synopsys eDMA IP core driver")
Signed-off-by: Shunsuke Mie <mie@igel.co.jp>
---
Changes
v2:
- Rebase to next-20230411

v1: https://lore.kernel.org/dmaengine/20221223022608.550697-2-mie@igel.co.jp/
- Initial patch

 drivers/dma/dw-edma/dw-edma-core.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c
index 26a395d02f5d..7d2b73ef0872 100644
--- a/drivers/dma/dw-edma/dw-edma-core.c
+++ b/drivers/dma/dw-edma/dw-edma-core.c
@@ -308,9 +308,12 @@ static void dw_edma_device_issue_pending(struct dma_chan *dchan)
 	struct dw_edma_chan *chan = dchan2dw_edma_chan(dchan);
 	unsigned long flags;
 
+	if (!chan->configured)
+		return;
+
 	spin_lock_irqsave(&chan->vc.lock, flags);
-	if (chan->configured && chan->request == EDMA_REQ_NONE &&
-	    chan->status == EDMA_ST_IDLE && vchan_issue_pending(&chan->vc)) {
+	if (vchan_issue_pending(&chan->vc) && chan->request == EDMA_REQ_NONE &&
+	    chan->status == EDMA_ST_IDLE) {
 		chan->status = EDMA_ST_BUSY;
 		dw_edma_start_transfer(chan);
 	}
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 1/2] dmaengine: dw-edma: Fix to change for continuous transfer
  2023-04-11 10:17 [PATCH v2 1/2] dmaengine: dw-edma: Fix to change for continuous transfer Shunsuke Mie
  2023-04-11 10:17 ` [PATCH v2 2/2] dmaengine: dw-edma: Fix to enable to issue dma request on DMA processing Shunsuke Mie
@ 2023-04-12 17:15 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2023-04-12 17:15 UTC (permalink / raw)
  To: Shunsuke Mie; +Cc: Gustavo Pimentel, dmaengine, linux-kernel

On 11-04-23, 19:17, Shunsuke Mie wrote:
> The dw-edma driver stops after processing a DMA request even if a request
> remains in the issued queue, which is not the expected behavior. The DMA
> engine API requires continuous processing.
> 
> Add a trigger to start after one processing finished if there are requests
> remain.

Applied, thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-04-12 17:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-11 10:17 [PATCH v2 1/2] dmaengine: dw-edma: Fix to change for continuous transfer Shunsuke Mie
2023-04-11 10:17 ` [PATCH v2 2/2] dmaengine: dw-edma: Fix to enable to issue dma request on DMA processing Shunsuke Mie
2023-04-12 17:15 ` [PATCH v2 1/2] dmaengine: dw-edma: Fix to change for continuous transfer Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).