[PATCH] qemu-kvm: Clean up kvm_set_irqfd build dependencies

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

 



Moving virtio-pci into the hwlib in upstream broke qemu-kvm due to some
unneeded build dependency on CONFIG_KVM. Stub out kvm_set_irqfd so that
we can build against it unconditionally.

Signed-off-by: Jan Kiszka <jan.kiszka@xxxxxxxxxxx>
---
 hw/virtio-pci.c |    4 ----
 kvm-all.c       |    6 ++++--
 kvm-stub.c      |    5 +++++
 kvm.h           |    8 --------
 4 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index 0422484..d1fc433 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -549,7 +549,6 @@ static void virtio_pci_guest_notifier_read(void *opaque)
 static int virtio_pci_mask_vq(PCIDevice *dev, unsigned vector,
                               VirtQueue *vq, int masked)
 {
-#ifdef CONFIG_KVM
     EventNotifier *notifier = virtio_queue_get_guest_notifier(vq);
     int r = kvm_set_irqfd(dev->msix_irq_entries[vector].gsi,
                           event_notifier_get_fd(notifier),
@@ -565,9 +564,6 @@ static int virtio_pci_mask_vq(PCIDevice *dev, unsigned vector,
                             NULL, NULL, NULL);
     }
     return 0;
-#else
-    return -ENOSYS;
-#endif
 }
 
 static int virtio_pci_mask_notifier(PCIDevice *dev, unsigned vector,
diff --git a/kvm-all.c b/kvm-all.c
index cc2c73d..629f727 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -1429,9 +1429,9 @@ int kvm_set_ioeventfd_pio_word(int fd, uint16_t addr, uint16_t val, bool assign)
 #endif
 }
 
-#if defined(KVM_IRQFD)
 int kvm_set_irqfd(int gsi, int fd, bool assigned)
 {
+#if defined(KVM_IRQFD)
     struct kvm_irqfd irqfd = {
         .fd = fd,
         .gsi = gsi,
@@ -1445,8 +1445,10 @@ int kvm_set_irqfd(int gsi, int fd, bool assigned)
     if (r < 0)
         return r;
     return 0;
-}
+#else
+    return -ENOSYS;
 #endif
+}
 
 int kvm_on_sigbus_vcpu(CPUState *env, int code, void *addr)
 {
diff --git a/kvm-stub.c b/kvm-stub.c
index 90fed66..6f33e59 100644
--- a/kvm-stub.c
+++ b/kvm-stub.c
@@ -196,3 +196,8 @@ int kvm_on_sigbus(int code, void *addr)
 {
     return 1;
 }
+
+int kvm_set_irqfd(int gsi, int fd, bool assigned)
+{
+    return -ENOSYS;
+}
diff --git a/kvm.h b/kvm.h
index 288a452..c2a850e 100644
--- a/kvm.h
+++ b/kvm.h
@@ -196,15 +196,7 @@ int kvm_physical_memory_addr_from_ram(KVMState *s, ram_addr_t ram_addr,
 #endif
 int kvm_set_ioeventfd_mmio_long(int fd, uint32_t adr, uint32_t val, bool assign);
 
-#if defined(KVM_IRQFD) && defined(CONFIG_KVM)
 int kvm_set_irqfd(int gsi, int fd, bool assigned);
-#else
-static inline
-int kvm_set_irqfd(int gsi, int fd, bool assigned)
-{
-    return -ENOSYS;
-}
-#endif
 
 int kvm_set_ioeventfd_pio_word(int fd, uint16_t adr, uint16_t val, bool assign);
 
--
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