qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] virtio: Change order of appling runstate to device and bus
@ 2019-12-20 12:52 Anton Kuchin
  2020-01-06 12:43 ` Michael S. Tsirkin
  0 siblings, 1 reply; 2+ messages in thread
From: Anton Kuchin @ 2019-12-20 12:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anton Kuchin, yc-core, Michael S. Tsirkin

On transition to running first apply state to bus and then to device
so device can access bus functions correctly. When going to stopped
notify device first and then the bus.

Signed-off-by: Anton Kuchin <antonkuchin@yandex-team.ru>
---
 hw/virtio/virtio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 04716b5f6c..2ea2edba10 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -3096,7 +3096,7 @@ static void virtio_vmstate_change(void *opaque, int running, RunState state)
     bool backend_run = running && virtio_device_started(vdev, vdev->status);
     vdev->vm_running = running;
 
-    if (backend_run) {
+    if (!backend_run) {
         virtio_set_status(vdev, vdev->status);
     }
 
@@ -3104,7 +3104,7 @@ static void virtio_vmstate_change(void *opaque, int running, RunState state)
         k->vmstate_change(qbus->parent, backend_run);
     }
 
-    if (!backend_run) {
+    if (backend_run) {
         virtio_set_status(vdev, vdev->status);
     }
 }
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-06 12:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-20 12:52 [RFC PATCH] virtio: Change order of appling runstate to device and bus Anton Kuchin
2020-01-06 12:43 ` Michael S. Tsirkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).