[PATCH 3/9] msix: move kvm specific msix notify into a function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Avi Kivity <avi@xxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux