Re: [PATCH 2/2] uacce: add uacce module

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

 



Hi, Greg

Thanks for your kind suggestion.

On 2019/8/15 下午10:12, Greg Kroah-Hartman wrote:
On Wed, Aug 14, 2019 at 05:34:25PM +0800, Zhangfei Gao wrote:
diff --git a/include/uapi/misc/uacce.h b/include/uapi/misc/uacce.h
new file mode 100644
index 0000000..44a0a5d
--- /dev/null
+++ b/include/uapi/misc/uacce.h
@@ -0,0 +1,44 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+#ifndef _UAPIUUACCE_H
+#define _UAPIUUACCE_H
+
+#include <linux/types.h>
+#include <linux/ioctl.h>
+
+#define UACCE_CLASS_NAME	"uacce"
Why is this in a uapi file?
User app need get attribute from /sys/class,
For example: /sys/class/uacce/hisi_zip-0/xxx
UACCE_CLASS_NAME here tells app which subsystem to open, /sys/class/subsystem/

+#define UACCE_DEV_ATTRS		"attrs"
Same here.
Yes, we can remove this.
We can put attrs directly under /sys/class/uacce/hisi_zip-0/xxx
+#define UACCE_CMD_SHARE_SVAS	_IO('W', 0)
+#define UACCE_CMD_START		_IO('W', 1)
+#define UACCE_CMD_GET_SS_DMA	_IOR('W', 2, unsigned long)
+
+/**
+ * UACCE Device Attributes:
+ *
+ * NOIOMMU: the device has no IOMMU support
+ *	can do share sva, but no map to the dev
+ * PASID: the device has IOMMU which support PASID setting
+ *	can do share sva, mapped to dev per process
+ * FAULT_FROM_DEV: the device has IOMMU which can do page fault request
+ *	no need for share sva, should be used with PASID
+ * SVA: full function device
+ * SHARE_DOMAIN: no PASID, can do share sva only for one process and the kernel
+ */
+#define UACCE_DEV_NOIOMMU		(1 << 0)
+#define UACCE_DEV_PASID			(1 << 1)
+#define UACCE_DEV_FAULT_FROM_DEV	(1 << 2)
+#define UACCE_DEV_SVA		(UACCE_DEV_PASID | UACCE_DEV_FAULT_FROM_DEV)
+#define UACCE_DEV_SHARE_DOMAIN	(0)
+
+#define UACCE_API_VER_NOIOMMU_SUBFIX	"_noiommu"
+
+#define UACCE_QFR_NA ((unsigned long)-1)
+enum uacce_qfrt {
+	UACCE_QFRT_MMIO = 0,	/* device mmio region */
+	UACCE_QFRT_DKO,		/* device kernel-only */
+	UACCE_QFRT_DUS,		/* device user share */
+	UACCE_QFRT_SS,		/* static share memory */
+	UACCE_QFRT_MAX,
These enums need to be explicitly set, as per the documentation,
otherwise they could be messed up when dealing with odd compilers.
OK, understand now.
+};
+#define UACCE_QFRT_INVALID UACCE_QFRT_MAX
Why not just use INVALID instead of MAX?
Will directly use UACCE_QFRT_MAX, which is suitable in for loop.

Thanks





[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux