[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240815085725.2740390-8-quic_mdalam@quicinc.com>
Date: Thu, 15 Aug 2024 14:27:16 +0530
From: Md Sadre Alam <quic_mdalam@...cinc.com>
To: vkoul@...nel.org, robh@...nel.org, krzk+dt@...nel.org, conor+dt@...nel.org,
andersson@...nel.org, konradybcio@...nel.org, thara.gopinath@...il.com,
herbert@...dor.apana.org.au, davem@...emloft.net,
gustavoars@...nel.org, u.kleine-koenig@...gutronix.de, kees@...nel.org,
agross@...nel.org, linux-arm-msm@...r.kernel.org,
dmaengine@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-crypto@...r.kernel.org
Cc: quic_srichara@...cinc.com, quic_varada@...cinc.com,
quic_mdalam@...cinc.com, quic_utiwari@...cinc.com
Subject: [PATCH v2 07/16] crypto: qce - Convert register r/w for sha via BAM/DMA
Convert register read/write for sha via BAM/DMA.
with this change all the crypto register configuration
will be done via BAM/DMA. This change will prepare command
descriptor for all register and write it once.
Signed-off-by: Md Sadre Alam <quic_mdalam@...cinc.com>
---
Change in [v2]
* No change
Change in [v1]
* Added initial support for register read/write via bam
for SHA
drivers/crypto/qce/common.c | 26 +++++++++++++++++---------
1 file changed, 17 insertions(+), 9 deletions(-)
diff --git a/drivers/crypto/qce/common.c b/drivers/crypto/qce/common.c
index d1da6b1938f3..d485762a3fdc 100644
--- a/drivers/crypto/qce/common.c
+++ b/drivers/crypto/qce/common.c
@@ -157,17 +157,19 @@ static int qce_setup_regs_ahash(struct crypto_async_request *async_req)
__be32 mackey[QCE_SHA_HMAC_KEY_SIZE / sizeof(__be32)] = {0};
u32 auth_cfg = 0, config;
unsigned int iv_words;
+ int ret;
/* if not the last, the size has to be on the block boundary */
if (!rctx->last_blk && req->nbytes % blocksize)
return -EINVAL;
+ qce_clear_bam_transaction(qce);
qce_setup_config(qce);
if (IS_CMAC(rctx->flags)) {
- qce_write(qce, REG_AUTH_SEG_CFG, 0);
- qce_write(qce, REG_ENCR_SEG_CFG, 0);
- qce_write(qce, REG_ENCR_SEG_SIZE, 0);
+ qce_write_reg_dma(qce, REG_AUTH_SEG_CFG, 0, 1);
+ qce_write_reg_dma(qce, REG_ENCR_SEG_CFG, 0, 1);
+ qce_write_reg_dma(qce, REG_ENCR_SEG_SIZE, 0, 1);
qce_clear_array(qce, REG_AUTH_IV0, 16);
qce_clear_array(qce, REG_AUTH_KEY0, 16);
qce_clear_array(qce, REG_AUTH_BYTECNT0, 4);
@@ -213,18 +215,24 @@ static int qce_setup_regs_ahash(struct crypto_async_request *async_req)
auth_cfg &= ~BIT(AUTH_FIRST_SHIFT);
go_proc:
- qce_write(qce, REG_AUTH_SEG_CFG, auth_cfg);
- qce_write(qce, REG_AUTH_SEG_SIZE, req->nbytes);
- qce_write(qce, REG_AUTH_SEG_START, 0);
- qce_write(qce, REG_ENCR_SEG_CFG, 0);
- qce_write(qce, REG_SEG_SIZE, req->nbytes);
+ qce_write_reg_dma(qce, REG_AUTH_SEG_CFG, auth_cfg, 1);
+ qce_write_reg_dma(qce, REG_AUTH_SEG_SIZE, req->nbytes, 1);
+ qce_write_reg_dma(qce, REG_AUTH_SEG_START, 0, 1);
+ qce_write_reg_dma(qce, REG_ENCR_SEG_CFG, 0, 1);
+ qce_write_reg_dma(qce, REG_SEG_SIZE, req->nbytes, 1);
/* get little endianness */
config = qce_config_reg(qce, 1);
- qce_write(qce, REG_CONFIG, config);
+ qce_write_reg_dma(qce, REG_CONFIG, config, 1);
qce_crypto_go(qce, true);
+ ret = qce_submit_cmd_desc(qce, 0);
+ if (ret) {
+ dev_err(qce->dev, "Error in sha cmd descriptor\n");
+ return ret;
+ }
+
return 0;
}
#endif
--
2.34.1
Powered by blists - more mailing lists