public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <marcelo-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org>
To: Anthony Liguori <aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Cc: kvm-devel <kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Subject: [PATCH] QEMU: minimal VIRTIO_PCI_ISR_CONFIG support
Date: Wed, 9 Jan 2008 16:21:26 -0200	[thread overview]
Message-ID: <20080109182126.GC303@dmt> (raw)


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

                 reply	other threads:[~2008-01-09 18:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080109182126.GC303@dmt \
    --to=marcelo-bw31mazkks3ytjvyw6ydsg@public.gmane.org \
    --cc=aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox