Skip to content

Commit 1a02b27

Browse files
Eric Augerbonzini
authored andcommitted
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 <[email protected]> [Add weak implementations of the callbacks. - Feng] Signed-off-by: Feng Wu <[email protected]> Reviewed-by: Alex Williamson <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 166c977 commit 1a02b27

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

include/linux/kvm_host.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <linux/err.h>
2525
#include <linux/irqflags.h>
2626
#include <linux/context_tracking.h>
27+
#include <linux/irqbypass.h>
2728
#include <asm/signal.h>
2829

2930
#include <linux/kvm.h>
@@ -1163,4 +1164,13 @@ static inline void kvm_vcpu_set_dy_eligible(struct kvm_vcpu *vcpu, bool val)
11631164
{
11641165
}
11651166
#endif /* CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT */
1167+
1168+
#ifdef CONFIG_HAVE_KVM_IRQ_BYPASS
1169+
int kvm_arch_irq_bypass_add_producer(struct irq_bypass_consumer *,
1170+
struct irq_bypass_producer *);
1171+
void kvm_arch_irq_bypass_del_producer(struct irq_bypass_consumer *,
1172+
struct irq_bypass_producer *);
1173+
void kvm_arch_irq_bypass_stop(struct irq_bypass_consumer *);
1174+
void kvm_arch_irq_bypass_start(struct irq_bypass_consumer *);
1175+
#endif /* CONFIG_HAVE_KVM_IRQ_BYPASS */
11661176
#endif

virt/kvm/Kconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,6 @@ config KVM_GENERIC_DIRTYLOG_READ_PROTECT
4747
config KVM_COMPAT
4848
def_bool y
4949
depends on COMPAT && !S390
50+
51+
config HAVE_KVM_IRQ_BYPASS
52+
bool

virt/kvm/eventfd.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,18 @@ static void irqfd_update(struct kvm *kvm, struct kvm_kernel_irqfd *irqfd)
252252
write_seqcount_end(&irqfd->irq_entry_sc);
253253
}
254254

255+
#ifdef CONFIG_HAVE_KVM_IRQ_BYPASS
256+
void __attribute__((weak)) kvm_arch_irq_bypass_stop(
257+
struct irq_bypass_consumer *cons)
258+
{
259+
}
260+
261+
void __attribute__((weak)) kvm_arch_irq_bypass_start(
262+
struct irq_bypass_consumer *cons)
263+
{
264+
}
265+
#endif
266+
255267
static int
256268
kvm_irqfd_assign(struct kvm *kvm, struct kvm_irqfd *args)
257269
{

0 commit comments

Comments
 (0)