Skip to content

Commit 5106054

Browse files
committed
crypto: octeontx2 - get engine group number for asymmetric engine
JIRA: https://issues.redhat.com/browse/RHEL-122026 Upstream Status: merged into the linux.git commit 1b9209d Author: Amit Singh Tomar <amitsinght@marvell.com> Date: Wed May 28 20:29:41 2025 +0530 crypto: octeontx2 - get engine group number for asymmetric engine Cryptographic Accelerator Unit (CPT) support different engine groups, one for asymmetric algorithms (only AE engines in this group), one for the most common symmetric algorithms (all SE and all IE engines in this group), and one for other symmetric algorithms (only SE engines in this group). For symmetric engine (SE), we obtain the group number using "MBOX_MSG_GET_ENG_GRP_NUM" mailbox. Let's follow a similar approach to determine the group number for asymmetric engine (AE). Signed-off-by: Amit Singh Tomar <amitsinght@marvell.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Vladis Dronov <vdronov@redhat.com>
1 parent f09f489 commit 5106054

File tree

4 files changed

+21
-1
lines changed

4 files changed

+21
-1
lines changed

drivers/crypto/marvell/octeontx2/otx2_cptlf.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ struct otx2_cptlfs_info {
125125
u8 are_lfs_attached; /* Whether CPT LFs are attached */
126126
u8 lfs_num; /* Number of CPT LFs */
127127
u8 kcrypto_se_eng_grp_num; /* Crypto symmetric engine group number */
128+
u8 kcrypto_ae_eng_grp_num; /* Crypto asymmetric engine group number */
128129
u8 kvf_limits; /* Kernel crypto limits */
129130
atomic_t state; /* LF's state. started/reset */
130131
int blkaddr; /* CPT blkaddr: BLKADDR_CPT0/BLKADDR_CPT1 */

drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,22 @@ static int cptvf_lf_init(struct otx2_cptvf_dev *cptvf)
276276
"Symmetric Engine group for crypto not available\n");
277277
return -ENOENT;
278278
}
279-
eng_grp_msk = 1 << cptvf->lfs.kcrypto_se_eng_grp_num;
279+
280+
/* Get engine group number for asymmetric crypto */
281+
cptvf->lfs.kcrypto_ae_eng_grp_num = OTX2_CPT_INVALID_CRYPTO_ENG_GRP;
282+
ret = otx2_cptvf_send_eng_grp_num_msg(cptvf, OTX2_CPT_AE_TYPES);
283+
if (ret)
284+
return ret;
285+
286+
if (cptvf->lfs.kcrypto_ae_eng_grp_num ==
287+
OTX2_CPT_INVALID_CRYPTO_ENG_GRP) {
288+
dev_err(dev,
289+
"Asymmetric Engine group for crypto not available\n");
290+
return -ENOENT;
291+
}
292+
293+
eng_grp_msk = BIT(cptvf->lfs.kcrypto_se_eng_grp_num) |
294+
BIT(cptvf->lfs.kcrypto_ae_eng_grp_num);
280295

281296
ret = otx2_cptvf_send_kvf_limits_msg(cptvf);
282297
if (ret)

drivers/crypto/marvell/octeontx2/otx2_cptvf_mbox.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ static void process_pfvf_mbox_mbox_msg(struct otx2_cptvf_dev *cptvf,
126126
grp_num = rsp_grp->eng_grp_num;
127127
if (rsp_grp->eng_type == OTX2_CPT_SE_TYPES)
128128
cptvf->lfs.kcrypto_se_eng_grp_num = grp_num;
129+
else if (rsp_grp->eng_type == OTX2_CPT_AE_TYPES)
130+
cptvf->lfs.kcrypto_ae_eng_grp_num = grp_num;
129131
break;
130132
case MBOX_MSG_GET_KVF_LIMITS:
131133
rsp_limits = (struct otx2_cpt_kvf_limits_rsp *) msg;

drivers/crypto/marvell/octeontx2/otx2_cptvf_reqmgr.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,8 @@ int otx2_cpt_get_eng_grp_num(struct pci_dev *pdev,
399399
switch (eng_type) {
400400
case OTX2_CPT_SE_TYPES:
401401
return cptvf->lfs.kcrypto_se_eng_grp_num;
402+
case OTX2_CPT_AE_TYPES:
403+
return cptvf->lfs.kcrypto_ae_eng_grp_num;
402404
default:
403405
dev_err(&cptvf->pdev->dev, "Unsupported engine type");
404406
break;

0 commit comments

Comments
 (0)