crypto: hisilicon/qm - enhance the configuration of req_type in queue attributes

Originally, when a queue was requested, it could only be configured
with the default algorithm type of 0. Now, when multiple tfms use
the same queue, the queue must be selected based on its attributes
to meet the requirements of tfm tasks. So the algorithm type
attribute of queue need to be distinguished. Just like a queue used
for compression in ZIP cannot be used for decompression tasks.

Fixes: 3f1ec97aac ("crypto: hisilicon/qm - Put device finding logic into QM")
Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
Signed-off-by: Weili Qian <qianweili@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Chenghai Huang
2025-12-18 21:44:45 +08:00
committed by Herbert Xu
parent 3a19847581
commit 21452eaa06
8 changed files with 34 additions and 20 deletions

View File

@@ -417,18 +417,29 @@ struct hisi_qp **sec_create_qps(void)
int node = cpu_to_node(raw_smp_processor_id());
u32 ctx_num = ctx_q_num;
struct hisi_qp **qps;
u8 *type;
int ret;
qps = kcalloc(ctx_num, sizeof(struct hisi_qp *), GFP_KERNEL);
if (!qps)
return NULL;
ret = hisi_qm_alloc_qps_node(&sec_devices, ctx_num, 0, node, qps);
if (!ret)
return qps;
/* The type of SEC is all 0, so just allocated by kcalloc */
type = kcalloc(ctx_num, sizeof(u8), GFP_KERNEL);
if (!type) {
kfree(qps);
return NULL;
}
kfree(qps);
return NULL;
ret = hisi_qm_alloc_qps_node(&sec_devices, ctx_num, type, node, qps);
if (ret) {
kfree(type);
kfree(qps);
return NULL;
}
kfree(type);
return qps;
}
u64 sec_get_alg_bitmap(struct hisi_qm *qm, u32 high, u32 low)