virtio/vsock: Remove redundant state tracking
The core already tells us whether a device is being started or stopped.
Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
Link: https://lore.kernel.org/r/20220607170239.120084-4-jean-philippe.brucker@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
diff --git a/virtio/vsock.c b/virtio/vsock.c
index 64b4e95..780169b 100644
--- a/virtio/vsock.c
+++ b/virtio/vsock.c
@@ -31,7 +31,6 @@
struct virtio_device vdev;
struct list_head list;
struct kvm *kvm;
- bool started;
};
static u8 *get_config(struct kvm *kvm, void *dev)
@@ -140,15 +139,16 @@
struct vsock_dev *vdev = dev;
int r, start;
- start = !!(status & VIRTIO_CONFIG_S_DRIVER_OK);
- if (vdev->started == start)
+ if (status & VIRTIO__STATUS_START)
+ start = 1;
+ else if (status & VIRTIO__STATUS_STOP)
+ start = 0;
+ else
return;
r = ioctl(vdev->vhost_fd, VHOST_VSOCK_SET_RUNNING, &start);
if (r != 0)
die("VHOST_VSOCK_SET_RUNNING failed %d", errno);
-
- vdev->started = start;
}
static int notify_vq(struct kvm *kvm, void *dev, u32 vq)