Skip to contentSkip to conversation

dmaengine: xilinx_dma: Fix freeup active list based on descriptor completion bit

PATCH In review Marek Vasut 2 participants 4 messages Oct 31, 2024 – Nov 11, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dmaengine: xilinx_dma: Fix freeup active list based on descriptor completion bit

The xilinx_dma is completely broken since the referenced commit, because if the (seg->hw.status & XILINX_DMA_BD_COMP_MASK) is not set for whatever reason, the current descriptor is never moved to the done list, and the DMA stops moving data.

Isolate the newly added check to DMA which does implement irq_delay, that way the new check is matching what is likely some new bit in a new core, without breaking the DMA for older versions of the same core.

Fixes 7bcdaa658102 ("dmaengine: xilinx_dma: Freeup active list based on descriptor completion bit")

---
Cc: "Uwe Kleine-König" <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Peter Korsgaard <[email protected]>
Cc: Radhey Shyam Pandey <[email protected]>
Cc: Vinod Koul <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 drivers/dma/xilinx/xilinx_dma.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/dma/xilinx/xilinx_dma.c +2 -1
index 1bdd57de87a6e..48647c8a64a5b 100644
@@ -1718,7 +1718,8 @@ static void xilinx_dma_complete_descriptor(struct xilinx_dma_chan *chan)
 		return;
 
 	list_for_each_entry_safe(desc, next, &chan->active_list, node) {
-		if (chan->xdev->dma_config->dmatype == XDMA_TYPE_AXIDMA) {
+		if (chan->xdev->dma_config->dmatype == XDMA_TYPE_AXIDMA &&
+		    chan->irq_delay) {
 			struct xilinx_axidma_tx_segment *seg;
 
 			seg = list_last_entry(&desc->segments,
Signature · 1 line
2.45.2
#1 lore raw
Quoted 12 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Thursday, October 31, 2024 10:28 PM
To: [email protected]
Cc: Marek Vasut <[email protected]>; Uwe Kleine-König <u.kleine- [email protected]>; Simek, Michal <[email protected]>; Peter Korsgaard <[email protected]>; Pandey, Radhey Shyam <[email protected]>; Vinod Koul <[email protected]>; linux-arm- [email protected]
Subject: [PATCH] dmaengine: xilinx_dma: Fix freeup active list based on descriptor completion bit

Quoted 3 lines

The xilinx_dma is completely broken since the referenced commit, because if the (seg->hw.status & XILINX_DMA_BD_COMP_MASK) is not set for whatever reason, the current descriptor is never moved to

I want to understand more on this failure scenario. How to replicate it?

Why is completion bit not set ? Based on the documentation completed bit indicates to the software that the DMA Engine has completed the transfer as described by the associated descriptor. The DMA Engine sets this bit to 1 when the transfer is completed.

Quoted 40 lines

the done list, and the DMA stops moving data.

Isolate the newly added check to DMA which does implement irq_delay, that way the new check is matching what is likely some new bit in a new core, without breaking the DMA for older versions of the same core.

Fixes 7bcdaa658102 ("dmaengine: xilinx_dma: Freeup active list based on

descriptor completion bit")

---
Cc: "Uwe Kleine-König" <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Peter Korsgaard <[email protected]>
Cc: Radhey Shyam Pandey <[email protected]>
Cc: Vinod Koul <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 drivers/dma/xilinx/xilinx_dma.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/dma/xilinx/xilinx_dma.c +1 -1
index 1bdd57de87a6e..48647c8a64a5b 100644
@@ -1718,7 +1718,8 @@ static void xilinx_dma_complete_descriptor(struct
 xilinx_dma_chan *chan)
 		return;
 
 	list_for_each_entry_safe(desc, next, &chan->active_list, node) {
-		if (chan->xdev->dma_config->dmatype == XDMA_TYPE_AXIDMA) {
+		if (chan->xdev->dma_config->dmatype == XDMA_TYPE_AXIDMA

&&

drivers/dma/xilinx/xilinx_dma.c +1 -1
+		    chan->irq_delay) {
 			struct xilinx_axidma_tx_segment *seg;
 
 			seg = list_last_entry(&desc->segments,
--

2.45.2

#2 lore raw
Quoted 12 lines · Radhey Shyam
Quoted 12 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Thursday, October 31, 2024 10:28 PM
To: [email protected]
Cc: Marek Vasut <[email protected]>; Uwe Kleine-König <u.kleine- [email protected]>; Simek, Michal <[email protected]>; Peter Korsgaard <[email protected]>; Pandey, Radhey Shyam <[email protected]>; Vinod Koul <[email protected]>; linux-arm- [email protected]
Subject: [PATCH] dmaengine: xilinx_dma: Fix freeup active list based on descriptor completion bit

Quoted 5 lines
Quoted 3 lines

The xilinx_dma is completely broken since the referenced commit, because if the (seg->hw.status & XILINX_DMA_BD_COMP_MASK) is not set for whatever reason, the current descriptor is never moved to

I want to understand more on this failure scenario. How to replicate it?

The very basic test is to use AXI DMA for DMA transfer, which fails to complete because of this new chunk of code. By reading the commit history, I can only conclude this was something that got added due to the irq_delay, but was never tested on core without irq_delay support ?

Quoted 4 lines

Why is completion bit not set ? Based on the documentation completed bit indicates to the software that the DMA Engine has completed the transfer as described by the associated descriptor. The DMA Engine sets this bit to 1 when the transfer is completed.

I don't know, the bit was not used before you added the bit and check of the bit in the problematic commit 7bcdaa658102 ("dmaengine: xilinx_dma: Freeup active list based on descriptor completion bit")

#3 lore raw
Quoted 29 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Wednesday, November 6, 2024 5:12 PM
To: Pandey, Radhey Shyam <[email protected]>; [email protected]
Cc: Uwe Kleine-König <[email protected]>; Simek, Michal <[email protected]>; Peter Korsgaard <[email protected]>; Vinod Koul <[email protected]>; [email protected]; Katakam, Harini <[email protected]>
Subject: Re: [PATCH] dmaengine: xilinx_dma: Fix freeup active list based on descriptor completion bit

Quoted 16 lines · Radhey Shyam
Quoted 15 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Thursday, October 31, 2024 10:28 PM
To: [email protected]
Cc: Marek Vasut <[email protected]>; Uwe Kleine-König <u.kleine- [email protected]>; Simek, Michal <[email protected]>; Peter Korsgaard <[email protected]>; Pandey, Radhey Shyam <[email protected]>; Vinod Koul <[email protected]>; linux-arm- [email protected]
Subject: [PATCH] dmaengine: xilinx_dma: Fix freeup active list based on descriptor completion bit

The xilinx_dma is completely broken since the referenced commit, because if the (seg->hw.status & XILINX_DMA_BD_COMP_MASK) is not set for whatever reason, the current descriptor is never moved to

Quoted 6 lines
Quoted 1 line

I want to understand more on this failure scenario. How to replicate it?

The very basic test is to use AXI DMA for DMA transfer, which fails to complete because of this new chunk of code. By reading the commit history, I can only conclude this was something that got added due to the irq_delay, but was never tested on core without irq_delay support ?

This commit is also present in downstream xilinx kernel and all legacy regression are working fine without xlnx,irq-delay. Added Abin to this thread who confirmed that axidmatest client[1] works without IRQ delay.

[1]: https://github.com/Xilinx/linux-xlnx/blob/master/drivers/dma/xilinx/axidmatest.c

So I want to understand what is the test client you are using?

Quoted 8 lines
Quoted 5 lines

Why is completion bit not set ? Based on the documentation completed bit indicates to the software that the DMA Engine has completed the transfer as described by the associated descriptor. The DMA Engine sets this bit to 1 when the transfer is completed.

I don't know, the bit was not used before you added the bit and check of the bit in the problematic commit 7bcdaa658102 ("dmaengine: xilinx_dma:
Freeup active list based on descriptor completion bit")