kvm_set_ioeventfd_mmio_long is only available with CONFIG_KVM.

Cc: Anthony Liguori <aligu...@us.ibm.com>
Cc: Cam Macdonell <c...@cs.ualberta.ca>
Signed-off-by: Stefan Weil <w...@mail.berlios.de>
---
 hw/ivshmem.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/hw/ivshmem.c b/hw/ivshmem.c
index ec894e9..63562e1 100644
--- a/hw/ivshmem.c
+++ b/hw/ivshmem.c
@@ -385,8 +385,10 @@ static void close_guest_eventfds(IVShmemState *s, int posn)
     guest_curr_max = s->peers[posn].nb_eventfds;
 
     for (i = 0; i < guest_curr_max; i++) {
+#if defined(CONFIG_KVM)
         kvm_set_ioeventfd_mmio_long(s->peers[posn].eventfds[i],
                     s->mmio_addr + DOORBELL, (posn << 16) | i, 0);
+#endif
         close(s->peers[posn].eventfds[i]);
     }
 
@@ -395,7 +397,7 @@ static void close_guest_eventfds(IVShmemState *s, int posn)
 }
 
 static void setup_ioeventfds(IVShmemState *s) {
-
+#if defined(CONFIG_KVM)
     int i, j;
 
     for (i = 0; i <= s->max_peer; i++) {
@@ -404,6 +406,7 @@ static void setup_ioeventfds(IVShmemState *s) {
                     s->mmio_addr + DOORBELL, (i << 16) | j, 1);
         }
     }
+#endif
 }
 
 /* this function increase the dynamic storage need to store data about other
@@ -530,12 +533,14 @@ static void ivshmem_read(void *opaque, const uint8_t * 
buf, int flags)
                    guest_max_eventfd);
     }
 
+#if defined(CONFIG_KVM)
     if (ivshmem_has_feature(s, IVSHMEM_IOEVENTFD)) {
         if (kvm_set_ioeventfd_mmio_long(incoming_fd, s->mmio_addr + DOORBELL,
                         (incoming_posn << 16) | guest_max_eventfd, 1) < 0) {
             fprintf(stderr, "ivshmem: ioeventfd not available\n");
         }
     }
+#endif
 
     return;
 }
-- 
1.7.1


Reply via email to