@@ -40,9 +40,21 @@ static void vhost_vsock_ccw_class_init(ObjectClass *klass, void *data)
static void vhost_vsock_ccw_instance_init(Object *obj)
{
VHostVSockCCWState *dev = VHOST_VSOCK_CCW(obj);
+ VirtioCcwDevice *ccw_dev = VIRTIO_CCW_DEVICE(obj);
+ VirtIODevice *virtio_dev;
virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
TYPE_VHOST_VSOCK);
+
+ virtio_dev = VIRTIO_DEVICE(&dev->vdev);
+
+ /*
+ * To avoid migration issues, we force virtio version 1 only when
+ * legacy check is enabled in the new machine types (>= 5.1).
+ */
+ if (!virtio_legacy_check_disabled(virtio_dev)) {
+ ccw_dev->force_revision_1 = true;
+ }
}
static const TypeInfo vhost_vsock_ccw_info = {