2021-02-05 10:33:21

by Weili Qian

[permalink] [raw]
Subject: [PATCH 0/6] crypto: hisilicon/qm - misc fixes

This patchset fixes some bugs:
1. Removing the waiting reset's completion logic of driver.
2. In order to prevent request missing,
call user's callback before device resetting.
3. Fix the value of 'QM_SQC_VFT_BASE_MASK_V2'.
4. Update irqflag.
5. Do not reset when CE error occurs.
6. Fix printing format issue.

Sihang Chen (1):
crypto: hisilicon/qm - update irqflag

Weili Qian (5):
crypto: hisilicon/qm - removing driver after reset
crypto: hisilicon/qm - fix request missing error
crypto: hisilicon/qm - fix the value of 'QM_SQC_VFT_BASE_MASK_V2'
crypto: hisilicon/qm - do not reset hardware when CE happens
crypto: hisilicon/qm - fix printing format issue

drivers/crypto/hisilicon/hpre/hpre_main.c | 3 +-
drivers/crypto/hisilicon/qm.c | 124 +++++++++++++++++++++---------
drivers/crypto/hisilicon/qm.h | 5 +-
drivers/crypto/hisilicon/sec2/sec_main.c | 3 +-
drivers/crypto/hisilicon/zip/zip_main.c | 7 +-
5 files changed, 101 insertions(+), 41 deletions(-)

--
2.8.1


2021-02-05 10:33:28

by Weili Qian

[permalink] [raw]
Subject: [PATCH 3/6] crypto: hisilicon/qm - fix the value of 'QM_SQC_VFT_BASE_MASK_V2'

Since the size of base number is 16 bits, update the value of
'QM_SQC_VFT_BASE_MASK_V2' as 'GENMASK(15, 0)'.

Signed-off-by: Weili Qian <[email protected]>
Reviewed-by: Zaibo Xu <[email protected]>
---
drivers/crypto/hisilicon/qm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
index 108fc0e..908a13f 100644
--- a/drivers/crypto/hisilicon/qm.c
+++ b/drivers/crypto/hisilicon/qm.c
@@ -120,7 +120,7 @@
#define QM_CQC_VFT_VALID (1ULL << 28)

#define QM_SQC_VFT_BASE_SHIFT_V2 28
-#define QM_SQC_VFT_BASE_MASK_V2 GENMASK(5, 0)
+#define QM_SQC_VFT_BASE_MASK_V2 GENMASK(15, 0)
#define QM_SQC_VFT_NUM_SHIFT_V2 45
#define QM_SQC_VFT_NUM_MASK_v2 GENMASK(9, 0)

--
2.8.1

2021-02-05 10:34:10

by Weili Qian

[permalink] [raw]
Subject: [PATCH 2/6] crypto: hisilicon/qm - fix request missing error

Add 'qp_stop_fail_cb' to ensure it is called as device is resetting.

Signed-off-by: Weili Qian <[email protected]>
Reviewed-by: Zaibo Xu <[email protected]>
---
drivers/crypto/hisilicon/qm.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)

diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
index e659436..108fc0e 100644
--- a/drivers/crypto/hisilicon/qm.c
+++ b/drivers/crypto/hisilicon/qm.c
@@ -622,6 +622,9 @@ static void qm_cq_head_update(struct hisi_qp *qp)

static void qm_poll_qp(struct hisi_qp *qp, struct hisi_qm *qm)
{
+ if (unlikely(atomic_read(&qp->qp_status.flags) == QP_STOP))
+ return;
+
if (qp->event_cb) {
qp->event_cb(qp);
return;
@@ -1868,6 +1871,28 @@ int hisi_qm_start_qp(struct hisi_qp *qp, unsigned long arg)
EXPORT_SYMBOL_GPL(hisi_qm_start_qp);

/**
+ * qp_stop_fail_cb() - call request cb.
+ * @qp: stopped failed qp.
+ *
+ * Callback function should be called whether task completed or not.
+ */
+static void qp_stop_fail_cb(struct hisi_qp *qp)
+{
+ int qp_used = atomic_read(&qp->qp_status.used);
+ u16 cur_tail = qp->qp_status.sq_tail;
+ u16 cur_head = (cur_tail + QM_Q_DEPTH - qp_used) % QM_Q_DEPTH;
+ struct hisi_qm *qm = qp->qm;
+ u16 pos;
+ int i;
+
+ for (i = 0; i < qp_used; i++) {
+ pos = (i + cur_head) % QM_Q_DEPTH;
+ qp->req_cb(qp, qp->sqe + (u32)(qm->sqe_size * pos));
+ atomic_dec(&qp->qp_status.used);
+ }
+}
+
+/**
* qm_drain_qp() - Drain a qp.
* @qp: The qp we want to drain.
*
@@ -1962,6 +1987,9 @@ static int qm_stop_qp_nolock(struct hisi_qp *qp)
else
flush_work(&qp->qm->work);

+ if (unlikely(qp->is_resetting && atomic_read(&qp->qp_status.used)))
+ qp_stop_fail_cb(qp);
+
dev_dbg(dev, "stop queue %u!", qp->qp_id);

return 0;
--
2.8.1