All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] crypto: hisilicon/qm - misc fixes
@ 2022-04-16 10:45 Weili Qian
  2022-04-16 10:45 ` [PATCH 1/4] crypto: hisilicon/qm - remove unused function declaration Weili Qian
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Weili Qian @ 2022-04-16 10:45 UTC (permalink / raw)
  To: herbert, davem
  Cc: linux-kernel, linux-crypto, wangzhou1, liulongfang, Weili Qian

This patchset removes some unused functions and sets the unused outside
qm.c functons to static.

Weili Qian (4):
  crypto: hisilicon/qm - remove unused function declaration
  crypto: hisilicon/qm - set function with static
  crypto: hisilicon/qm - replace hisi_qm_release_qp() with
    hisi_qm_free_qps()
  crypto: hisilicon/qm - remove hisi_qm_get_free_qp_num()

 drivers/crypto/hisilicon/qm.c             | 37 ++++++++---------------
 drivers/crypto/hisilicon/zip/zip_crypto.c |  2 +-
 include/linux/hisi_acc_qm.h               |  5 ---
 3 files changed, 13 insertions(+), 31 deletions(-)

-- 
2.33.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] crypto: hisilicon/qm - remove unused function declaration
  2022-04-16 10:45 [PATCH 0/4] crypto: hisilicon/qm - misc fixes Weili Qian
@ 2022-04-16 10:45 ` Weili Qian
  2022-04-16 10:45 ` [PATCH 2/4] crypto: hisilicon/qm - set function with static Weili Qian
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Weili Qian @ 2022-04-16 10:45 UTC (permalink / raw)
  To: herbert, davem
  Cc: linux-kernel, linux-crypto, wangzhou1, liulongfang, Weili Qian

The 'hisi_qm_get_hw_version' function is unused, so remove the function
declaration.

Signed-off-by: Weili Qian <qianweili@huawei.com>
---
 include/linux/hisi_acc_qm.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/linux/hisi_acc_qm.h b/include/linux/hisi_acc_qm.h
index 177f7b7cd414..0b1585bc37f9 100644
--- a/include/linux/hisi_acc_qm.h
+++ b/include/linux/hisi_acc_qm.h
@@ -441,7 +441,6 @@ int hisi_qp_send(struct hisi_qp *qp, const void *msg);
 int hisi_qm_get_free_qp_num(struct hisi_qm *qm);
 int hisi_qm_get_vft(struct hisi_qm *qm, u32 *base, u32 *number);
 void hisi_qm_debug_init(struct hisi_qm *qm);
-enum qm_hw_ver hisi_qm_get_hw_version(struct pci_dev *pdev);
 void hisi_qm_debug_regs_clear(struct hisi_qm *qm);
 int hisi_qm_sriov_enable(struct pci_dev *pdev, int max_vfs);
 int hisi_qm_sriov_disable(struct pci_dev *pdev, bool is_frozen);
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] crypto: hisilicon/qm - set function with static
  2022-04-16 10:45 [PATCH 0/4] crypto: hisilicon/qm - misc fixes Weili Qian
  2022-04-16 10:45 ` [PATCH 1/4] crypto: hisilicon/qm - remove unused function declaration Weili Qian
@ 2022-04-16 10:45 ` Weili Qian
  2022-04-16 10:45 ` [PATCH 3/4] crypto: hisilicon/qm - replace hisi_qm_release_qp() with hisi_qm_free_qps() Weili Qian
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Weili Qian @ 2022-04-16 10:45 UTC (permalink / raw)
  To: herbert, davem
  Cc: linux-kernel, linux-crypto, wangzhou1, liulongfang, Weili Qian

These functions 'hisi_qm_create_qp' and 'hisi_qm_set_vft' are not
used outside qm.c, so they are marked as static.

Signed-off-by: Weili Qian <qianweili@huawei.com>
---
 drivers/crypto/hisilicon/qm.c | 6 ++----
 include/linux/hisi_acc_qm.h   | 2 --
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
index 009132333d2b..582220178ec8 100644
--- a/drivers/crypto/hisilicon/qm.c
+++ b/drivers/crypto/hisilicon/qm.c
@@ -2660,7 +2660,7 @@ static struct hisi_qp *qm_create_qp_nolock(struct hisi_qm *qm, u8 alg_type)
  * return created qp, -EBUSY if all qps in qm allocated, -ENOMEM if allocating
  * qp memory fails.
  */
