Re: [PATCH v2 3/3] crypto: hisilicon/qm - defining the device isolation strategy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 2022/6/14 下午8:29, Kai Ye via Linux-accelerators wrote:
Define the device isolation strategy by the device driver. if the
AER error frequency exceeds the value of setting for a certain
period of time, The device will not be available in user space. The VF
device use the PF device isolation strategy. All the hardware errors
are processed by PF driver.

Signed-off-by: Kai Ye <yekai13@xxxxxxxxxx>
---
  drivers/crypto/hisilicon/qm.c | 157 +++++++++++++++++++++++++++++++---
  include/linux/hisi_acc_qm.h   |   9 ++
  2 files changed, 152 insertions(+), 14 deletions(-)

diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
index ad83c194d664..47c41fa52693 100644
--- a/drivers/crypto/hisilicon/qm.c
+++ b/drivers/crypto/hisilicon/qm.c
@@ -12,7 +12,6 @@
  #include <linux/pm_runtime.h>
  #include <linux/seq_file.h>
  #include <linux/slab.h>
-#include <linux/uacce.h>
  #include <linux/uaccess.h>
  #include <uapi/misc/uacce/hisi_qm.h>
  #include <linux/hisi_acc_qm.h>
@@ -417,6 +416,16 @@ struct hisi_qm_resource {
  	struct list_head list;
  };
+/**
+ * struct qm_hw_err - structure of describes the device err
+ * @list: hardware error list
+ * @tick_stamp: timestamp when the error occurred
+ */
+struct qm_hw_err {
+	struct list_head list;
+	unsigned long long tick_stamp;
+};
+
  struct hisi_qm_hw_ops {
  	int (*get_vft)(struct hisi_qm *qm, u32 *base, u32 *number);
  	void (*qm_db)(struct hisi_qm *qm, u16 qn,
@@ -3278,6 +3287,7 @@ static int hisi_qm_uacce_get_queue(struct uacce_device *uacce,
  	qp->event_cb = qm_qp_event_notifier;
  	qp->pasid = arg;
  	qp->is_in_kernel = false;
+	atomic_inc(&qm->uacce_ref);
return 0;
  }
@@ -3285,7 +3295,9 @@ static int hisi_qm_uacce_get_queue(struct uacce_device *uacce,
  static void hisi_qm_uacce_put_queue(struct uacce_queue *q)
  {
  	struct hisi_qp *qp = q->priv;
+	struct hisi_qm *qm = qp->qm;
+ atomic_dec(&qm->uacce_ref);

Can we use qm state or qp state instead?

enum qm_state {
        QM_INIT = 0,
        QM_START,
        QM_CLOSE,
        QM_STOP,
};

enum qp_state {
        QP_INIT = 1,
        QP_START,
        QP_STOP,
        QP_CLOSE,
};

Thanks




[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux