summaryrefslogtreecommitdiffstats
path: root/hw/virtio/virtio.c
diff options
context:
space:
mode:
authorXie Yongji2019-03-20 12:26:41 +0100
committerMichael S. Tsirkin2019-05-21 00:40:02 +0200
commit7dc7f12297bcee93e0b1974262d18c51cb386e8e (patch)
treed85e38cb88af86c9c58e82cf11c3e26c37113c1b /hw/virtio/virtio.c
parentvirtio: Introduce started flag to VirtioDevice (diff)
downloadqemu-7dc7f12297bcee93e0b1974262d18c51cb386e8e.tar.gz
qemu-7dc7f12297bcee93e0b1974262d18c51cb386e8e.tar.xz
qemu-7dc7f12297bcee93e0b1974262d18c51cb386e8e.zip
virtio: Use started flag in virtio_vmstate_change()
Currently, we use DRIVER_OK status bit to check whether guest driver has started the device in virtio_vmstate_change(). But it's not the case for virtio 1.0 transitional devices. If migration completes between kicking virtqueue and setting VIRTIO_CONFIG_S_DRIVER_OK, guest may be hung. So here we use started flag to check guest state instead. Signed-off-by: Xie Yongji <xieyongji@baidu.com> Signed-off-by: Zhang Yu <zhangyu31@baidu.com> Message-Id: <20190320112646.3712-3-xieyongji@baidu.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/virtio/virtio.c')
-rw-r--r--hw/virtio/virtio.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 5d533ac74e..4805727b53 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -2291,7 +2291,7 @@ static void virtio_vmstate_change(void *opaque, int running, RunState state)
VirtIODevice *vdev = opaque;
BusState *qbus = qdev_get_parent_bus(DEVICE(vdev));
VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
- bool backend_run = running && (vdev->status & VIRTIO_CONFIG_S_DRIVER_OK);
+ bool backend_run = running && vdev->started;
vdev->vm_running = running;
if (backend_run) {