aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2012-10-08 18:22:59 -0400
committerAlexander Graf <agraf@suse.de>2012-12-05 19:33:49 -0500
commit914daba865cb5c38cd5fdee024ca38029315b38f (patch)
tree5d0906d4fd82da801fb230256fc6bb1abb25bd0a
parent45e3cc7d9fe69844cd12d51c511e1e98d156bbe1 (diff)
KVM: Distangle eventfd code from irqchip
The current eventfd code assumes that when we have eventfd, we also have irqfd for in-kernel interrupt delivery. This is not necessarily true. On PPC we don't have an in-kernel irqchip yet, but we can still support easily support eventfd. Signed-off-by: Alexander Graf <agraf@suse.de>
-rw-r--r--include/linux/kvm_host.h12
-rw-r--r--virt/kvm/eventfd.c6
2 files changed, 17 insertions, 1 deletions
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 8e5c7b65165..c823e47c364 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -900,10 +900,20 @@ static inline void kvm_free_irq_routing(struct kvm *kvm) {}
900#ifdef CONFIG_HAVE_KVM_EVENTFD 900#ifdef CONFIG_HAVE_KVM_EVENTFD
901 901
902void kvm_eventfd_init(struct kvm *kvm); 902void kvm_eventfd_init(struct kvm *kvm);
903int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args);
904
905#ifdef CONFIG_HAVE_KVM_IRQCHIP
903int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args); 906int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args);
904void kvm_irqfd_release(struct kvm *kvm); 907void kvm_irqfd_release(struct kvm *kvm);
905void kvm_irq_routing_update(struct kvm *, struct kvm_irq_routing_table *); 908void kvm_irq_routing_update(struct kvm *, struct kvm_irq_routing_table *);
906int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args); 909#else
910static inline int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args)
911{
912 return -EINVAL;
913}
914
915static inline void kvm_irqfd_release(struct kvm *kvm) {}
916#endif
907 917
908#else 918#else
909 919
diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
index 9718e98d6d2..d7424c8c138 100644
--- a/virt/kvm/eventfd.c
+++ b/virt/kvm/eventfd.c
@@ -35,6 +35,7 @@
35 35
36#include "iodev.h" 36#include "iodev.h"
37 37
38#ifdef __KVM_HAVE_IOAPIC
38/* 39/*
39 * -------------------------------------------------------------------- 40 * --------------------------------------------------------------------
40 * irqfd: Allows an fd to be used to inject an interrupt to the guest 41 * irqfd: Allows an fd to be used to inject an interrupt to the guest
@@ -425,17 +426,21 @@ fail:
425 kfree(irqfd); 426 kfree(irqfd);
426 return ret; 427 return ret;
427} 428}
429#endif
428 430
429void 431void
430kvm_eventfd_init(struct kvm *kvm) 432kvm_eventfd_init(struct kvm *kvm)
431{ 433{
434#ifdef __KVM_HAVE_IOAPIC
432 spin_lock_init(&kvm->irqfds.lock); 435 spin_lock_init(&kvm->irqfds.lock);
433 INIT_LIST_HEAD(&kvm->irqfds.items); 436 INIT_LIST_HEAD(&kvm->irqfds.items);
434 INIT_LIST_HEAD(&kvm->irqfds.resampler_list); 437 INIT_LIST_HEAD(&kvm->irqfds.resampler_list);
435 mutex_init(&kvm->irqfds.resampler_lock); 438 mutex_init(&kvm->irqfds.resampler_lock);
439#endif
436 INIT_LIST_HEAD(&kvm->ioeventfds); 440 INIT_LIST_HEAD(&kvm->ioeventfds);
437} 441}
438 442
443#ifdef __KVM_HAVE_IOAPIC
439/* 444/*
440 * shutdown any irqfd's that match fd+gsi 445 * shutdown any irqfd's that match fd+gsi
441 */ 446 */
@@ -555,6 +560,7 @@ static void __exit irqfd_module_exit(void)
555 560
556module_init(irqfd_module_init); 561module_init(irqfd_module_init);
557module_exit(irqfd_module_exit); 562module_exit(irqfd_module_exit);
563#endif
558 564
559/* 565/*
560 * -------------------------------------------------------------------- 566 * --------------------------------------------------------------------