-struct hisi_qp *hisi_qm_create_qp(struct hisi_qm *qm, u8 alg_type)
+static struct hisi_qp *hisi_qm_create_qp(struct hisi_qm *qm, u8 alg_type)
 {
 	struct hisi_qp *qp;
 	int ret;
@@ -2678,7 +2678,6 @@ struct hisi_qp *hisi_qm_create_qp(struct hisi_qm *qm, u8 alg_type)
 
 	return qp;
 }
-EXPORT_SYMBOL_GPL(hisi_qm_create_qp);
 
 /**
  * hisi_qm_release_qp() - Release a qp back to its qm.
@@ -3550,7 +3549,7 @@ EXPORT_SYMBOL_GPL(hisi_qm_uninit);
  *
  * qm hw v1 does not support this interface.
  */
-int hisi_qm_get_vft(struct hisi_qm *qm, u32 *base, u32 *number)
+static int hisi_qm_get_vft(struct hisi_qm *qm, u32 *base, u32 *number)
 {
 	if (!base || !number)
 		return -EINVAL;
@@ -3562,7 +3561,6 @@ int hisi_qm_get_vft(struct hisi_qm *qm, u32 *base, u32 *number)
 
 	return qm->ops->get_vft(qm, base, number);
 }
-EXPORT_SYMBOL_GPL(hisi_qm_get_vft);
 
 /**
  * hisi_qm_set_vft() - Set vft to a qm.
diff --git a/include/linux/hisi_acc_qm.h b/include/linux/hisi_acc_qm.h
index 0b1585bc37f9..6fabfba014dd 100644
--- a/include/linux/hisi_acc_qm.h
+++ b/include/linux/hisi_acc_qm.h
@@ -433,13 +433,11 @@ int hisi_qm_init(struct hisi_qm *qm);
 void hisi_qm_uninit(struct hisi_qm *qm);
 int hisi_qm_start(struct hisi_qm *qm);
 int hisi_qm_stop(struct hisi_qm *qm, enum qm_stop_reason r);
-struct hisi_qp *hisi_qm_create_qp(struct hisi_qm *qm, u8 alg_type);
 int hisi_qm_start_qp(struct hisi_qp *qp, unsigned long arg);
 int hisi_qm_stop_qp(struct hisi_qp *qp);
 void hisi_qm_release_qp(struct hisi_qp *qp);
 int hisi_qp_send(struct hisi_qp *qp, const void *msg);
 int hisi_qm_get_free_qp_num(struct hisi_qm *qm);
-int hisi_qm_get_vft(struct hisi_qm *qm, u32 *base, u32 *number);
 void hisi_qm_debug_init(struct hisi_qm *qm);
 void hisi_qm_debug_regs_clear(struct hisi_qm *qm);
 int hisi_qm_sriov_enable(struct pci_dev *pdev, int max_vfs);
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] crypto: hisilicon/qm - replace hisi_qm_release_qp() with hisi_qm_free_qps()
  2022-04-16 10:45 [PATCH 0/4] crypto: hisilicon/qm - misc fixes Weili Qian
  2022-04-16 10:45 ` [PATCH 1/4] crypto: hisilicon/qm - remove unused function declaration Weili Qian
  2022-04-16 10:45 ` [PATCH 2/4] crypto: hisilicon/qm - set function with static Weili Qian
@ 2022-04-16 10:45 ` Weili Qian
  2022-04-16 10:45 ` [PATCH 4/4] crypto: hisilicon/qm - remove hisi_qm_get_free_qp_num() Weili Qian
  2022-04-21 10:02 ` [PATCH 0/4] crypto: hisilicon/qm - misc fixes Herbert Xu
  4 siblings, 0 replies; 6+ messages in thread
From: Weili Qian @ 2022-04-16 10:45 UTC (permalink / raw)
  To: herbert, davem
  Cc: linux-kernel, linux-crypto, wangzhou1, liulongfang, Weili Qian

hisi_qm_free_qps() can release multiple queues in one call, and it is
already exported. So, replace hisi_qm_release_qp() with hisi_qm_free_qps()
in zip_crypto.c, and do not export hisi_qm_release_qp() outside qm.c.

Signed-off-by: Weili Qian <qianweili@huawei.com>
---
 drivers/crypto/hisilicon/qm.c             | 3 +--
 drivers/crypto/hisilicon/zip/zip_crypto.c | 2 +-
 include/linux/hisi_acc_qm.h               | 1 -
 3 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
index 582220178ec8..f708a632a2f5 100644
--- a/drivers/crypto/hisilicon/qm.c
+++ b/drivers/crypto/hisilicon/qm.c
@@ -2685,7 +2685,7 @@ static struct hisi_qp *hisi_qm_create_qp(struct hisi_qm *qm, u8 alg_type)
  *
  * This function releases the resource of a qp.
  */
