mbox series

[v2,0/3] dmaengine: Add support for immediate commands

Message ID 20221027051429.46593-1-sireeshkodali1@gmail.com
Headers show
Series dmaengine: Add support for immediate commands | expand

Message

Sireesh Kodali Oct. 27, 2022, 5:14 a.m. UTC
The IPA v2.x block, found on some older Qualcomm SoCs, uses BAM DMA to
send and receive packets from the AP. It also uses BAM to receive
commands from the AP (and possibly the modem). These commands are
encoded as "Immediate Commands". They vary from regular BAM DMA
commands. Adding support for immediate commands is trivial, but requires
also adding Immediate Commands to the dmaengine API, which is what this
patch series does.

Sireesh Kodali (3):
  doc: dmaengine: client-api: Add immediate commands in the DMA client
    API
  dmaengine: Add support for immediate commands in the client API
  dmaengine: bam_dma: Add support for immediate commands

 Documentation/driver-api/dmaengine/provider.rst | 10 ++++++++++
 drivers/dma/qcom/bam_dma.c                      |  3 +++
 include/linux/dmaengine.h                       |  4 ++++
 3 files changed, 17 insertions(+)

Comments

Vinod Koul Nov. 4, 2022, 12:40 p.m. UTC | #1
On 27-10-22, 10:44, Sireesh Kodali wrote:
> The IPA v2.x block, found on some older Qualcomm SoCs, uses BAM DMA to
> send and receive packets from the AP. It also uses BAM to receive
> commands from the AP (and possibly the modem). These commands are
> encoded as "Immediate Commands". They vary from regular BAM DMA
> commands. Adding support for immediate commands is trivial, but requires
> also adding Immediate Commands to the dmaengine API, which is what this
> patch series does.

Can you explain a bit more. I understand you need "Immediate Commands"
but am really reluctant to add another interface to support a specific
use case

> 
> Sireesh Kodali (3):
>   doc: dmaengine: client-api: Add immediate commands in the DMA client
>     API
>   dmaengine: Add support for immediate commands in the client API
>   dmaengine: bam_dma: Add support for immediate commands
> 
>  Documentation/driver-api/dmaengine/provider.rst | 10 ++++++++++
>  drivers/dma/qcom/bam_dma.c                      |  3 +++
>  include/linux/dmaengine.h                       |  4 ++++
>  3 files changed, 17 insertions(+)
> 
> -- 
> 2.38.1
Sireesh Kodali Nov. 11, 2022, 5:12 a.m. UTC | #2
On Fri Nov 4, 2022 at 6:10 PM IST, Vinod Koul wrote:
> On 27-10-22, 10:44, Sireesh Kodali wrote:
> > The IPA v2.x block, found on some older Qualcomm SoCs, uses BAM DMA to
> > send and receive packets from the AP. It also uses BAM to receive
> > commands from the AP (and possibly the modem). These commands are
> > encoded as "Immediate Commands". They vary from regular BAM DMA
> > commands. Adding support for immediate commands is trivial, but requires
> > also adding Immediate Commands to the dmaengine API, which is what this
> > patch series does.
>
> Can you explain a bit more. I understand you need "Immediate Commands"
> but am really reluctant to add another interface to support a specific
> use case
>

Apologies for the delayed response

BAM supports both regular commands, and "immediate commands". Currently,
commands are used by the Qualcom NAND chip driver, while "immediate
commands" are intended to be used by the (yet to be mainlined) IPA
driver. From the BAM driver perspective, both immediate and regular
commands are simply a matter of setting the appropriate flag in the
descriptor. I don't have access to the documentation on BAM to know
exactly how these two modes differ, however I do know they are not
interchangable. If a different API is suggested, I can change the
implementation as needed.

Regards,
Sireesh Kodali
> > 
> > Sireesh Kodali (3):
> >   doc: dmaengine: client-api: Add immediate commands in the DMA client
> >     API
> >   dmaengine: Add support for immediate commands in the client API
> >   dmaengine: bam_dma: Add support for immediate commands
> > 
> >  Documentation/driver-api/dmaengine/provider.rst | 10 ++++++++++
> >  drivers/dma/qcom/bam_dma.c                      |  3 +++
> >  include/linux/dmaengine.h                       |  4 ++++
> >  3 files changed, 17 insertions(+)
> > 
> > -- 
> > 2.38.1
>
> -- 
> ~Vinod
Vinod Koul Nov. 13, 2022, 10:23 p.m. UTC | #3
On 11-11-22, 10:42, Sireesh Kodali wrote:
> On Fri Nov 4, 2022 at 6:10 PM IST, Vinod Koul wrote:
> > On 27-10-22, 10:44, Sireesh Kodali wrote:
> > > The IPA v2.x block, found on some older Qualcomm SoCs, uses BAM DMA to
> > > send and receive packets from the AP. It also uses BAM to receive
> > > commands from the AP (and possibly the modem). These commands are
> > > encoded as "Immediate Commands". They vary from regular BAM DMA
> > > commands. Adding support for immediate commands is trivial, but requires
> > > also adding Immediate Commands to the dmaengine API, which is what this
> > > patch series does.
> >
> > Can you explain a bit more. I understand you need "Immediate Commands"
> > but am really reluctant to add another interface to support a specific
> > use case
> >
> 
> Apologies for the delayed response
> 
> BAM supports both regular commands, and "immediate commands". Currently,
> commands are used by the Qualcom NAND chip driver, while "immediate
> commands" are intended to be used by the (yet to be mainlined) IPA
> driver. From the BAM driver perspective, both immediate and regular
> commands are simply a matter of setting the appropriate flag in the
> descriptor. I don't have access to the documentation on BAM to know
> exactly how these two modes differ, however I do know they are not
> interchangable. If a different API is suggested, I can change the
> implementation as needed.

