Following patch adds virtio_update_config() wrapper to trigger an IRQ on
config space updates.

The write callbacks also need to be hooked.


Index: kvm-userspace/qemu/hw/virtio.c
===================================================================
--- kvm-userspace.orig/qemu/hw/virtio.c
+++ kvm-userspace/qemu/hw/virtio.c
@@ -155,7 +156,9 @@ static VirtIODevice *to_virtio_device(PC
 
 static void virtio_update_irq(VirtIODevice *vdev)
 {
-    qemu_set_irq(vdev->pci_dev.irq[0], vdev->isr & 1);
+    int level = vdev->isr ? 1 : 0;
+
+    qemu_set_irq(vdev->pci_dev.irq[0], level);
 }
 
 void virtio_reset(void *opaque)
@@ -387,6 +390,14 @@ void virtio_notify(VirtIODevice *vdev, V
     virtio_update_irq(vdev);
 }
 
+void virtio_update_config(VirtIODevice *vdev)
+{
+    vdev->update_config(vdev, vdev->config);
+
+    vdev->isr = VIRTIO_PCI_ISR_CONFIG;
+    virtio_update_irq(vdev);
+}
+
 VirtIODevice *virtio_init_pci(PCIBus *bus, const char *name,
                              uint16_t vendor, uint16_t device,
                              uint16_t subvendor, uint16_t subdevice,
Index: kvm-userspace/qemu/hw/virtio.h
===================================================================
--- kvm-userspace.orig/qemu/hw/virtio.h
+++ kvm-userspace/qemu/hw/virtio.h
@@ -140,4 +140,6 @@ int virtqueue_pop(VirtQueue *vq, VirtQue
 
 void virtio_notify(VirtIODevice *vdev, VirtQueue *vq);
 
+void virtio_update_config(VirtIODevice *vdev);
+
 #endif

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to