@@ -672,7 +672,7 @@ VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size,
void virtio_irq(VirtQueue *vq)
{
trace_virtio_irq(vq);
- vq->vdev->isr |= 0x01;
+ vq->vdev->isr |= VIRTIO_ISR_VQ;
virtio_notify_vector(vq->vdev, vq->vector);
}
@@ -717,7 +717,7 @@ void virtio_notify(VirtIODevice *vdev, VirtQueue *vq)
}
trace_virtio_notify(vdev, vq);
- vdev->isr |= 0x01;
+ vdev->isr |= VIRTIO_ISR_VQ;
virtio_notify_vector(vdev, vq->vector);
}
@@ -726,7 +726,8 @@ void virtio_notify_config(VirtIODevice *vdev)
if (!(vdev->status & VIRTIO_CONFIG_S_DRIVER_OK))
return;
- vdev->isr |= 0x03;
+ /* TODO: why do we set VIRTIO_ISR_VQ here? */
+ vdev->isr |= VIRTIO_ISR_VQ | VIRTIO_ISR_CONFIG;
virtio_notify_vector(vdev, vdev->config_vector);
}
@@ -54,6 +54,11 @@
/* A guest should never accept this. It implies negotiation is broken. */
#define VIRTIO_F_BAD_FEATURE 30
+/* The bit of the ISR which indicates a device vq event. */
+#define VIRTIO_ISR_VQ 0x1
+/* The bit of the ISR which indicates a device configuration change. */
+#define VIRTIO_ISR_CONFIG 0x2
+
/* from Linux's linux/virtio_ring.h */
/* This marks a buffer as continuing via the next field. */
Add constants for ISR bits values, and use them in virtio. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> --- hw/virtio.c | 7 ++++--- hw/virtio.h | 5 +++++ 2 files changed, 9 insertions(+), 3 deletions(-)