-void hisi_qm_release_qp(struct hisi_qp *qp)
+static void hisi_qm_release_qp(struct hisi_qp *qp)
 {
 	struct hisi_qm *qm = qp->qm;
 
@@ -2703,7 +2703,6 @@ void hisi_qm_release_qp(struct hisi_qp *qp)
 
 	qm_pm_put_sync(qm);
 }
-EXPORT_SYMBOL_GPL(hisi_qm_release_qp);
 
 static int qm_sq_ctx_cfg(struct hisi_qp *qp, int qp_id, u32 pasid)
 {
diff --git a/drivers/crypto/hisilicon/zip/zip_crypto.c b/drivers/crypto/hisilicon/zip/zip_crypto.c
index 9520a4113c81..67869513e48c 100644
--- a/drivers/crypto/hisilicon/zip/zip_crypto.c
+++ b/drivers/crypto/hisilicon/zip/zip_crypto.c
@@ -521,7 +521,7 @@ static int hisi_zip_start_qp(struct hisi_qp *qp, struct hisi_zip_qp_ctx *ctx,
 static void hisi_zip_release_qp(struct hisi_zip_qp_ctx *ctx)
 {
 	hisi_qm_stop_qp(ctx->qp);
-	hisi_qm_release_qp(ctx->qp);
+	hisi_qm_free_qps(&ctx->qp, 1);
 }
 
 static const struct hisi_zip_sqe_ops hisi_zip_ops_v1 = {
diff --git a/include/linux/hisi_acc_qm.h b/include/linux/hisi_acc_qm.h
index 6fabfba014dd..46974d641af1 100644
--- a/include/linux/hisi_acc_qm.h
+++ b/include/linux/hisi_acc_qm.h
@@ -435,7 +435,6 @@ int hisi_qm_start(struct hisi_qm *qm);
 int hisi_qm_stop(struct hisi_qm *qm, enum qm_stop_reason r);
 int hisi_qm_start_qp(struct hisi_qp *qp, unsigned long arg);
 int hisi_qm_stop_qp(struct hisi_qp *qp);
-void hisi_qm_release_qp(struct hisi_qp *qp);
 int hisi_qp_send(struct hisi_qp *qp, const void *msg);
 int hisi_qm_get_free_qp_num(struct hisi_qm *qm);
 void hisi_qm_debug_init(struct hisi_qm *qm);
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] crypto: hisilicon/qm - remove hisi_qm_get_free_qp_num()
  2022-04-16 10:45 [PATCH 0/4] crypto: hisilicon/qm - misc fixes Weili Qian
                   ` (2 preceding siblings ...)
  2022-04-16 10:45 ` [PATCH 3/4] crypto: hisilicon/qm - replace hisi_qm_release_qp() with hisi_qm_free_qps() Weili Qian
@ 2022-04-16 10:45 ` Weili Qian
  2022-04-21 10:02 ` [PATCH 0/4] crypto: hisilicon/qm - misc fixes Herbert Xu
  4 siblings, 0 replies; 6+ messages in thread
From: Weili Qian @ 2022-04-16 10:45 UTC (permalink / raw)
  To: herbert, davem
  Cc: linux-kernel, linux-crypto, wangzhou1, liulongfang, Weili Qian

hisi_qm_get_free_qp_num() is to get the free queue number on the function.
It is a simple function and is only called by
hisi_qm_get_available_instances().

This patch modifies to get the free queue directly in
hisi_qm_get_available_instances(), and remove hisi_qm_get_free_qp_num().

Signed-off-by: Weili Qian <qianweili@huawei.com>
---
 drivers/crypto/hisilicon/qm.c | 28 +++++++++-------------------
 include/linux/hisi_acc_qm.h   |  1 -
 2 files changed, 9 insertions(+), 20 deletions(-)

diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
index f708a632a2f5..cd4c146340dd 100644
--- a/drivers/crypto/hisilicon/qm.c
+++ b/drivers/crypto/hisilicon/qm.c
@@ -3051,9 +3051,17 @@ static void qm_qp_event_notifier(struct hisi_qp *qp)
 	wake_up_interruptible(&qp->uacce_q->wait);
 }
 
+ /* This function returns free number of qp in qm. */
 static int hisi_qm_get_available_instances(struct uacce_device *uacce)
 {
-	return hisi_qm_get_free_qp_num(uacce->priv);
+	struct hisi_qm *qm = uacce->priv;
+	int ret;
+
+	down_read(&qm->qps_lock);
+	ret = qm->qp_num - qm->qp_in_used;
+	up_read(&qm->qps_lock);
+
+	return ret;
 }
 
 static void hisi_qm_set_hw_reset(struct hisi_qm *qm, int offset)
@@ -3365,24 +3373,6 @@ void hisi_qm_wait_task_finish(struct hisi_qm *qm, struct hisi_qm_list *qm_list)
 }
 EXPORT_SYMBOL_GPL(hisi_qm_wait_task_finish);
 
