public inbox for dmaengine@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/5] dmaengine: dma-axi-dmac: Add cyclic transfer support and graceful termination
@ 2026-03-03 10:24 Nuno Sá via B4 Relay
  2026-03-03 10:25 ` [PATCH v2 1/5] dmaengine: Document cyclic transfer for dmaengine_prep_peripheral_dma_vec() Nuno Sá via B4 Relay
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Nuno Sá via B4 Relay @ 2026-03-03 10:24 UTC (permalink / raw)
  To: dmaengine; +Cc: Lars-Peter Clausen, Vinod Koul, Frank Li

This series adds support for cyclic transfers in the .device_prep_peripheral_dma_vec()
callback and implements graceful termination of cyclic transfers using the
DMA_PREP_LOAD_EOT flag. Using DMA_PREP_REPEAT and DMA_PREP_LOAD_EOT is
based on the discussion in [1].

Currently, the only way to stop a cyclic transfer is through brute force using
.device_terminate_all(), which terminates all pending transfers. This series
introduces a mechanism to gracefully terminate individual cyclic transfers when
a new transfer flagged with DMA_PREP_LOAD_EOT is queued.

We need two different approaches:

1. Software-managed cyclic transfers: These generate EOT (End-Of-Transfer)
   interrupts for each cycle. Hence, termination can be handled directly
   in the interrupt handler when the EOT interrupt fires, making the
   transition to the next transfer straightforward.

2. Hardware-managed cyclic transfers: These are optimized to avoid interrupt
   overhead by suppressing EOT interrupts. Since there are no EOT interrupts,
   termination must be detected at SOF (Start-Of-Frame) when new transfers
   are being considered. The transfer is marked for termination and the
   hardware is configured to end the current cycle gracefully.

For HW-managed cyclic mode, the series handles both scatter-gather and non-SG
variants. With SG support, the last segment flags are modified to trigger EOT.
Without SG, the CYCLIC flag is cleared to allow natural completion. A workaround
is included for older IP cores (pre-4.6.a) that can prefetch data incorrectly
when clearing the CYCLIC flag, requiring a core disable/enable cycle.

Frank, I opted to not go with your style suggestion for axi_dmac_get_next_desc()
given that it seems to boil down to preference preference (there's no
80 col limit cross) and I do have a slight preference for the current
style. So, unless Vinod jumps in with some preference, I would prefer to
keep it.

Another meaningful change is that ADI hdl team will start to use
semantic versioning for the hdl cores [2]. So increasing the minor number to
6 will lead to 4.6.0 instead of 4.6.a.

[1]: https://lore.kernel.org/dmaengine/ZhJW9JEqN2wrejvC@matsya/
[2]: https://github.com/analogdevicesinc/hdl/pull/1831

---
Changes in v2:
- All patches but 1:
  * Be consistent with git subject.
- Patch 4:
  * Refactor commit message to avoid "we".
- Patch 5:
  * Use semantic versioning for the condition detecting
    hw_cyclic_hotfix. 
- Link to v1: https://lore.kernel.org/r/20260127-axi-dac-cyclic-support-v1-0-b32daca4b3c7@analog.com

---
Nuno Sá (5):
      dmaengine: Document cyclic transfer for dmaengine_prep_peripheral_dma_vec()
      dmaengine: dma-axi-dmac: Add cyclic transfers in .device_prep_peripheral_dma_vec()
      dmaengine: dma-axi-dmac: Add helper for getting next desc
      dmaengine: dma-axi-dmac: Gracefully terminate SW cyclic transfers
      dmaengine: dma-axi-dmac: Gracefully terminate HW cyclic transfers

 drivers/dma/dma-axi-dmac.c | 170 +++++++++++++++++++++++++++++++++++++++------
 include/linux/dmaengine.h  |   3 +-
 2 files changed, 151 insertions(+), 22 deletions(-)
---
base-commit: c8e9b1d9febc83ee94944695a07cfd40a1b29743
change-id: 20260126-axi-dac-cyclic-support-a06721b2e107
--

Thanks!
- Nuno Sá



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

end of thread, other threads:[~2026-03-23  9:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-03 10:24 [PATCH v2 0/5] dmaengine: dma-axi-dmac: Add cyclic transfer support and graceful termination Nuno Sá via B4 Relay
2026-03-03 10:25 ` [PATCH v2 1/5] dmaengine: Document cyclic transfer for dmaengine_prep_peripheral_dma_vec() Nuno Sá via B4 Relay
2026-03-03 10:25 ` [PATCH v2 2/5] dmaengine: dma-axi-dmac: Add cyclic transfers in .device_prep_peripheral_dma_vec() Nuno Sá via B4 Relay
2026-03-03 10:25 ` [PATCH v2 3/5] dmaengine: dma-axi-dmac: Add helper for getting next desc Nuno Sá via B4 Relay
2026-03-03 10:25 ` [PATCH v2 4/5] dmaengine: dma-axi-dmac: Gracefully terminate SW cyclic transfers Nuno Sá via B4 Relay
2026-03-03 10:25 ` [PATCH v2 5/5] dmaengine: dma-axi-dmac: Gracefully terminate HW " Nuno Sá via B4 Relay
2026-03-09  7:46 ` [PATCH v2 0/5] dmaengine: dma-axi-dmac: Add cyclic transfer support and graceful termination Vinod Koul
2026-03-09 13:30   ` Nuno Sá
2026-03-17 10:09     ` Vinod Koul
2026-03-23  9:34       ` Nuno Sá

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