crypto: hisilicon/hpre - add version adapt to new algorithms
authorMeng Yu <yumeng18@huawei.com>
Thu, 4 Mar 2021 06:35:44 +0000 (14:35 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 12 Mar 2021 13:04:02 +0000 (00:04 +1100)
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>
drivers/crypto/hisilicon/hpre/hpre.h
drivers/crypto/hisilicon/hpre/hpre_crypto.c
drivers/crypto/hisilicon/qm.c
drivers/crypto/hisilicon/qm.h
drivers/crypto/hisilicon/sec2/sec.h
drivers/crypto/hisilicon/sec2/sec_crypto.c
drivers/crypto/hisilicon/sec2/sec_crypto.h
drivers/crypto/hisilicon/zip/zip.h
drivers/crypto/hisilicon/zip/zip_crypto.c

index 181c109b19f7c4219be4db42739c04b4bd984382..cc50f23947cf97ce16e7315895507524b4a9f798 100644 (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
index a87f9904087aac2d02481e2b309acc99d4656edd..d89b2f57c5bfacfe7b9a13239e0edf9736c43088 100644 (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
index 13cb4216561a08d8e671f58cc14ee113856fe3bd..bc231742ad3606a46ef6a3b3bb96b3fb00e49e86 100644 (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);
 
index 54967c6b9c78874ff1ed18c9131892b812c8f0b8..f91110fcf6a4d10887bf481be8a744dc8f75edc6 100644 (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 {
index 08491912afd567be84b0d9812b72509707871b4d..17ddb20ad7a187cdc1dfd8d852065c4a1c915fa8 100644 (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
index 2eaa516b323118c8d897fb5c446c4f5886207a51..f8355140cd463211c4762797073b8b2eca4f58b0 100644 (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));
index b2786e17d8fe20f8ead13da7f20c12d0c09275c4..0e933e7858e78f10dcfe5ed79965353955e6e79c 100644 (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
index 92397f993e237b941d7cfb99febf494d36662fbb..9ed74611f722bd2551c8ec33d2b12b8a7ea61598 100644 (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
index 08b4660b014c6f24b1689865956e55e32059ba62..41f69662024a15d39f83f29e822a2e72d8957c2b 100644 (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);