-/**
- * hisi_qm_get_free_qp_num() - Get free number of qp in qm.
- * @qm: The qm which want to get free qp.
- *
- * This function return free number of qp in qm.
- */
-int hisi_qm_get_free_qp_num(struct hisi_qm *qm)
-{
-	int ret;
-
-	down_read(&qm->qps_lock);
-	ret = qm->qp_num - qm->qp_in_used;
-	up_read(&qm->qps_lock);
-
-	return ret;
-}
-EXPORT_SYMBOL_GPL(hisi_qm_get_free_qp_num);
-
 static void hisi_qp_memory_uninit(struct hisi_qm *qm, int num)
 {
 	struct device *dev = &qm->pdev->dev;
diff --git a/include/linux/hisi_acc_qm.h b/include/linux/hisi_acc_qm.h
index 46974d641af1..545f58432412 100644
--- a/include/linux/hisi_acc_qm.h
+++ b/include/linux/hisi_acc_qm.h
@@ -436,7 +436,6 @@ int hisi_qm_stop(struct hisi_qm *qm, enum qm_stop_reason r);
 int hisi_qm_start_qp(struct hisi_qp *qp, unsigned long arg);
 int hisi_qm_stop_qp(struct hisi_qp *qp);
 int hisi_qp_send(struct hisi_qp *qp, const void *msg);
-int hisi_qm_get_free_qp_num(struct hisi_qm *qm);
 void hisi_qm_debug_init(struct hisi_qm *qm);
 void hisi_qm_debug_regs_clear(struct hisi_qm *qm);
 int hisi_qm_sriov_enable(struct pci_dev *pdev, int max_vfs);
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/4] crypto: hisilicon/qm - misc fixes
  2022-04-16 10:45 [PATCH 0/4] crypto: hisilicon/qm - misc fixes Weili Qian
                   ` (3 preceding siblings ...)
  2022-04-16 10:45 ` [PATCH 4/4] crypto: hisilicon/qm - remove hisi_qm_get_free_qp_num() Weili Qian
@ 2022-04-21 10:02 ` Herbert Xu
  4 siblings, 0 replies; 6+ messages in thread
From: Herbert Xu @ 2022-04-21 10:02 UTC (permalink / raw)
  To: Weili Qian; +Cc: davem, linux-kernel, linux-crypto, wangzhou1, liulongfang

On Sat, Apr 16, 2022 at 06:45:55PM +0800, Weili Qian wrote:
> This patchset removes some unused functions and sets the unused outside
> qm.c functons to static.
> 
> Weili Qian (4):
>   crypto: hisilicon/qm - remove unused function declaration
>   crypto: hisilicon/qm - set function with static
>   crypto: hisilicon/qm - replace hisi_qm_release_qp() with
>     hisi_qm_free_qps()
>   crypto: hisilicon/qm - remove hisi_qm_get_free_qp_num()
> 
>  drivers/crypto/hisilicon/qm.c             | 37 ++++++++---------------
>  drivers/crypto/hisilicon/zip/zip_crypto.c |  2 +-
>  include/linux/hisi_acc_qm.h               |  5 ---
>  3 files changed, 13 insertions(+), 31 deletions(-)
> 
> -- 
> 2.33.0

All applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-04-21 10:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-16 10:45 [PATCH 0/4] crypto: hisilicon/qm - misc fixes Weili Qian
2022-04-16 10:45 ` [PATCH 1/4] crypto: hisilicon/qm - remove unused function declaration Weili Qian
2022-04-16 10:45 ` [PATCH 2/4] crypto: hisilicon/qm - set function with static Weili Qian
2022-04-16 10:45 ` [PATCH 3/4] crypto: hisilicon/qm - replace hisi_qm_release_qp() with hisi_qm_free_qps() Weili Qian
2022-04-16 10:45 ` [PATCH 4/4] crypto: hisilicon/qm - remove hisi_qm_get_free_qp_num() Weili Qian
2022-04-21 10:02 ` [PATCH 0/4] crypto: hisilicon/qm - misc fixes Herbert Xu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.