Message ID | 20240723163941.48775-3-hreitz@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | virtio: Always reset vhost devices | expand |
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 583a224163..35dfc01074 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -2150,8 +2150,12 @@ void virtio_reset(void *opaque) vdev->device_endian = virtio_default_endian(); } - if (vdev->vhost_started && k->get_vhost) { - vhost_reset_device(k->get_vhost(vdev)); + if (k->get_vhost) { + struct vhost_dev *hdev = k->get_vhost(vdev); + /* Only reset when vhost back-end is connected */ + if (hdev && hdev->vhost_ops) { + vhost_reset_device(hdev); + } } if (k->reset) {