summaryrefslogtreecommitdiffstats
path: root/drivers/dma/ptdma
diff options
context:
space:
mode:
authorSanjay R Mehta <sanju.mehta@amd.com>2022-02-02 16:14:39 +0100
committerVinod Koul <vkoul@kernel.org>2022-02-15 06:24:54 +0100
commit6fa7e0e836e23e2c758ac3930b040c8abbbf8a6f (patch)
treeb6c7cc353fef1bc5733ceb71e4e6a43e863e7cff /drivers/dma/ptdma
parentdt-bindings: dma: rz-dmac: Document RZ/G2UL SoC (diff)
downloadlinux-6fa7e0e836e23e2c758ac3930b040c8abbbf8a6f.tar.xz
linux-6fa7e0e836e23e2c758ac3930b040c8abbbf8a6f.zip
dmaengine: ptdma: fix concurrency issue with multiple dma transfer
The command should be submitted only if the engine is idle, for this, the next available descriptor is checked and set the flag to false in case the descriptor is non-empty. Signed-off-by: Sanjay R Mehta <sanju.mehta@amd.com> Link: https://lore.kernel.org/r/1643814880-3882-2-git-send-email-Sanju.Mehta@amd.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/dma/ptdma')
-rw-r--r--drivers/dma/ptdma/ptdma-dmaengine.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/dma/ptdma/ptdma-dmaengine.c b/drivers/dma/ptdma/ptdma-dmaengine.c
index c9e52f6f2f50..e38dca422391 100644
--- a/drivers/dma/ptdma/ptdma-dmaengine.c
+++ b/drivers/dma/ptdma/ptdma-dmaengine.c
@@ -233,9 +233,14 @@ static void pt_issue_pending(struct dma_chan *dma_chan)
struct pt_dma_chan *chan = to_pt_chan(dma_chan);
struct pt_dma_desc *desc;
unsigned long flags;
+ bool engine_is_idle = true;
spin_lock_irqsave(&chan->vc.lock, flags);
+ desc = pt_next_dma_desc(chan);
+ if (desc)
+ engine_is_idle = false;
+
vchan_issue_pending(&chan->vc);
desc = pt_next_dma_desc(chan);
@@ -243,7 +248,7 @@ static void pt_issue_pending(struct dma_chan *dma_chan)
spin_unlock_irqrestore(&chan->vc.lock, flags);
/* If there was nothing active, start processing */
- if (desc)
+ if (engine_is_idle)
pt_cmd_callback(desc, 0);
}