History

vduse: Support registering userspace memory for IOVA regions

Introduce two ioctls: VDUSE_IOTLB_REG_UMEM and VDUSE_IOTLB_DEREG_UMEM to support registering and de-registering userspace memory for IOVA regions. Now it only supports registering userspace memory for bounce buffer region in virtio-vdpa case.

Xie Yongji committed 4 years ago

Commit 79a463b1 parent 6c77ed22 files · +164 −0Browse files

Showing the changes to include/uapi (1 of 2 files). Show all

Unified · Split

include/uapi/linux/vduse.h+23−0
@@ -210,6 +210,29 @@ struct vduse_vq_eventfd { · 209 unmodified lines
210210 */
211211 #define VDUSE_VQ_INJECT_IRQ _IOW(VDUSE_BASE, 0x17, __u32)
212212
213+/**
214+ * struct vduse_iova_umem - userspace memory configuration for one IOVA region
215+ * @uaddr: start address of userspace memory, it must be aligned to page size
216+ * @iova: start of the IOVA region
217+ * @size: size of the IOVA region
218+ * @reserved: for future use, needs to be initialized to zero
219+ *
220+ * Structure used by VDUSE_IOTLB_REG_UMEM and VDUSE_IOTLB_DEREG_UMEM
221+ * ioctls to register/de-register userspace memory for IOVA regions
222+ */
223+struct vduse_iova_umem {
224+ __u64 uaddr;
225+ __u64 iova;
226+ __u64 size;
227+ __u64 reserved[3];
228+};
229+
230+/* Register userspace memory for IOVA regions */
231+#define VDUSE_IOTLB_REG_UMEM _IOW(VDUSE_BASE, 0x18, struct vduse_iova_umem)
232+
233+/* De-register the userspace memory. Caller should set iova and size field. */
234+#define VDUSE_IOTLB_DEREG_UMEM _IOW(VDUSE_BASE, 0x19, struct vduse_iova_umem)
235+
213236 /* The control messages definition for read(2)/write(2) on /dev/vduse/$NAME */
214237
215238 /**