From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: [PATCH] QEMU: minimal VIRTIO_PCI_ISR_CONFIG support Date: Wed, 9 Jan 2008 16:21:26 -0200 Message-ID: <20080109182126.GC303@dmt> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel To: Anthony Liguori Return-path: Content-Disposition: inline List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org 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