crypto: hisilicon/hpre - add version adapt to new algorithms

A new generation of accelerator Kunpeng930 has appeared, and the
corresponding driver needs to be updated to support some new
algorithms of Kunpeng930. To be compatible with Kunpeng920, we
add parameter 'struct hisi_qm *qm' to sec_algs_(un)register to
identify the chip's version.

Signed-off-by: Meng Yu <yumeng18@huawei.com>
Reviewed-by: Zaibo Xu <xuzaibo@huawei.com>
Reviewed-by: Longfang Liu <liulongfang@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Meng Yu 2021-03-04 14:35:44 +08:00 committed by Herbert Xu
parent 1877c73b7c
commit 8123455a64
9 changed files with 19 additions and 18 deletions

View File

@ -93,7 +93,8 @@ struct hpre_sqe {
};
struct hisi_qp *hpre_create_qp(void);
int hpre_algs_register(void);
void hpre_algs_unregister(void);
int hpre_algs_register(struct hisi_qm *qm);
void hpre_algs_unregister(struct hisi_qm *qm);
#endif

View File

@ -1154,7 +1154,7 @@ static struct kpp_alg dh = {
};
#endif
int hpre_algs_register(void)
int hpre_algs_register(struct hisi_qm *qm)
{
int ret;
@ -1171,7 +1171,7 @@ int hpre_algs_register(void)
return ret;
}
void hpre_algs_unregister(void)
void hpre_algs_unregister(struct hisi_qm *qm)
{
crypto_unregister_akcipher(&rsa);
#ifdef CONFIG_CRYPTO_DH

View File

@ -4084,7 +4084,7 @@ int hisi_qm_alg_register(struct hisi_qm *qm, struct hisi_qm_list *qm_list)
mutex_unlock(&qm_list->lock);
if (flag) {
ret = qm_list->register_to_crypto();
ret = qm_list->register_to_crypto(qm);
if (ret) {
mutex_lock(&qm_list->lock);
list_del(&qm->list);
@ -4115,7 +4115,7 @@ void hisi_qm_alg_unregister(struct hisi_qm *qm, struct hisi_qm_list *qm_list)
mutex_unlock(&qm_list->lock);
if (list_empty(&qm_list->list))
qm_list->unregister_from_crypto();
qm_list->unregister_from_crypto(qm);
}
EXPORT_SYMBOL_GPL(hisi_qm_alg_unregister);

View File

@ -199,8 +199,8 @@ struct hisi_qm_err_ini {
struct hisi_qm_list {
struct mutex lock;
struct list_head list;
int (*register_to_crypto)(void);
void (*unregister_from_crypto)(void);
int (*register_to_crypto)(struct hisi_qm *qm);
void (*unregister_from_crypto)(struct hisi_qm *qm);
};
struct hisi_qm {

View File

@ -183,6 +183,6 @@ struct sec_dev {
void sec_destroy_qps(struct hisi_qp **qps, int qp_num);
struct hisi_qp **sec_create_qps(void);
int sec_register_to_crypto(void);
void sec_unregister_from_crypto(void);
int sec_register_to_crypto(struct hisi_qm *qm);
void sec_unregister_from_crypto(struct hisi_qm *qm);
#endif

View File

@ -1634,7 +1634,7 @@ static struct aead_alg sec_aeads[] = {
AES_BLOCK_SIZE, AES_BLOCK_SIZE, SHA512_DIGEST_SIZE),
};
int sec_register_to_crypto(void)
int sec_register_to_crypto(struct hisi_qm *qm)
{
int ret;
@ -1651,7 +1651,7 @@ int sec_register_to_crypto(void)
return ret;
}
void sec_unregister_from_crypto(void)
void sec_unregister_from_crypto(struct hisi_qm *qm)
{
crypto_unregister_skciphers(sec_skciphers,
ARRAY_SIZE(sec_skciphers));

View File

@ -211,6 +211,6 @@ struct sec_sqe {
struct sec_sqe_type2 type2;
};
int sec_register_to_crypto(void);
void sec_unregister_from_crypto(void);
int sec_register_to_crypto(struct hisi_qm *qm);
void sec_unregister_from_crypto(struct hisi_qm *qm);
#endif

View File

@ -62,6 +62,6 @@ struct hisi_zip_sqe {
};
int zip_create_qps(struct hisi_qp **qps, int ctx_num, int node);
int hisi_zip_register_to_crypto(void);
void hisi_zip_unregister_from_crypto(void);
int hisi_zip_register_to_crypto(struct hisi_qm *qm);
void hisi_zip_unregister_from_crypto(struct hisi_qm *qm);
#endif

View File

@ -665,7 +665,7 @@ static struct acomp_alg hisi_zip_acomp_gzip = {
}
};
int hisi_zip_register_to_crypto(void)
int hisi_zip_register_to_crypto(struct hisi_qm *qm)
{
int ret;
@ -684,7 +684,7 @@ int hisi_zip_register_to_crypto(void)
return ret;
}
void hisi_zip_unregister_from_crypto(void)
void hisi_zip_unregister_from_crypto(struct hisi_qm *qm)
{
crypto_unregister_acomp(&hisi_zip_acomp_gzip);
crypto_unregister_acomp(&hisi_zip_acomp_zlib);