Skip to contentSkip to conversation

QEMU: minimal VIRTIO_PCI_ISR_CONFIG support

PATCH New Marcelo Tosatti 1 participant 1 message Jan 9, 2008 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 QEMU: minimal VIRTIO_PCI_ISR_CONFIG support

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

The write callbacks also need to be hooked.

qemu/hw/virtio.c +11 -1
Index: 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,
qemu/hw/virtio.h +2 -0
Index: 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