From: James Hilliard <james.hilliard1@gmail.com>
To: Viresh Kumar <vireshk@kernel.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Vinod Koul <vkoul@kernel.org>, Frank Li <Frank.Li@kernel.org>,
Dan Williams <djbw@kernel.org>
Cc: "Serge Semin" <fancer.lancer@gmail.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Jiri Slaby" <jirislaby@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
dmaengine@vger.kernel.org, linux-serial@vger.kernel.org,
linux-kernel@vger.kernel.org, Sashiko <sashiko-bot@kernel.org>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"James Hilliard" <james.hilliard1@gmail.com>,
stable@vger.kernel.org, "Frank Li" <Frank.Li@nxp.com>
Subject: [PATCH v8 0/6] dmaengine: dw: serialize completion and termination
Date: Mon, 16 Nov 2026 03:52:28 -0700 [thread overview]
Message-ID: <20261116-submit-dw-dma-synchronize-v1-v8-0-4a82d64fcd1a@gmail.com> (raw)
Use virt-dma for transaction ownership, deferred client callbacks and
per-channel synchronization. Keep DW hardware event processing under the
same channel lock, including polled completion and software-LLP progress.
The first two patches serialize completion and error recovery with
termination. The third replaces the private descriptor queues with
virt-dma, including cookie accounting, callback synchronization and channel
release. Three separate patches then extract hardware-LLP residue
calculation, calculate it in the status getter and report queued residue.
Status polling can complete transfers without invoking client callbacks in
the polling context, while synchronization waits for callbacks already
running on the selected channel.
Each whole transaction has one virt-dma descriptor. Its child hardware LLIs
remain owned by the driver and are freed together after the callback.
The controller tasklet continues to process hardware events; virt-dma
handles client notifications. Submitted transactions become eligible to
start at issue_pending(), and residue lookup covers both submitted and
issued queues.
The series builds on Serge Semin's channel-restart and callback work
[0-2], using virt-dma following Andy's review [3].
Based on dmaengine/fixes at 6628e7d4c6b2.
[0] https://lore.kernel.org/r/20240911184710.4207-1-fancer.lancer@gmail.com
[1] https://lore.kernel.org/r/20240911184710.4207-2-fancer.lancer@gmail.com
[2] https://lore.kernel.org/r/20240911184710.4207-3-fancer.lancer@gmail.com
[3] https://lore.kernel.org/r/avrHOJ-fVZOO32bI@ashevche-desk.local
Assisted-by: Codex:gpt-6-astra
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
Changes in v8:
- Replace the private callback-deferral and synchronization patches with
a virt-dma conversion, following Andy's review.
- Place the conversion after the completion and error-recovery fixes,
incorporating cookie ordering, completion-list cleanup and channel-release
draining in the same patch.
- Keep residue extraction, status calculation and queued-residue reporting
separate, adapting them to virt-dma's active, issued and submitted state.
- Use per-channel virt-dma callback draining while preserving polled
completion, software-LLP advancement and controller-tasklet exclusion
during resource release.
- Keep child hardware LLIs under a single transaction descriptor and
distinguish submitted transactions from issued work.
- Correct the residue-calculation and queued-residue Fixes tags to identify
the commits that introduced the affected paths, following Sashiko's review.
- Attribute the cookie-completion and channel-release fixes included in the
conversion to the lock-splitting change, following Andy's tag review.
- Link to v7: https://patch.msgid.link/20261115-submit-dw-dma-synchronize-v1-v7-0-8d58f3d49e4d@gmail.com
Changes in v7:
- Use a scoped channel-lock guard in dwc_tx_status(), following Frank's
review, keeping polled completion and residue lookup in the same scope.
- Collect Frank's Reviewed-by tags for the residue and completion patches.
- Link to v6: https://patch.msgid.link/20261103-submit-dw-dma-synchronize-v1-v6-0-2ee0c348224d@gmail.com
Changes in v6:
- Keep dwc_get_hard_llp_desc_residue() next to dwc_get_sent() when
converting it to return residue, following Frank's review.
- Remove inherited RFC notes from the individual patches, retaining
the revision history in this cover letter.
- Link to v5: https://patch.msgid.link/20261102-submit-dw-dma-synchronize-v1-v5-0-d3207758fbf9@gmail.com
Changes in v5:
- Rebase onto dmaengine/fixes at 6628e7d4c6b2, using the shared
dmaengine_chan_dev() helper for channel logging.
- Split residue handling into a behavior-preserving extraction, status
calculation, scanner simplification and queued-residue reporting,
following Frank's review.
- Share completed-descriptor freeing between the tasklet and channel
release, retaining callbacks for normal completion and suppressing
them during teardown. Name the helper dwc_free_completed().
- Carry Frank's additional review tags and put the submitter sign-off
after the review tags.
- Link to v4: https://patch.msgid.link/20261029-submit-dw-dma-synchronize-v1-v4-0-fea447d9f285@gmail.com
Changes in v4:
- Split v3's callback-deferral patch into cookie accounting, residue
calculation, channel-release draining and callback-deferral patches,
following Frank's review. The resulting seven-patch series preserves
v3's final implementation.
- Place device_synchronize before callback deferral so clients can drain
deferred notifications when the completion list is introduced.
- Carry Frank's Reviewed-by tags on the unchanged channel-completion,
error-recovery and device_synchronize patches.
- Link to v3: https://patch.msgid.link/20261023-submit-dw-dma-synchronize-v1-v3-0-c62bf048f5ce@gmail.com
Changes in v3:
- Order channel-completion and error-recovery locking before callback
deferral, retaining four patches.
- Require a locked RAW.XFER event before retiring a transfer; zero source
residue alone cannot establish destination completion.
- Preserve polled completion and software-LLP progress in tx_status(),
queuing client notifications for the controller tasklet.
- Serialize cookie updates with termination and report queued residue.
- Drain deferred notifications on channel release and let a pending
tasklet return without MMIO after the last channel is released.
- Adapt Serge's two patches and retain his authorship and revision notes.
Drop the Tested-by tags that covered their earlier implementations.
- Identify the introduction of the synchronization API in the final
patch's Fixes tag.
- Link to v2: https://patch.msgid.link/20261022-submit-dw-dma-synchronize-v1-v2-0-5244e94dca8c@gmail.com
Changes in v2:
- Carry Serge Semin's two posted fixes before the synchronization change,
preserving his authorship and revision notes. Add the requested stable
Cc trailers and Andy Shevchenko's Tested-by tags to those unchanged fixes.
- Add a separate error-recovery fix for stale error status, empty channel
lists and software-LLP state when terminating or restarting a channel.
- Use tasklet_disable()/tasklet_enable() instead of tasklet_kill() so
synchronization preserves scheduling requests from other channels.
- Explain descriptor ownership during termination and acknowledge the
shared-tasklet scheduling race reported by Sashiko.
- Link to v1: https://patch.msgid.link/20261021-submit-dw-dma-synchronize-v1-v1-1-6af85c2d6f69@gmail.com
Revision history from Serge's series:
Link: https://lore.kernel.org/dmaengine/20240802080756.7415-1-fancer.lancer@gmail.com/
Changelog RFC:
- Add a new patch:
[PATCH 2/2] dmaengine: dw: Fix XFER bit set, but channel not idle error
fixing the "XFER bit set, but channel not idle" error.
- Instead of just dropping the dwc_scan_descriptors() method invocation
calculate the residue in the Tx-status getter.
---
James Hilliard (3):
dmaengine: dw: serialize error recovery with channel termination
dmaengine: dw: use virt-dma for descriptor and callback ownership
dmaengine: dw: report residue for queued transfers
Serge Semin (3):
dmaengine: dw: Fix XFER bit set, but channel not idle error
dmaengine: dw: extract hardware-LLP residue calculation
dmaengine: dw: calculate residue in the status getter
drivers/dma/dw/Kconfig | 1 +
drivers/dma/dw/core.c | 493 ++++++++++++++++++++----------------------------
drivers/dma/dw/dw.c | 2 +-
drivers/dma/dw/idma32.c | 18 +-
drivers/dma/dw/regs.h | 24 +--
5 files changed, 226 insertions(+), 312 deletions(-)
---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
base-tree: git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git fixes
change-id: 20261021-submit-dw-dma-synchronize-v1-e550f47fd1da
Best regards,
--
James Hilliard <james.hilliard1@gmail.com>
next reply other threads:[~2026-11-16 10:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 10:52 James Hilliard [this message]
2026-11-16 10:52 ` [PATCH v8 1/6] dmaengine: dw: Fix XFER bit set, but channel not idle error James Hilliard
2026-11-16 10:52 ` [PATCH v8 2/6] dmaengine: dw: serialize error recovery with channel termination James Hilliard
2026-11-16 10:52 ` [PATCH v8 3/6] dmaengine: dw: use virt-dma for descriptor and callback ownership James Hilliard
2026-11-16 10:52 ` [PATCH v8 4/6] dmaengine: dw: extract hardware-LLP residue calculation James Hilliard
2026-11-16 10:52 ` [PATCH v8 5/6] dmaengine: dw: calculate residue in the status getter James Hilliard
2026-11-16 10:52 ` [PATCH v8 6/6] dmaengine: dw: report residue for queued transfers James Hilliard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261116-submit-dw-dma-synchronize-v1-v8-0-4a82d64fcd1a@gmail.com \
--to=james.hilliard1@gmail.com \
--cc=Frank.Li@kernel.org \
--cc=Frank.Li@nxp.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=djbw@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=fancer.lancer@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jirislaby@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=sashiko-bot@kernel.org \
--cc=stable@vger.kernel.org \
--cc=vireshk@kernel.org \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®