aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Auger <eric.auger@linaro.org>2015-09-18 10:29:43 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2015-10-01 09:06:45 -0400
commit1a02b27035f82091d51ecafcb9ccaac1f31d4eb2 (patch)
tree850ac92a5723e08aca31ea74d58dcd6d6cb33a86
parent166c9775f1f8b8f00ad1db0fa5c8fc74059d965d (diff)
KVM: introduce kvm_arch functions for IRQ bypass
This patch introduces - kvm_arch_irq_bypass_add_producer - kvm_arch_irq_bypass_del_producer - kvm_arch_irq_bypass_stop - kvm_arch_irq_bypass_start They make possible to specialize the KVM IRQ bypass consumer in case CONFIG_KVM_HAVE_IRQ_BYPASS is set. Signed-off-by: Eric Auger <eric.auger@linaro.org> [Add weak implementations of the callbacks. - Feng] Signed-off-by: Feng Wu <feng.wu@intel.com> Reviewed-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--include/linux/kvm_host.h10
-rw-r--r--virt/kvm/Kconfig3
-rw-r--r--virt/kvm/eventfd.c12
3 files changed, 25 insertions, 0 deletions
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index cd0ba2e931e1..b8543b02b7bc 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -24,6 +24,7 @@
24#include <linux/err.h> 24#include <linux/err.h>
25#include <linux/irqflags.h> 25#include <linux/irqflags.h>
26#include <linux/context_tracking.h> 26#include <linux/context_tracking.h>
27#include <linux/irqbypass.h>
27#include <asm/signal.h> 28#include <asm/signal.h>
28 29
29#include <linux/kvm.h> 30#include <linux/kvm.h>
@@ -1163,4 +1164,13 @@ static inline void kvm_vcpu_set_dy_eligible(struct kvm_vcpu *vcpu, bool val)
1163{ 1164{
1164} 1165}
1165#endif /* CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT */ 1166#endif /* CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT */
1167
1168#ifdef CONFIG_HAVE_KVM_IRQ_BYPASS
1169int kvm_arch_irq_bypass_add_producer(struct irq_bypass_consumer *,
1170 struct irq_bypass_producer *);
1171void kvm_arch_irq_bypass_del_producer(struct irq_bypass_consumer *,
1172 struct irq_bypass_producer *);
1173void kvm_arch_irq_bypass_stop(struct irq_bypass_consumer *);
1174void kvm_arch_irq_bypass_start(struct irq_bypass_consumer *);
1175#endif /* CONFIG_HAVE_KVM_IRQ_BYPASS */
1166#endif 1176#endif
diff --git a/virt/kvm/Kconfig b/virt/kvm/Kconfig
index e2c876d5a03b..9f8014dda2cf 100644
--- a/virt/kvm/Kconfig
+++ b/virt/kvm/Kconfig
@@ -47,3 +47,6 @@ config KVM_GENERIC_DIRTYLOG_READ_PROTECT
47config KVM_COMPAT 47config KVM_COMPAT
48 def_bool y 48 def_bool y
49 depends on COMPAT && !S390 49 depends on COMPAT && !S390
50
51config HAVE_KVM_IRQ_BYPASS
52 bool
diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
index 413f5a6b61ba..c4f7abec4261 100644
--- a/virt/kvm/eventfd.c
+++ b/virt/kvm/eventfd.c
@@ -252,6 +252,18 @@ static void irqfd_update(struct kvm *kvm, struct kvm_kernel_irqfd *irqfd)
252 write_seqcount_end(&irqfd->irq_entry_sc); 252 write_seqcount_end(&irqfd->irq_entry_sc);
253} 253}
254 254
255#ifdef CONFIG_HAVE_KVM_IRQ_BYPASS
256void __attribute__((weak)) kvm_arch_irq_bypass_stop(
257 struct irq_bypass_consumer *cons)
258{
259}
260
261void __attribute__((weak)) kvm_arch_irq_bypass_start(
262 struct irq_bypass_consumer *cons)
263{
264}
265#endif
266
255static int 267static int
256kvm_irqfd_assign(struct kvm *kvm, struct kvm_irqfd *args) 268kvm_irqfd_assign(struct kvm *kvm, struct kvm_irqfd *args)
257{ 269{