DMA Engine development
 help / color / mirror / Atom feed
* [PATCH v2 0/3] dmaengine: xilinx_dma: Fix AXI DMA descriptor ring ordering
@ 2026-11-16  3:43 Jeff C. Jensen via B4 Relay
  2026-11-16  3:43 ` [PATCH v2 1/3] dmaengine: xilinx_dma: Reject transfers that map no data Jeff C. Jensen via B4 Relay
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Jeff C. Jensen via B4 Relay @ 2026-11-16  3:43 UTC (permalink / raw)
  To: Vinod Koul, dmaengine
  Cc: Frank Li, Michal Simek, Suraj Gupta, Radhey Shyam Pandey,
	Alex Bereza, Folker Schwesinger, Tomi Valkeinen, linux-arm-kernel,
	linux-kernel, Jeff C. Jensen

This series fixes descriptor handling problems in the AXI DMA driver
that I ran into while streaming from programmable logic into a single
S2MM channel on a Zynq-7020.

Patches 1 and 2 are small fixes to the preparation paths. A transfer
whose entries are all zero length built a descriptor with no segments,
and the cyclic period count could be truncated on 64-bit builds.

Patch 3 is the main change. The driver hands out segments from a free
list, while the engine follows the descriptor ring in pool order, so the
two must stay in step. Commit cee9c863ee68 fixed one way they drift
apart. The Sashiko review of that commit [1] pointed out three more, and
patch 3 removes them all by allocating consecutive ring positions
instead of free list entries.

The series is based on v7.4-rc1, the dmaengine fixes branch at
6628e7d4c6b2, and builds on cee9c863ee68 and 7ed1e3070c9b.

Testing
=======

Every patch builds for arm (multi_v7_defconfig) and arm64 (defconfig),
with the driver built in and as a module, with W=1 and sparse, and
passes checkpatch --strict. I tested the series on hardware as a
backport to the AMD vendor kernel, described below; the patches as
posted, against v7.4-rc1, are build-tested only.

The backport ran on the AMD 6.12.40 vendor kernel together with
aa99c4d1d63b, cee9c863ee68 and 7ed1e3070c9b, and with 38433a6fdfb7 so
that the patches apply as posted, on a Zynq-7020 with one AXI DMA v7.1
S2MM channel: scatter-gather, 32-bit, no DRE and the 512-segment pool.
No client in these tests uses the dma_vec path, and the vendor kernel
lacks 607869003479, so the dma_vec path and the transfer chaining that
commit adds are build-tested only with these changes.

 - A test client streamed 640128-byte packets at 80 per second from a
   pattern generator, refilled the channel from the completion callback
   and from a thread on the other CPU, and checked every sample. Two 60
   s runs passed, each running out of segments about 15000 times. Cases
   for pool capacity, a zero-length scatterlist, the buffer-length
   boundary and cyclic followed by slave-sg also passed.

 - Our production client streamed nine sessions, more than 160000
   packets, with every sample checked on the receiving host.

To reproduce what patch 3 fixes: without the series, the test client ran
for 10 minutes without an error, both on the vendor kernel with the
three backports and on the vendor kernel with aa99c4d1d63b alone. The
windows are small, so I added a test-only 500 us busy-wait between the
completion callback and the free in xilinx_dma_chan_desc_cleanup(). The
test client terminates the channel once at the start of each run while
packets keep arriving. On the vendor kernel with the backports, all
three 20 s runs failed, one with a DMA internal error and two with the
channel stalled. With patches 1-3 added, the same three runs passed, and
so did one with a 2000 us busy-wait. I could not reproduce the
partial-preparation case: the test client serializes its preparations
against its own callback, which leaves that window open only between the
callback and the free.

Not tested: MM2S, two-channel controllers, CDMA, VDMA and MCDMA.

Known limitations
=================

 - The AXI MCDMA pool keeps its free list, so the terminate and
   partial-preparation problems remain there. My design does not use AXI
   MCDMA, and I did not test it. Extending the reservation to MCDMA
   would be possible future work.

 - The other two issues in the Sashiko review, the chan->terminating
   race with submit and dma_run_dependencies() under chan->lock, are not
   addressed here.

This series was developed with the help of Claude Code, an LLM coding
assistant; I reviewed all of the code and text.

[1] https://lore.kernel.org/all/20260817094004.A74621F000E9@smtp.kernel.org/

---
Changes in v2:
- Drop patch 4, which withheld an engine whose reset did not complete,
  and RFC patch 5, which recovered it: a reset timeout most likely
  means a hardware fault (Frank Li)
- Rebase onto v7.4-rc1 and collect Reviewed-by tags; patches 1-3 are
  otherwise unchanged
- Drop the Assisted-by tags after 1e035297ffda ("docs: remove
  Assisted-by references"); the cover letter states the tool use
- Link to v1: https://lore.kernel.org/r/20261022-xilinx-dma-work-v1-0-20faea2e7a80@nullptr.com

---
Jeff C. Jensen (3):
      dmaengine: xilinx_dma: Reject transfers that map no data
      dmaengine: xilinx_dma: Fix cyclic period count truncation
      dmaengine: xilinx_dma: Allocate AXI DMA segments in ring order

 drivers/dma/xilinx/xilinx_dma.c | 285 ++++++++++++++++++++++++++++++++--------
 1 file changed, 232 insertions(+), 53 deletions(-)
---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20261022-xilinx-dma-work-4f2fad787d15

Best regards,
-- 
Jeff C. Jensen <kernel@nullptr.com>



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

end of thread, other threads:[~2026-11-16  7:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-16  3:43 [PATCH v2 0/3] dmaengine: xilinx_dma: Fix AXI DMA descriptor ring ordering Jeff C. Jensen via B4 Relay
2026-11-16  3:43 ` [PATCH v2 1/3] dmaengine: xilinx_dma: Reject transfers that map no data Jeff C. Jensen via B4 Relay
2026-11-16  3:43 ` [PATCH v2 2/3] dmaengine: xilinx_dma: Fix cyclic period count truncation Jeff C. Jensen via B4 Relay
2026-11-16  3:43 ` [PATCH v2 3/3] dmaengine: xilinx_dma: Allocate AXI DMA segments in ring order Jeff C. Jensen via B4 Relay
2026-11-16  4:07   ` sashiko-bot
2026-11-16  7:10     ` Jeff C. Jensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox