This is needed to achieve migration, so destination can restore its index. Signed-off-by: Eugenio Pérez <epere...@redhat.com> --- hw/virtio/vhost-vdpa.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 276a559649..887857c177 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -716,8 +716,17 @@ static int vhost_vdpa_set_vring_base(struct vhost_dev *dev, static int vhost_vdpa_get_vring_base(struct vhost_dev *dev, struct vhost_vring_state *ring) { + struct vhost_vdpa *v = dev->opaque; int ret; + if (v->shadow_vqs_enabled) { + VhostShadowVirtqueue *svq = g_ptr_array_index(v->shadow_vqs, + ring->index); + + ring->num = vhost_svq_get_last_used_idx(svq); + return 0; + } + ret = vhost_vdpa_call(dev, VHOST_GET_VRING_BASE, ring); trace_vhost_vdpa_get_vring_base(dev, ring->index, ring->num); return ret; -- 2.27.0