public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vinod Koul <vkoul@kernel.org>
To: Manivannan Sadhasivam <mani@kernel.org>
Cc: Bartosz Golaszewski <brgl@kernel.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Thara Gopinath <thara.gopinath@gmail.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	Udit Tiwari <quic_utiwari@quicinc.com>,
	Daniel Perez-Zoghbi <dperezzo@quicinc.com>,
	Md Sadre Alam <mdalam@qti.qualcomm.com>,
	Dmitry Baryshkov <lumag@kernel.org>,
	dmaengine@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-crypto@vger.kernel.org,
	Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: Re: [PATCH v9 03/11] dmaengine: qcom: bam_dma: implement support for BAM locking
Date: Wed, 25 Feb 2026 15:22:11 +0530	[thread overview]
Message-ID: <aZ7GS5W1VNNB2fLi@vaman> (raw)
In-Reply-To: <xuiiqsrj63rtg4onuu2vmohwu2b2sd3so5uzakdzuucmwqaufn@7xwecs4apayt>

On 19-02-26, 20:10, Manivannan Sadhasivam wrote:
> On Thu, Feb 19, 2026 at 07:30:04AM -0600, Bartosz Golaszewski wrote:
> > On Thu, 19 Feb 2026 13:12:09 +0100, Manivannan Sadhasivam
> > <mani@kernel.org> said:
> > > On Fri, Jan 09, 2026 at 03:15:38PM +0100, Bartosz Golaszewski wrote:
> > >> On Fri, Jan 9, 2026 at 3:27 AM Vinod Koul <vkoul@kernel.org> wrote:
> > >> >
> > >> > >
> > >> > > We need an API because we send a locking descriptor, then a regular
> > >> > > descriptor (or descriptors) for the actual transaction(s) and then an
> > >> > > unlocking descriptor. It's a thing the user of the DMA engine needs to
> > >> > > decide on, not the DMA engine itself.
> > >> >
> > >> > I think downstream sends lock descriptor always. What is the harm in
> > >> > doing that every time if we go down that path?
> > >>
> > >> No, in downstream it too depends on the user setting the right bits.
> > >> Currently the only user of the BAM locking downstream is the NAND
> > >> driver. I don't think the code where the crypto driver uses it is
> > >> public yet.
> > >>
> > >> And yes, there is harm - it slightly impacts performance. For QCE it
> > >> doesn't really matter as any users wanting to offload skcipher or SHA
> > >> are better off using the Arm Crypto Extensions anyway as they are
> > >> faster by an order of magnitude (!). It's also the default upstream,
> > >> where the priorities are set such that the ARM CEs are preferred over
> > >> the QCE. QCE however, is able to coordinate with the TrustZone and
> > >> will be used to support the DRM use-cases.
> > >>
> > >> I prefer to avoid impacting any other users of BAM DMA.
> > >>
> > >
> > > Sorry for jumping late. But I disagree with the argument that the client drivers
> > > have to set the LOCK/UNLOCK bit. These bits are specific to BAM DMA IP for
> > > serializing the command descriptors from multiple entities. So DMA clients like
> > > Crypto/NAND have no business in setting this flag. It is the job of the BAM
> > > dmaengine driver to set/unset it at the start and end of the descriptor chain.
> > >
> > 
> > But what if a given client does not need locking? We don't want to enable it
> > for everyone - as I explained before.
> > 
> 
> That's not going to hurt. AFAIK, enabling locking wouldn't cause any notable
> performance overhead.

I was always skeptical on this one. I had never seen why locking should
be pushed to clients. As Bjorn said it leads to more mess than worth it.
Thanks Mnai

> 
> > >> > Reg Dmitry question above, this is dma hw capability, how will client
> > >> > know if it has to lock on older rev of hardware or not...?
> > >> >
> > >> > > Also: only the crypto engine needs it for now, not all the other users
> > >> > > of the BAM engine.
> > >> >
> > >>
> > >> Trying to set the lock/unlock bits will make
> > >> dmaengine_desc_attach_metadata() fail if HW does not support it.
> > >>
> > >
> > > The BAM dmaengine driver *must* know based on the IP version whether it supports
> > > the LOCK/UNLOCK bits or not, not the client drivers. How can the client drivers
> > > know about the BAM DMA IP capability?

Lock bits are on the BAM DMA IP or client? Can we not add this
capability to BAM driver and lock for IPs that support

