public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>,
	kvm@vger.kernel.org, "Michael S. Tsirkin" <mst@redhat.com>
Subject: [PATCH 3/9] msix: move kvm specific msix notify into a function
Date: Mon, 20 Sep 2010 17:06:44 +0200	[thread overview]
Message-ID: <1284995210-32432-4-git-send-email-avi@redhat.com> (raw)
In-Reply-To: <1284995210-32432-1-git-send-email-avi@redhat.com>

Signed-off-by: Avi Kivity <avi@redhat.com>
---
 hw/msix.c |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/hw/msix.c b/hw/msix.c
index 2e2ce5a..d762870 100644
--- a/hw/msix.c
+++ b/hw/msix.c
@@ -159,6 +159,18 @@ static void kvm_msix_del(PCIDevice *dev, unsigned vector)
     kvm_del_routing_entry(kvm_context, &dev->msix_irq_entries[vector]);
     kvm_commit_irq_routes(kvm_context);
 }
+
+static bool kvm_msix_notify(PCIDevice *dev, unsigned vector)
+{
+#ifdef KVM_CAP_IRQCHIP
+    if (kvm_enabled() && kvm_irqchip_in_kernel()) {
+        kvm_set_irq(dev->msix_irq_entries[vector].gsi, 1, NULL);
+        return true;
+    }
+#endif
+    return false;
+}
+
 #else
 
 static void kvm_msix_init(PCIDevice *dev) {}
@@ -167,6 +179,8 @@ static void kvm_msix_update(PCIDevice *dev, int vector,
                             int was_masked, int is_masked) {}
 static int kvm_msix_add(PCIDevice *dev, unsigned vector) { return -1; }
 static void kvm_msix_del(PCIDevice *dev, unsigned vector) {}
+static bool kvm_msix_notify(PCIDevice *dev, unsigned vector) { return false; }
+
 #endif
 
 /* Add MSI-X capability to the config space for the device. */
@@ -525,12 +539,9 @@ void msix_notify(PCIDevice *dev, unsigned vector)
         return;
     }
 
-#ifdef KVM_CAP_IRQCHIP
-    if (kvm_enabled() && kvm_irqchip_in_kernel()) {
-        kvm_set_irq(dev->msix_irq_entries[vector].gsi, 1, NULL);
+    if (kvm_msix_notify(dev, vector)) {
         return;
     }
-#endif
 
     address = pci_get_long(table_entry + MSIX_MSG_UPPER_ADDR);
     address = (address << 32) | pci_get_long(table_entry + MSIX_MSG_ADDR);
-- 
1.7.2.3


  parent reply	other threads:[~2010-09-20 15:06 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-20 15:06 [PATCH 0/9] msix/kvm integration cleanups Avi Kivity
2010-09-20 15:06 ` [PATCH 1/9] msix: avoid leaking kvm data on init failure Avi Kivity
2010-09-20 15:06 ` [PATCH 2/9] msix: make kvm specific initialization a function Avi Kivity
2010-09-20 15:06 ` Avi Kivity [this message]
2010-09-20 15:06 ` [PATCH 4/9] msix: move definitions from msix.c to msix.h Avi Kivity
2010-09-20 16:56   ` Michael S. Tsirkin
2010-09-21 16:03     ` Avi Kivity
2010-09-20 15:06 ` [PATCH 5/9] Add missing #include to hw/irq.h Avi Kivity
2010-09-20 15:06 ` [PATCH 6/9] msix: move kvm support functions to kvm-all.c and kvm-stub.c Avi Kivity
2010-09-20 15:06 ` [PATCH 7/9] msix: Move kvm_enabled() guards to kvm-all.c functions Avi Kivity
2010-09-20 15:06 ` [PATCH 8/9] Protect qemu-kvm.h declarations with NEED_CPU_H Avi Kivity
2010-09-20 17:05   ` Michael S. Tsirkin
2010-09-21 16:03     ` Avi Kivity
2010-09-20 15:06 ` [PATCH 9/9] Move msix.o build back to Makefile.objs Avi Kivity
2010-09-20 17:02 ` [PATCH 0/9] msix/kvm integration cleanups Michael S. Tsirkin
2010-09-21 16:05   ` Avi Kivity
2010-09-21 16:14     ` Michael S. Tsirkin
2010-10-06  9:39     ` Michael S. Tsirkin
2010-10-06  9:50       ` Avi Kivity

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=1284995210-32432-4-git-send-email-avi@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    /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