diff options
author | Xie Yongji <xieyongji@baidu.com> | 2019-06-26 10:31:30 +0800 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2019-07-04 17:00:32 -0400 |
commit | 4c5cf37b504b1444b031d5c9af6b6ad2f171d006 (patch) | |
tree | f9a6d4972ed0ebf811e5a7986f6f2e14b5ebc87d /hw | |
parent | 8b04e2c797b01a4baf379ec4f40b3f0e9cdf7a25 (diff) | |
download | qemu-4c5cf37b504b1444b031d5c9af6b6ad2f171d006.zip qemu-4c5cf37b504b1444b031d5c9af6b6ad2f171d006.tar.gz qemu-4c5cf37b504b1444b031d5c9af6b6ad2f171d006.tar.bz2 |
virtio: Don't change "started" flag on virtio_vmstate_change()
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>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/virtio/virtio.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index e098fc8..18f9f4c 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -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); |