diff mbox series

[RFC,v3,29/29] vhost: Start vhost-vdpa SVQ directly

Message ID 20210519162903.1172366-30-eperezma@redhat.com (mailing list archive)
State New, archived
Headers show
Series vDPA software assisted live migration | expand

Commit Message

Eugenio Perez Martin May 19, 2021, 4:29 p.m. UTC
Since it does not have sense to keep a non-working vdpa device, start
directly in SVQ mode.

Signed-off-by: Eugenio PĂ©rez <eperezma@redhat.com>
---
 hw/virtio/vhost.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 286863ad42..fd812e1a80 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1386,7 +1386,6 @@  static bool vhost_sw_live_migration_start_vq(struct vhost_dev *dev,
         assert(r == VHOST_DMA_MAP_OK);
     }
 
-    vhost_virtqueue_stop(dev, dev->vdev, &dev->vqs[idx], dev->vq_index + idx);
     /* TODO: Why cannot make this read only? */
     r = vhost_vdpa_dma_map(dev->opaque, addr.desc_user_addr, driver_region.size,
                            (void *)driver_region.translated_addr, false);
@@ -1467,6 +1466,11 @@  static int vhost_sw_live_migration_start(struct vhost_dev *dev)
 
     /* Can be read by vhost_virtqueue_mask, from vm exit */
     dev->shadow_vqs_enabled = true;
+
+    /* Reset device, so SVQ can assign its address */
+    r = dev->vhost_ops->vhost_dev_start(dev, false);
+    assert(r == 0);
+
     for (idx = 0; idx < dev->nvqs; ++idx) {
         bool ok = vhost_sw_live_migration_start_vq(dev, idx);
         if (unlikely(!ok)) {
@@ -2107,6 +2111,8 @@  int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev)
             vhost_device_iotlb_miss(hdev, vq->used_phys, true);
         }
     }
+
+    vhost_sw_live_migration_start(hdev);
     return 0;
 fail_log:
     vhost_log_put(hdev, false);