public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] QEMU: minimal VIRTIO_PCI_ISR_CONFIG support
@ 2008-01-09 18:21 Marcelo Tosatti
  0 siblings, 0 replies; only message in thread
From: Marcelo Tosatti @ 2008-01-09 18:21 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: kvm-devel


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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-01-09 18:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-09 18:21 [PATCH] QEMU: minimal VIRTIO_PCI_ISR_CONFIG support Marcelo Tosatti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox