summaryrefslogtreecommitdiff
path: root/drivers/crypto/hisilicon/qm.h
diff options
context:
space:
mode:
authorZhou Wang <wangzhou1@hisilicon.com>2020-05-09 12:43:58 +0300
committerHerbert Xu <herbert@gondor.apana.org.au>2020-05-15 09:15:02 +0300
commitb67202e8ed30bfa07b07a6f8fc762417a9a4e6de (patch)
treeefcedcfc1b87c209d4981e85e88761a56a9b180b /drivers/crypto/hisilicon/qm.h
parent20b291f51802b35d84e20efbf110e8c9a853a22c (diff)
downloadlinux-b67202e8ed30bfa07b07a6f8fc762417a9a4e6de.tar.xz
crypto: hisilicon/qm - add state machine for QM
Add specific states for qm and qp, every state change under critical region to prevent from race condition. Meanwhile, qp state change will also depend on qm state. Due to the introduction of these states, it is necessary to pay attention to the calls of public logic, such as concurrent scenarios resetting and releasing queue will call hisi_qm_stop, which needs to add additional status to distinguish and process. Signed-off-by: Zhou Wang <wangzhou1@hisilicon.com> Signed-off-by: Shukun Tan <tanshukun1@huawei.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/hisilicon/qm.h')
-rw-r--r--drivers/crypto/hisilicon/qm.h24
1 files changed, 21 insertions, 3 deletions
diff --git a/drivers/crypto/hisilicon/qm.h b/drivers/crypto/hisilicon/qm.h
index d1be8cdc99a3..eff156a26f48 100644
--- a/drivers/crypto/hisilicon/qm.h
+++ b/drivers/crypto/hisilicon/qm.h
@@ -84,8 +84,24 @@
/* page number for queue file region */
#define QM_DOORBELL_PAGE_NR 1
+enum qm_stop_reason {
+ QM_NORMAL,
+ QM_SOFT_RESET,
+ QM_FLR,
+};
+
+enum qm_state {
+ QM_INIT = 0,
+ QM_START,
+ QM_CLOSE,
+ QM_STOP,
+};
+
enum qp_state {
+ QP_INIT = 1,
+ QP_START,
QP_STOP,
+ QP_CLOSE,
};
enum qm_hw_ver {
@@ -129,7 +145,8 @@ struct hisi_qm_status {
bool eqc_phase;
u32 aeq_head;
bool aeqc_phase;
- unsigned long flags;
+ atomic_t flags;
+ int stop_reason;
};
struct hisi_qm;
@@ -196,7 +213,7 @@ struct hisi_qm {
struct hisi_qm_err_status err_status;
unsigned long reset_flag;
- rwlock_t qps_lock;
+ struct rw_semaphore qps_lock;
unsigned long *qp_bitmap;
struct hisi_qp **qp_array;
@@ -225,7 +242,7 @@ struct hisi_qp_status {
u16 sq_tail;
u16 cq_head;
bool cqc_phase;
- unsigned long flags;
+ atomic_t flags;
};
struct hisi_qp_ops {
@@ -250,6 +267,7 @@ struct hisi_qp {
void (*event_cb)(struct hisi_qp *qp);
struct hisi_qm *qm;
+ bool is_resetting;
u16 pasid;
struct uacce_queue *uacce_q;
};