Commit b67202e8 authored by Zhou Wang's avatar Zhou Wang Committed by Herbert Xu

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: default avatarZhou Wang <wangzhou1@hisilicon.com>
Signed-off-by: default avatarShukun Tan <tanshukun1@huawei.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 20b291f5
This diff is collapsed.
...@@ -84,8 +84,24 @@ ...@@ -84,8 +84,24 @@
/* page number for queue file region */ /* page number for queue file region */
#define QM_DOORBELL_PAGE_NR 1 #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 { enum qp_state {
QP_INIT = 1,
QP_START,
QP_STOP, QP_STOP,
QP_CLOSE,
}; };
enum qm_hw_ver { enum qm_hw_ver {
...@@ -129,7 +145,8 @@ struct hisi_qm_status { ...@@ -129,7 +145,8 @@ struct hisi_qm_status {
bool eqc_phase; bool eqc_phase;
u32 aeq_head; u32 aeq_head;
bool aeqc_phase; bool aeqc_phase;
unsigned long flags; atomic_t flags;
int stop_reason;
}; };
struct hisi_qm; struct hisi_qm;
...@@ -196,7 +213,7 @@ struct hisi_qm { ...@@ -196,7 +213,7 @@ struct hisi_qm {
struct hisi_qm_err_status err_status; struct hisi_qm_err_status err_status;
unsigned long reset_flag; unsigned long reset_flag;
rwlock_t qps_lock; struct rw_semaphore qps_lock;
unsigned long *qp_bitmap; unsigned long *qp_bitmap;
struct hisi_qp **qp_array; struct hisi_qp **qp_array;
...@@ -225,7 +242,7 @@ struct hisi_qp_status { ...@@ -225,7 +242,7 @@ struct hisi_qp_status {
u16 sq_tail; u16 sq_tail;
u16 cq_head; u16 cq_head;
bool cqc_phase; bool cqc_phase;
unsigned long flags; atomic_t flags;
}; };
struct hisi_qp_ops { struct hisi_qp_ops {
...@@ -250,6 +267,7 @@ struct hisi_qp { ...@@ -250,6 +267,7 @@ struct hisi_qp {
void (*event_cb)(struct hisi_qp *qp); void (*event_cb)(struct hisi_qp *qp);
struct hisi_qm *qm; struct hisi_qm *qm;
bool is_resetting;
u16 pasid; u16 pasid;
struct uacce_queue *uacce_q; struct uacce_queue *uacce_q;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment