aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio/virtio.c
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2014-09-04 13:32:54 +0300
committerStefan Hajnoczi <stefanha@redhat.com>2014-09-04 17:19:09 +0100
commit269bd822e7f5ab80048b05fb7076236ed66ffbce (patch)
treea1bd76de81f18612bae3dacf9890ea61f3d571a4 /hw/virtio/virtio.c
parente8bcf842001739765b8dcc1996d86a0ffd2054d5 (diff)
virtio: don't call device on !vm_running
On vm stop, virtio changes vm_running state too soon, so callbacks can get envoked with vm_running = false; Cc: qemu-stable@nongnu.org Cc: Jason Wang <jasowang@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'hw/virtio/virtio.c')
-rw-r--r--hw/virtio/virtio.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 5c981801f3..ac222385d6 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -1108,7 +1108,10 @@ static void virtio_vmstate_change(void *opaque, int running, RunState state)
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);
- vdev->vm_running = running;
+
+ if (running) {
+ vdev->vm_running = running;
+ }
if (backend_run) {
virtio_set_status(vdev, vdev->status);
@@ -1121,6 +1124,10 @@ static void virtio_vmstate_change(void *opaque, int running, RunState state)
if (!backend_run) {
virtio_set_status(vdev, vdev->status);
}
+
+ if (!running) {
+ vdev->vm_running = running;
+ }
}
void virtio_init(VirtIODevice *vdev, const char *name,