Re: [PATCH 1/3] uacce: supports device isolation feature

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

 





On 2022/6/14 下午8:29, Kai Ye wrote:
UACCE add the hardware error isolation API. Users can configure
the error frequency threshold by this vfs node. This API interface
certainly supports the configuration of user protocol strategy. Then
parse it inside the device driver. UACCE only reports the device
isolate state. When the error frequency is exceeded, the device
will be isolated. The isolation strategy should be defined in each
driver module.

Signed-off-by: Kai Ye <yekai13@xxxxxxxxxx>
Reviewed-by: Zhou Wang <wangzhou1@xxxxxxxxxxxxx>
---
  drivers/misc/uacce/uacce.c | 51 ++++++++++++++++++++++++++++++++++++++
  include/linux/uacce.h      | 15 ++++++++++-
  2 files changed, 65 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/uacce/uacce.c b/drivers/misc/uacce/uacce.c
index b6219c6bfb48..4d9d9aeb145a 100644
--- a/drivers/misc/uacce/uacce.c
+++ b/drivers/misc/uacce/uacce.c
@@ -12,6 +12,20 @@ static dev_t uacce_devt;
  static DEFINE_MUTEX(uacce_mutex);
  static DEFINE_XARRAY_ALLOC(uacce_xa);
+static int cdev_get(struct device *dev, void *data)
+{
+	struct uacce_device *uacce;
+	struct device **t_dev = data;
+
+	uacce = container_of(dev, struct uacce_device, dev);
+	if (uacce->parent == *t_dev) {
+		*t_dev = dev;
+		return 1;
+	}
+
+	return 0;
+}
+
  static int uacce_start_queue(struct uacce_queue *q)
  {
  	int ret = 0;
@@ -346,12 +360,47 @@ static ssize_t region_dus_size_show(struct device *dev,
  		       uacce->qf_pg_num[UACCE_QFRT_DUS] << PAGE_SHIFT);
  }
+static ssize_t isolate_show(struct device *dev,
+			    struct device_attribute *attr, char *buf)
+{
+	struct uacce_device *uacce = to_uacce_device(dev);
+
+	return sysfs_emit(buf, "%d\n", uacce->ops->get_isolate_state(uacce));
Are these two isolate ops  required or optional?
Do we need consider NULL pointer?

Thanks



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