Skip to content

Commit a72cac6

Browse files
siwliu-kernelmstsirkin
authored andcommitted
vdpa: introduce dedicated descriptor group for virtqueue
In some cases, the access to the virtqueue's descriptor area, device and driver areas (precluding indirect descriptor table in guest memory) may have to be confined to a different address space than where its buffers reside. Without loss of simplicity and generality with already established terminology, let's fold up these 3 areas and call them as a whole as descriptor table group, or descriptor group for short. Specifically, in case of split virtqueues, descriptor group consists of regions for Descriptor Table, Available Ring and Used Ring; for packed virtqueues layout, descriptor group contains Descriptor Ring, Driver and Device Event Suppression structures. The group ID for a dedicated descriptor group can be obtained through a new .get_vq_desc_group() op. If driver implements this op, it means that the descriptor, device and driver areas of the virtqueue may reside in a dedicated group than where its buffers reside, a.k.a the default virtqueue group through the .get_vq_group() op. In principle, the descriptor group may or may not have same group ID as the default group. Even if the descriptor group has a different ID, meaning the vq's descriptor group areas can optionally move to a separate address space than where guest memory resides, the descriptor group may still start from a default address space, same as where its buffers reside. To move the descriptor group to a different address space, .set_group_asid() has to be called to change the ASID binding for the group, which is no different than what needs to be done on any other virtqueue group. On the other hand, the .reset() semantics also applies on descriptor table group, meaning the device reset will clear all ASID bindings and move all virtqueue groups including descriptor group back to the default address space, i.e. in ASID 0. QEMU's shadow virtqueue is going to utilize dedicated descriptor group to speed up map and unmap operations, yielding tremendous downtime reduction by avoiding the full and slow remap cycle in SVQ switching. Signed-off-by: Si-Wei Liu <[email protected]> Acked-by: Eugenio Pérez <[email protected]> Acked-by: Jason Wang <[email protected]> Message-Id: <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> Reviewed-by: Si-Wei Liu <[email protected]> Tested-by: Si-Wei Liu <[email protected]> Tested-by: Lei Yang <[email protected]>
1 parent 71d47b3 commit a72cac6

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

include/linux/vdpa.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,16 @@ struct vdpa_map_file {
204204
* @vdev: vdpa device
205205
* @idx: virtqueue index
206206
* Returns u32: group id for this virtqueue
207+
* @get_vq_desc_group: Get the group id for the descriptor table of
208+
* a specific virtqueue (optional)
209+
* @vdev: vdpa device
210+
* @idx: virtqueue index
211+
* Returns u32: group id for the descriptor table
212+
* portion of this virtqueue. Could be different
213+
* than the one from @get_vq_group, in which case
214+
* the access to the descriptor table can be
215+
* confined to a separate asid, isolating from
216+
* the virtqueue's buffer address access.
207217
* @get_device_features: Get virtio features supported by the device
208218
* @vdev: vdpa device
209219
* Returns the virtio features support by the
@@ -360,6 +370,7 @@ struct vdpa_config_ops {
360370
/* Device ops */
361371
u32 (*get_vq_align)(struct vdpa_device *vdev);
362372
u32 (*get_vq_group)(struct vdpa_device *vdev, u16 idx);
373+
u32 (*get_vq_desc_group)(struct vdpa_device *vdev, u16 idx);
363374
u64 (*get_device_features)(struct vdpa_device *vdev);
364375
u64 (*get_backend_features)(const struct vdpa_device *vdev);
365376
int (*set_driver_features)(struct vdpa_device *vdev, u64 features);

0 commit comments

Comments
 (0)