[PATCH RFC 1/3] vdpa: introduce dedicated descriptor group for virtqueue

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

 



In some cases, the access to the virtqueue's descriptor table (including
the associated available and used ring for split layout) has to be
isolated from guest memory access where the buffer address contained in
vring descriptor points to. Introduce dedicated descriptor group with
driver op .get_vq_desc_group(), denoting the descriptor table portion of a
virtqueue can optionally reside on a different group than what's obtained
via the .get_vq_group() op. The descriptor group may or may not share a
same group ID as the default group of the virtqueue. If the descriptor
group has a different ID, it means the descriptor table portion of the
virtqueue potentially can be placed onto a separate address space than
where guest memory resides. For this to work, .set_group_asid() API will
accept the dedicated group ID for descriptor table to get it associated
to certain ASID, while the .reset() semantics of resetting all groups
(including descriptor table group) back to ASID 0 remain same.

QEMU's shadow virtqueue is going to use dedicated descriptor group not
just to isolate the access between descriptors and buffers, but also
speed up the mapping setup process for shadow vring descriptors.

Signed-off-by: Si-Wei Liu <si-wei.liu@xxxxxxxxxx>
---
 include/linux/vdpa.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h
index db1b0ea..17a4efa 100644
--- a/include/linux/vdpa.h
+++ b/include/linux/vdpa.h
@@ -204,6 +204,16 @@ struct vdpa_map_file {
  *				@vdev: vdpa device
  *				@idx: virtqueue index
  *				Returns u32: group id for this virtqueue
+ * @get_vq_desc_group:		Get the group id for the descriptor table of
+ *				a specific virtqueue (optional)
+ *				@vdev: vdpa device
+ *				@idx: virtqueue index
+ *				Returns u32: group id for the descriptor table
+ *				portion of this virtqueue. Could be different
+ *				than the one from @get_vq_group, in which case
+ *				the access to the descriptor table can be
+ *				confined to a separate asid, isolating from
+ *				the virtqueue's buffer address access.
  * @get_device_features:	Get virtio features supported by the device
  *				@vdev: vdpa device
  *				Returns the virtio features support by the
@@ -357,6 +367,7 @@ struct vdpa_config_ops {
 	/* Device ops */
 	u32 (*get_vq_align)(struct vdpa_device *vdev);
 	u32 (*get_vq_group)(struct vdpa_device *vdev, u16 idx);
+	u32 (*get_vq_desc_group)(struct vdpa_device *vdev, u16 idx);
 	u64 (*get_device_features)(struct vdpa_device *vdev);
 	int (*set_driver_features)(struct vdpa_device *vdev, u64 features);
 	u64 (*get_driver_features)(struct vdpa_device *vdev);
-- 
1.8.3.1

_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/virtualization



[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux