[PATCH v2 00/16] Add cmd descriptor support

Md Sadre Alam
2024-08-15T09:02:44Z

This series of patches will add command descriptor
support to read/write crypto engine register via
BAM/DMA

We need this support because if there is multiple EE's
(Execution Environment) accessing the same CE then there
will be race condition. To avoid this race condition
BAM HW hsving LOC/UNLOCK feature on BAM pipes and this
LOCK/UNLOCK will be set via command descriptor only.

Since each EE's having their dedicated BAM pipe, BAM allows
Locking and Unlocking on BAM pipe. So if one EE's requesting
for CE5 access then that EE's first has to LOCK the BAM pipe
while setting LOCK bit on command descriptor and then access
it. After finishing the request EE's has to UNLOCK the BAM pipe
so in this way we race condition will not happen.

tested with "tcrypt.ko" and "kcapi" tool.

Need help to test these all the patches on msm platform

v2:
* Addressed all the comments from v1
* Added the dt-binding
* Added locking/unlocking mechanism in bam driver

v1:
* https://lore.kernel.org/lkml/20231214114239.2635325-1-quic_mdalam@quicinc.com/
* Initial set of patches for cmd descriptor support

Md Sadre Alam (16):
dt-bindings: dma: qcom,bam: Add bam pipe lock
dmaengine: qcom: bam_dma: add bam_pipe_lock dt property
dmaengine: qcom: bam_dma: add LOCK & UNLOCK flag support
crypto: qce - Add support for crypto address read
crypto: qce - Add bam dma support for crypto register r/w
crypto: qce - Convert register r/w for skcipher via BAM/DMA
crypto: qce - Convert register r/w for sha via BAM/DMA
crypto: qce - Convert register r/w for aead via BAM/DMA
crypto: qce - Add LOCK and UNLOCK flag support
crypto: qce - Add support for lock aquire,lock release api.
crypto: qce - Add support for lock/unlock in skcipher
crypto: qce - Add support for lock/unlock in sha
crypto: qce - Add support for lock/unlock in aead
arm64: dts: qcom: ipq9574: enable bam pipe locking/unlocking
arm64: dts: qcom: ipq8074: enable bam pipe locking/unlocking
arm64: dts: qcom: ipq6018: enable bam pipe locking/unlocking

.../devicetree/bindings/dma/qcom,bam-dma.yaml | 8 +
arch/arm64/boot/dts/qcom/ipq6018.dtsi | 1 +
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 1 +
arch/arm64/boot/dts/qcom/ipq9574.dtsi | 1 +
drivers/crypto/qce/aead.c | 4 +
drivers/crypto/qce/common.c | 142 +++++++----
drivers/crypto/qce/core.c | 13 +-
drivers/crypto/qce/core.h | 12 +
drivers/crypto/qce/dma.c | 232 ++++++++++++++++++
drivers/crypto/qce/dma.h | 26 +-
drivers/crypto/qce/sha.c | 4 +
drivers/crypto/qce/skcipher.c | 4 +
drivers/dma/qcom/bam_dma.c | 14 +-
include/linux/dmaengine.h | 6 +
14 files changed, 424 insertions(+), 44 deletions(-)

--
2.34.1