> > >
> > 
> > FYI: the current version of this is v10[1].
> > 
> > In it (and in this one too but let's discuss the current one) the BAM driver
> > *does* know *based on IP version* whether is supports locking or not. The client
> > requests a lock but this will fail if the BAM does not support it. The
> > client does
> > not check the BAM IP revision. So yes: it's the BAM driver that's in charge.
> > 
> 
> This design looks flawed. The client *doesn't* know whether it needs locking or
> not. If the BAM supports locking, it should enable it for all descriptors.

Ack

> 
> > > For all these reasons, BAM driver should handle the locking mechanism internaly.
> > > This will allow the client drivers to work without any modifications.
> > >
> > 
> > Ok, I'm open to alternatives but please help me figure out the "hows": How do
> > you tell the BAM driver that the client needs (or does not) locking?
> 
> As said above, BAM doesn't need to know. Locking is the hardware capability of
> the BAM, not clients.
> 
> > How do
> > you handle the case where we need to lock the BAM, send an arbitrary number
> > of descriptors from the client and then unlock it? How can the BAM know *when*
> > to lock/unlock?
> > 
> 
> BAM driver has to perform lock during issue_pending() and unlock while reporting
> the completion using vchan_cookie_complete().

Sounds good to me, thanks Mani

-- 
~Vinod

  reply	other threads:[~2026-02-25  9:52 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-28 11:43 [PATCH v9 00/11] crypto/dmaengine: qce: introduce BAM locking and use DMA for register I/O Bartosz Golaszewski
2025-11-28 11:43 ` [PATCH v9 01/11] dmaengine: qcom: bam_dma: Extend the driver's device match data Bartosz Golaszewski
2025-11-28 11:44 ` [PATCH v9 02/11] dmaengine: qcom: bam_dma: Add bam_pipe_lock flag support Bartosz Golaszewski
2025-12-06 11:42   ` Dmitry Baryshkov
2025-11-28 11:44 ` [PATCH v9 03/11] dmaengine: qcom: bam_dma: implement support for BAM locking Bartosz Golaszewski
2025-12-06 11:44   ` Dmitry Baryshkov
2025-12-16 13:00   ` Vinod Koul
2025-12-16 15:00     ` Bartosz Golaszewski
2025-12-16 15:10       ` Vinod Koul
2025-12-17 14:31         ` Bartosz Golaszewski
2025-12-23 10:45           ` Vinod Koul
2025-12-23 12:35             ` Bartosz Golaszewski
2025-12-23 20:19               ` Dmitry Baryshkov
2025-12-24  8:58                 ` Bartosz Golaszewski
2025-12-24  9:33                   ` Dmitry Baryshkov
2026-01-01 12:00               ` Vinod Koul
2026-01-02  9:26                 ` Bartosz Golaszewski
2026-01-02 16:59                   ` Vinod Koul
2026-01-02 17:14                     ` Bartosz Golaszewski
2026-01-06 12:20                       ` Bartosz Golaszewski
2026-01-09  2:27                       ` Vinod Koul
2026-01-09 14:15                         ` Bartosz Golaszewski
2026-01-14 15:37                           ` Bartosz Golaszewski
2026-01-22  9:33                             ` Bartosz Golaszewski
2026-02-03 13:39                               ` Bartosz Golaszewski
2026-02-19 12:12                           ` Manivannan Sadhasivam
2026-02-19 12:49                             ` Dmitry Baryshkov
2026-02-19 13:26                             ` Bjorn Andersson
2026-02-19 13:30                             ` Bartosz Golaszewski
2026-02-19 14:40                               ` Manivannan Sadhasivam
2026-02-25  9:52                                 ` Vinod Koul [this message]
2026-02-27 21:32                                   ` Bartosz Golaszewski
2026-01-14 16:04                         ` Dmitry Baryshkov
2025-11-28 11:44 ` [PATCH v9 04/11] crypto: qce - Include algapi.h in the core.h header Bartosz Golaszewski
2025-11-28 11:44 ` [PATCH v9 05/11] crypto: qce - Remove unused ignore_buf Bartosz Golaszewski
2025-11-28 12:01   ` Konrad Dybcio
2025-11-28 12:05     ` Bartosz Golaszewski
2025-11-28 12:09       ` Konrad Dybcio
2025-11-28 11:44 ` [PATCH v9 06/11] crypto: qce - Simplify arguments of devm_qce_dma_request() Bartosz Golaszewski
2025-11-28 11:44 ` [PATCH v9 07/11] crypto: qce - Use existing devres APIs in devm_qce_dma_request() Bartosz Golaszewski
2025-11-28 12:03   ` Konrad Dybcio
2025-11-28 11:44 ` [PATCH v9 08/11] crypto: qce - Map crypto memory for DMA Bartosz Golaszewski
2025-11-28 11:44 ` [PATCH v9 09/11] crypto: qce - Add BAM DMA support for crypto register I/O Bartosz Golaszewski
2025-11-28 11:44 ` [PATCH v9 10/11] crypto: qce - Add support for BAM locking Bartosz Golaszewski
2025-12-01 13:03   ` Konrad Dybcio
2025-12-18 15:32     ` Bartosz Golaszewski
2025-11-28 11:44 ` [PATCH v9 11/11] crypto: qce - Switch to using BAM DMA for crypto I/O Bartosz Golaszewski
2025-11-28 12:08   ` Konrad Dybcio
2025-11-28 12:11     ` Bartosz Golaszewski
2025-11-28 12:57       ` Konrad Dybcio
2025-12-06 11:45   ` Dmitry Baryshkov

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=aZ7GS5W1VNNB2fLi@vaman \
    --to=vkoul@kernel.org \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=brgl@kernel.org \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=dmaengine@vger.kernel.org \
    --cc=dperezzo@quicinc.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lumag@kernel.org \
    --cc=mani@kernel.org \
    --cc=mdalam@qti.qualcomm.com \
    --cc=quic_utiwari@quicinc.com \
    --cc=thara.gopinath@gmail.com \
    /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