Skip to content

Commit

Permalink
virtio: Don't change "started" flag on virtio_vmstate_change()
Browse files Browse the repository at this point in the history
We will call virtio_set_status() on virtio_vmstate_change().
The "started" flag should not be changed in this case. Otherwise,
we may get an incorrect value when we set "started" flag but
not set DRIVER_OK in source VM.

Signed-off-by: Xie Yongji <xieyongji@baidu.com>
Message-Id: <20190626023130.31315-6-xieyongji@baidu.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
  • Loading branch information
Xie Yongji authored and mstsirkin committed Jul 4, 2019
1 parent 8b04e2c commit 4c5cf37
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion hw/virtio/virtio.c
Expand Up @@ -1163,7 +1163,10 @@ int virtio_set_status(VirtIODevice *vdev, uint8_t val)
}
}

virtio_set_started(vdev, val & VIRTIO_CONFIG_S_DRIVER_OK);
if ((vdev->status & VIRTIO_CONFIG_S_DRIVER_OK) !=
(val & VIRTIO_CONFIG_S_DRIVER_OK)) {
virtio_set_started(vdev, val & VIRTIO_CONFIG_S_DRIVER_OK);
}

if (k->set_status) {
k->set_status(vdev, val);
Expand Down

0 comments on commit 4c5cf37

Please sign in to comment.