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

Avi Kivity
2010-09-20T15:06:52Z

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