[PATCH v3 0/3] dmaengine: sun4i: retain cyclic descriptors until callbacks drain

From: James Hilliard

Date: Thu Nov 19 2026 - 13:03:14 EST


Retain descriptors through callback synchronization using a shared virt-dma
termination helper, then use it to fix sun4i cyclic callback lifetime
and IRQ serialization. The helper keeps termination usable in atomic
context while callbacks finish in process-context synchronization.

Also serialize pending IRQ handling with physical-channel reuse so an
old transfer's interrupt state cannot complete its replacement or disable
the replacement's interrupts.

Assisted-by: Codex:gpt-6-astra
Signed-off-by: James Hilliard <james.hilliard1@xxxxxxxxx>

---
Changes in v3:
- Leave prepared descriptors with the client during termination so they
can still be submitted after synchronization, following Frank's review:
https://lore.kernel.org/r/av8mu_ZFxNKSgFTK@SMW015318/
- Link to v2: https://patch.msgid.link/20261115-submit-sun4i-dma-callback-lifetime-v1-v2-0-fb7d258702f8@xxxxxxxxx

Changes in v2:
- Add a shared virt-dma descriptor-retirement helper before the sun4i
fix, following Frank's review.
- Retain all collected descriptors until synchronization, avoiding
provider-specific cyclic checks and preserving repeated termination.
- Retire pending IRQ state before physical-channel reuse and acknowledge
events under the owning virtual channel's lock in a separate fix.
- Link to v1: https://patch.msgid.link/20261103-submit-sun4i-dma-callback-lifetime-v1-v1-1-4c5a0653104f@xxxxxxxxx

---
James Hilliard (3):
dmaengine: virt-dma: share deferred descriptor retirement
dmaengine: sun4i: retain cyclic descriptors until callbacks drain
dmaengine: sun4i: retire interrupt state before channel reuse

drivers/dma/sun4i-dma.c | 68 +++++++++++++++++++++++++++++--------------------
drivers/dma/virt-dma.h | 21 ++++++++++++++-
2 files changed, 60 insertions(+), 29 deletions(-)
---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
base-tree: git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git fixes
change-id: 20261103-submit-sun4i-dma-callback-lifetime-v1-b6192060b76f

Best regards,
--
James Hilliard <james.hilliard1@xxxxxxxxx>