Commit 8123455a authored by Meng Yu's avatar Meng Yu Committed by Herbert Xu
Browse files

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: default avatarMeng Yu <yumeng18@huawei.com>
Reviewed-by: default avatarZaibo Xu <xuzaibo@huawei.com>
Reviewed-by: default avatarLongfang Liu <liulongfang@huawei.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 1877c73b
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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
+2 −2
Original line number Diff line number Diff line
@@ -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
+2 −2
Original line number Diff line number Diff line
@@ -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);

+2 −2
Original line number Diff line number Diff line
@@ -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 {
+2 −2
Original line number Diff line number Diff line
@@ -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
Loading