public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Avi Kivity <avi@redhat.com>, Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm <kvm@vger.kernel.org>, "Michael S. Tsirkin" <mst@redhat.com>,
	Amos Kong <akong@redhat.com>
Subject: [PATCH] qemu-kvm: Clean up kvm_set_irqfd build dependencies
Date: Fri, 10 Jun 2011 10:07:25 +0200	[thread overview]
Message-ID: <4DF1D0BD.2000706@siemens.com> (raw)

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@siemens.com>
---
 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);
 

             reply	other threads:[~2011-06-10  8:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-10  8:07 Jan Kiszka [this message]
2011-06-13  8:55 ` [PATCH] qemu-kvm: Clean up kvm_set_irqfd build dependencies 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=4DF1D0BD.2000706@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=akong@redhat.com \
    --cc=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