Re: [PATCH v9 03/11] dmaengine: qcom: bam_dma: implement support for BAM locking

From: Bartosz Golaszewski

Date: Wed Dec 17 2025 - 09:32:04 EST


On Tue, Dec 16, 2025 at 4:11 PM Vinod Koul <vkoul@xxxxxxxxxx> wrote:
>
> > > > +
> > > > + switch (metadata->op) {
> > > > + case BAM_META_CMD_LOCK:
> > > > + if (bchan->bam_locked)
> > > > + return -EBUSY;
> > > > +
> > > > + hw_desc->flags |= DESC_FLAG_LOCK;
> > >
> > > Why does this flag imply for the hardware.
>
> s/Why/What !
> >
> > Please rephrase, I don't get what you mean.
>
> I am trying to understand what the flag refers to and why do you need
> this.. What is the problem that lock tries to solve
>

In the DRM use-case the TA will use the QCE simultaneously with linux.
It will perform register I/O with DMA using the BAM locking mechanism
for synchronization. Currently linux doesn't use BAM locking and is
using CPU for register I/O so trying to access locked registers will
result in external abort. I'm trying to make the QCE driver use DMA
for register I/O AND use BAM locking. To that end: we need to pass
information about wanting the command descriptor to contain the
LOCK/UNLOCK flag (this is what we set here in the hardware descriptor)
from the QCE driver to the BAM driver. I initially used a global flag.
Dmitry said it's too Qualcomm-specific and to use metadata instead.
This is what I did in this version.

As I said: I'm open to other suggestions but I'm not sure if we have
any other existing options.

What exactly is the problem with using the attach callback?

Bart