When used by vhost-vDPA bus driver for VM, the control virtqueue should be shadowed via userspace VMM (QEMU) instead of being assigned directly to Guest. This is because QEMU needs to know the device state in order to start and stop device correctly (e.g for Live Migration).
This requies to isolate the memory mapping for control virtqueue presented by vhost-vDPA to prevent guest from accessing it directly. This patches introduces the multiple address spaces support for VDUSE device. This idea is to identify a specific address space via an dedicated identifier - ASID. The VDUSE device needs to report the number of virtqueue groups and the association with each virtqueue, and also the number of address space supported. Then, the vDPA driver can modify the ASID assigned to each VQ group to isolate the memory AS. This is already done for vdpa_sim and nvidia mlx5 devices. This helps to isolate the environments for the virtqueues that will not be assigned directly. E.g in the case of virtio-net, the control virtqueue will not be assigned directly to guest. This is an RFC has only been tested with vhost_vdpa, so it deserves more testing with virtio_vdpa. And it still has some TODOs pending. Sending to gather early feedback. Also, to be able to test this patch, the user needs to manually revert 56e71885b034 ("vduse: Temporarily fail if control queue feature requested"). Eugenio Pérez (6): vduse: add v1 API definition vduse: add vq group support vduse: add vq group asid support vduse: send update_iotlb_v2 message vduse: reset group asid in reset vduse: bump version number drivers/vdpa/vdpa_user/vduse_dev.c | 307 ++++++++++++++++++++++------- include/uapi/linux/vduse.h | 64 +++++- 2 files changed, 298 insertions(+), 73 deletions(-) -- 2.49.0