mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
crypto: hisilicon/sec2 - save capability registers in probe process
Pre-store the valid value of the sec alg support related capability
register in sec_qm_init(), which will be called by probe process.
It can reduce the number of capability register queries and avoid
obtaining incorrect values in abnormal scenarios, such as reset
failed and the memory space disabled.
Fixes: 921715b6b7 ("crypto: hisilicon/sec - get algorithm bitmap from registers")
Signed-off-by: Zhiqi Song <songzhiqi1@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
@@ -2547,9 +2547,12 @@ err:
|
||||
|
||||
int sec_register_to_crypto(struct hisi_qm *qm)
|
||||
{
|
||||
u64 alg_mask = sec_get_alg_bitmap(qm, SEC_DRV_ALG_BITMAP_HIGH, SEC_DRV_ALG_BITMAP_LOW);
|
||||
u64 alg_mask;
|
||||
int ret = 0;
|
||||
|
||||
alg_mask = sec_get_alg_bitmap(qm, SEC_DRV_ALG_BITMAP_HIGH_IDX,
|
||||
SEC_DRV_ALG_BITMAP_LOW_IDX);
|
||||
|
||||
mutex_lock(&sec_algs_lock);
|
||||
if (sec_available_devs) {
|
||||
sec_available_devs++;
|
||||
@@ -2578,7 +2581,10 @@ unlock:
|
||||
|
||||
void sec_unregister_from_crypto(struct hisi_qm *qm)
|
||||
{
|
||||
u64 alg_mask = sec_get_alg_bitmap(qm, SEC_DRV_ALG_BITMAP_HIGH, SEC_DRV_ALG_BITMAP_LOW);
|
||||
u64 alg_mask;
|
||||
|
||||
alg_mask = sec_get_alg_bitmap(qm, SEC_DRV_ALG_BITMAP_HIGH_IDX,
|
||||
SEC_DRV_ALG_BITMAP_LOW_IDX);
|
||||
|
||||
mutex_lock(&sec_algs_lock);
|
||||
if (--sec_available_devs)
|
||||
|
||||
Reference in New Issue
Block a user