Ok, can you please explain what is meant by 'regular' cmd and
'immediate', lets see what is required here
Sireesh Kodali Nov. 24, 2022, 3:14 a.m. UTC | #4
On Mon Nov 14, 2022 at 3:53 AM IST, Vinod Koul wrote:
> On 11-11-22, 10:42, Sireesh Kodali wrote:
> > On Fri Nov 4, 2022 at 6:10 PM IST, Vinod Koul wrote:
> > > On 27-10-22, 10:44, Sireesh Kodali wrote:
> > > > The IPA v2.x block, found on some older Qualcomm SoCs, uses BAM DMA to
> > > > send and receive packets from the AP. It also uses BAM to receive
> > > > commands from the AP (and possibly the modem). These commands are
> > > > encoded as "Immediate Commands". They vary from regular BAM DMA
> > > > commands. Adding support for immediate commands is trivial, but requires
> > > > also adding Immediate Commands to the dmaengine API, which is what this
> > > > patch series does.
> > >
> > > Can you explain a bit more. I understand you need "Immediate Commands"
> > > but am really reluctant to add another interface to support a specific
> > > use case
> > >
> > 
> > Apologies for the delayed response
> > 
> > BAM supports both regular commands, and "immediate commands". Currently,
> > commands are used by the Qualcom NAND chip driver, while "immediate
> > commands" are intended to be used by the (yet to be mainlined) IPA
> > driver. From the BAM driver perspective, both immediate and regular
> > commands are simply a matter of setting the appropriate flag in the
> > descriptor. I don't have access to the documentation on BAM to know
> > exactly how these two modes differ, however I do know they are not
> > interchangable. If a different API is suggested, I can change the
> > implementation as needed.
>
> Ok, can you please explain what is meant by 'regular' cmd and
> 'immediate', lets see what is required here

I unfortunately don't have access to any documentation that explains the
difference between the two. All I know is that IPA requires using
immediate commands, while the QCOM NAND driver requires using 'regular'
commands.

Regards,
Sireesh
>
> -- 
> ~Vinod
Sireesh Kodali Nov. 25, 2022, 4:50 p.m. UTC | #5
On Mon Nov 14, 2022 at 3:53 AM IST, Vinod Koul wrote:
> On 11-11-22, 10:42, Sireesh Kodali wrote:
> > On Fri Nov 4, 2022 at 6:10 PM IST, Vinod Koul wrote:
> > > On 27-10-22, 10:44, Sireesh Kodali wrote:
> > > > The IPA v2.x block, found on some older Qualcomm SoCs, uses BAM DMA to
> > > > send and receive packets from the AP. It also uses BAM to receive
> > > > commands from the AP (and possibly the modem). These commands are
> > > > encoded as "Immediate Commands". They vary from regular BAM DMA
> > > > commands. Adding support for immediate commands is trivial, but requires
> > > > also adding Immediate Commands to the dmaengine API, which is what this
> > > > patch series does.
> > >
> > > Can you explain a bit more. I understand you need "Immediate Commands"
> > > but am really reluctant to add another interface to support a specific
> > > use case
> > >
> > 
> > Apologies for the delayed response
> > 
> > BAM supports both regular commands, and "immediate commands". Currently,
> > commands are used by the Qualcom NAND chip driver, while "immediate
> > commands" are intended to be used by the (yet to be mainlined) IPA
> > driver. From the BAM driver perspective, both immediate and regular
> > commands are simply a matter of setting the appropriate flag in the
> > descriptor. I don't have access to the documentation on BAM to know
> > exactly how these two modes differ, however I do know they are not
> > interchangable. If a different API is suggested, I can change the
> > implementation as needed.
>
> Ok, can you please explain what is meant by 'regular' cmd and
> 'immediate', lets see what is required here

Stephan pointed out the APQ8016E TRM has details on BAM. As I understand
it, 'regular' commands are queued register read/writes for the
peripheral. Immediate commands on the other hand seem to be interpreted
by the peripheral's firmware, and don't involve any register
writes/reads from BAM's perspective.

This is what the TRM has to say:

> Immediate (IMM) (only for BAM-NDP): Allows the software to create
> descriptors of type immediate, which does not generate any data
> transmissions or registers configuration, it is simply supplied to the
> peripheral, the peripheral then parses its fields (which are
> irrelevant to the BAM). Only the flags of this descriptor are relevant
> to the BAM, address and size are irrelevant, and BAM simply passes
> them as is to the peripheral. This can be used for the software to
> operate peripheral-specific operations within regular data operations.
> Immediate descriptors are published on the sidebands as 1 byte size
> descriptor, once BAM_NDP fetches an immediate descriptor, it publishes
> all recently fetched descriptors including the immediate descriptor
> with immediate indication, to inform the peripheral that the last
> published descriptor was immediate descriptor.

> Command (CMD) (only for BAM-lite and BAM-NDP): Allows the software to
> create descriptors of type command. Descriptors of type command do not
> generate any data transmissions but configure registers in the
> peripheral (write and read registers operations)

Regards,
Sireesh
>
> -- 
> ~Vinod