summaryrefslogtreecommitdiffstats
path: root/hw
diff options
context:
space:
mode:
authorAlex Bennée2022-11-30 12:24:37 +0100
committerMichael S. Tsirkin2022-12-01 08:30:09 +0100
commit060f4a944072ecf37cece0f16a0609babfb679b8 (patch)
tree39a5a07ca019e2b4fc72f4033050e38887c15c1b /hw
parentvhost: enable vrings in vhost_dev_start() for vhost-user devices (diff)
downloadqemu-060f4a944072ecf37cece0f16a0609babfb679b8.tar.gz
qemu-060f4a944072ecf37cece0f16a0609babfb679b8.tar.xz
qemu-060f4a944072ecf37cece0f16a0609babfb679b8.zip
hw/virtio: add started_vu status field to vhost-user-gpio
As per the fix to vhost-user-blk in f5b22d06fb (vhost: recheck dev state in the vhost_migration_log routine) we really should track the connection and starting separately. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Message-Id: <20221130112439.2527228-4-alex.bennee@linaro.org> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/virtio/vhost-user-gpio.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/hw/virtio/vhost-user-gpio.c b/hw/virtio/vhost-user-gpio.c
index 0b40ebd15a..be9be08b4c 100644
--- a/hw/virtio/vhost-user-gpio.c
+++ b/hw/virtio/vhost-user-gpio.c
@@ -86,6 +86,7 @@ static int vu_gpio_start(VirtIODevice *vdev)
error_report("Error starting vhost-user-gpio: %d", ret);
goto err_guest_notifiers;
}
+ gpio->started_vu = true;
/*
* guest_notifier_mask/pending not used yet, so just unmask
@@ -126,16 +127,12 @@ static void vu_gpio_stop(VirtIODevice *vdev)
struct vhost_dev *vhost_dev = &gpio->vhost_dev;
int ret;
- if (!k->set_guest_notifiers) {
+ if (!gpio->started_vu) {
return;
}
+ gpio->started_vu = false;
- /*
- * We can call vu_gpio_stop multiple times, for example from
- * vm_state_notify and the final object finalisation. Check we
- * aren't already stopped before doing so.
- */
- if (!vhost_dev_is_started(vhost_dev)) {
+ if (!k->set_guest_notifiers) {
return;
}