[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC 1/7] vhost: introduce new UAPI to support IOMMUFD
|
From: |
Cindy Lu |
|
Subject: |
[RFC 1/7] vhost: introduce new UAPI to support IOMMUFD |
|
Date: |
Wed, 3 May 2023 17:13:31 +0800 |
Add 3 new UAPI
VHOST_VDPA_SET_IOMMU_FD: this to bind the vdpa device to iommufd
VDPA_DEVICE_ATTACH_IOMMUFD_AS: attach new ioas to iommufd
VDPA_DEVICE_DTTACH_IOMMUFD_AS: detach all the ioas from iommufd
Signed-off-by: Cindy Lu <lulu@redhat.com>
---
linux-headers/linux/vhost.h | 72 +++++++++++++++++++++++++++++++++++++
1 file changed, 72 insertions(+)
diff --git a/linux-headers/linux/vhost.h b/linux-headers/linux/vhost.h
index f9f115a7c7..bf426177f3 100644
--- a/linux-headers/linux/vhost.h
+++ b/linux-headers/linux/vhost.h
@@ -180,4 +180,76 @@
*/
#define VHOST_VDPA_SUSPEND _IO(VHOST_VIRTIO, 0x7D)
+/* vhost vdpa set iommufd
+ * Input parameters:
+ * @iommufd: file descriptor from /dev/iommu; pass -1 to unset
+ * @group_id: identifier of the group that a virtqueue belongs to
+ * @ioas_id: IOAS identifier returned from ioctl(IOMMU_IOAS_ALLOC)
+ * Output parameters:
+ * @out_dev_id: device identifier
+ * @out_hwpt_id: hardware IO pagetable identifier
+ */
+struct vhost_vdpa_set_iommufd {
+ __s32 iommufd;
+ __u32 group_id;
+ __u32 ioas_id;
+ __u32 out_devid;
+ __u32 out_hwptid;
+};
+
+#define VHOST_VDPA_SET_IOMMU_FD \
+ _IOW(VHOST_VIRTIO, 0x7e, struct vhost_vdpa_set_iommufd)
+
+/*
+ * VDPA_DEVICE_ATTACH_IOMMUFD_AS -
+ * _IOW(VHOST_VIRTIO, 0x7f, struct vdpa_device_attach_iommufd_as)
+ *
+ * Attach a vdpa device to an iommufd address space specified by IOAS
+ * id.
+ *
+ * Available only after a device has been bound to iommufd via
+ * VHOST_VDPA_SET_IOMMU_FD
+ *
+ * Undo by VDPA_DEVICE_DETACH_IOMMUFD_AS or device fd close.
+ *
+ * @argsz: user filled size of this data.
+ * @flags: must be 0.
+ * @ioas_id: Input the target id which can represent an ioas
+ * allocated via iommufd subsystem.
+ *
+ * Return: 0 on success, -errno on failure.
+ */
+struct vdpa_device_attach_iommufd_as {
+ __u32 argsz;
+ __u32 flags;
+ __u32 ioas_id;
+};
+
+#define VDPA_DEVICE_ATTACH_IOMMUFD_AS \
+ _IOW(VHOST_VIRTIO, 0x7f, struct vdpa_device_attach_iommufd_as)
+
+
+/*
+ * VDPA_DEVICE_DETACH_IOMMUFD_AS
+ *
+ * Detach a vdpa device from the iommufd address space it has been
+ * attached to. After it, device should be in a blocking DMA state.
+ *
+ * Available only after a device has been bound to iommufd via
+ * VHOST_VDPA_SET_IOMMU_FD
+ *
+ * @argsz: user filled size of this data.
+ * @flags: must be 0.
+ *
+ * Return: 0 on success, -errno on failure.
+ */
+struct vdpa_device_detach_iommufd_as {
+ __u32 argsz;
+ __u32 flags;
+};
+
+#define VDPA_DEVICE_DETACH_IOMMUFD_AS \
+ _IOW(VHOST_VIRTIO, 0x83, struct vdpa_device_detach_iommufd_as)
+
+
#endif
--
2.34.3
- [RFC 0/7] vhost-vdpa: add support for iommufd, Cindy Lu, 2023/05/03
- [RFC 1/7] vhost: introduce new UAPI to support IOMMUFD,
Cindy Lu <=
- [RFC 3/7] virtio : add a ptr for vdpa_iommufd in VirtIODevice, Cindy Lu, 2023/05/03
- [RFC 2/7] qapi: support iommufd in vdpa, Cindy Lu, 2023/05/03
- [RFC 6/7] vhost-vdpa: init iommufd function in vhost_vdpa start, Cindy Lu, 2023/05/03
- [RFC 4/7] net/vhost-vdpa: Add the check for iommufd, Cindy Lu, 2023/05/03
- [RFC 5/7] vhost-vdpa: Add the iommufd support in the map/unmap function, Cindy Lu, 2023/05/03
- [RFC 7/7] vhost-vdpa-iommufd: Add iommufd support for vdpa, Cindy Lu, 2023/05/03
- Re: [RFC 0/7] vhost-vdpa: add support for iommufd, Jason Wang, 2023/05/04