DMA Engine development
 help / color / mirror / Atom feed
From: Samarth Narang <samarth.colleges@gmail.com>
To: Vinod Koul <vkoul@kernel.org>
Cc: Samarth Narang <samarth.colleges@gmail.com>,
	Frank Li <Frank.Li@kernel.org>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: dmaengine: pl330: no device_synchronize -- does terminate_sync guarantee the transfer stopped?
Date: Sat, 31 Oct 2026 00:58:20 +0000	[thread overview]
Message-ID: <20261031005820.3354888-1-samarth.colleges@gmail.com> (raw)

Hello,

I'm trying to clarify the termination guarantees provided by the PL330
DMAengine driver.

PL330 does not implement device_synchronize. Consequently, for PL330
channels, dmaengine_terminate_sync() calls pl330_terminate_all() without
any additional provider-specific synchronization.

pl330_terminate_all() requests termination through _stop(), which issues
DMAKILL using the controller's debug interface. However, I could not
establish from the driver code that this operation waits for the channel
thread to reach STOPPED or guarantees that all outstanding bus writes
have completed before returning.

There is a separate callback concern: PL330 uses a per-channel
completion tasklet, but pl330_terminate_all() does not explicitly
synchronize or kill that tasklet. The tasklet is killed in
pl330_free_chan_resources().

DMAengine clients rely on dmaengine_terminate_sync(), or
dmaengine_terminate_async() followed by dmaengine_synchronize(), to
establish that the DMA operation and its callbacks have completed before
unmapping or freeing buffers, as described in
Documentation/driver-api/dmaengine/client.rst.

One relevant client is Samsung UART on Exynos. Its release_dma() path
has a proposed change to use dmaengine_terminate_sync() before unmapping
and freeing the RX buffer [1]. The safety of that ordering depends on
the guarantees provided by PL330.

I have two questions:

Hardware completion: Does DMAKILL guarantee that all outstanding DMA bus
transactions have completed before the command finishes, or is an
additional wait for the channel to reach STOPPED required?

Callback synchronization: Can a PL330 completion tasklet still be
running or become scheduled after pl330_terminate_all() returns? If so,
would implementing device_synchronize to wait for the appropriate
hardware retirement condition and synchronize the tasklet be the
preferred approach?

I'm particularly interested in whether PL330 currently satisfies the
DMAengine synchronous-termination contract, or whether an additional
synchronization mechanism is needed.

This question arose from a research static analyzer for DMA lifecycle
ordering and a subsequent source review.

[1] https://lore.kernel.org/r/20261030162334.3000737-1-samarth.colleges@gmail.com

Thanks,
Samarth

                 reply	other threads:[~2026-10-31  0:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261031005820.3354888-1-samarth.colleges@gmail.com \
    --to=samarth.colleges@gmail.com \
    --cc=Frank.Li@kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --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