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>
This commit is contained in:
parent
45e3cc7d9f
commit
914daba865
@ -900,10 +900,20 @@ static inline void kvm_free_irq_routing(struct kvm *kvm) {}
|
|||||||
#ifdef CONFIG_HAVE_KVM_EVENTFD
|
#ifdef CONFIG_HAVE_KVM_EVENTFD
|
||||||
|
|
||||||
void kvm_eventfd_init(struct kvm *kvm);
|
void kvm_eventfd_init(struct kvm *kvm);
|
||||||
|
int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args);
|
||||||
|
|
||||||
|
#ifdef CONFIG_HAVE_KVM_IRQCHIP
|
||||||
int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args);
|
int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args);
|
||||||
void kvm_irqfd_release(struct kvm *kvm);
|
void kvm_irqfd_release(struct kvm *kvm);
|
||||||
void kvm_irq_routing_update(struct kvm *, struct kvm_irq_routing_table *);
|
void kvm_irq_routing_update(struct kvm *, struct kvm_irq_routing_table *);
|
||||||
int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args);
|
#else
|
||||||
|
static inline int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args)
|
||||||
|
{
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void kvm_irqfd_release(struct kvm *kvm) {}
|
||||||
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
#include "iodev.h"
|
#include "iodev.h"
|
||||||
|
|
||||||
|
#ifdef __KVM_HAVE_IOAPIC
|
||||||
/*
|
/*
|
||||||
* --------------------------------------------------------------------
|
* --------------------------------------------------------------------
|
||||||
* irqfd: Allows an fd to be used to inject an interrupt to the guest
|
* irqfd: Allows an fd to be used to inject an interrupt to the guest
|
||||||
@ -425,17 +426,21 @@ kvm_irqfd_assign(struct kvm *kvm, struct kvm_irqfd *args)
|
|||||||
kfree(irqfd);
|
kfree(irqfd);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
kvm_eventfd_init(struct kvm *kvm)
|
kvm_eventfd_init(struct kvm *kvm)
|
||||||
{
|
{
|
||||||
|
#ifdef __KVM_HAVE_IOAPIC
|
||||||
spin_lock_init(&kvm->irqfds.lock);
|
spin_lock_init(&kvm->irqfds.lock);
|
||||||
INIT_LIST_HEAD(&kvm->irqfds.items);
|
INIT_LIST_HEAD(&kvm->irqfds.items);
|
||||||
INIT_LIST_HEAD(&kvm->irqfds.resampler_list);
|
INIT_LIST_HEAD(&kvm->irqfds.resampler_list);
|
||||||
mutex_init(&kvm->irqfds.resampler_lock);
|
mutex_init(&kvm->irqfds.resampler_lock);
|
||||||
|
#endif
|
||||||
INIT_LIST_HEAD(&kvm->ioeventfds);
|
INIT_LIST_HEAD(&kvm->ioeventfds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __KVM_HAVE_IOAPIC
|
||||||
/*
|
/*
|
||||||
* shutdown any irqfd's that match fd+gsi
|
* shutdown any irqfd's that match fd+gsi
|
||||||
*/
|
*/
|
||||||
@ -555,6 +560,7 @@ static void __exit irqfd_module_exit(void)
|
|||||||
|
|
||||||
module_init(irqfd_module_init);
|
module_init(irqfd_module_init);
|
||||||
module_exit(irqfd_module_exit);
|
module_exit(irqfd_module_exit);
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* --------------------------------------------------------------------
|
* --------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user