Skip to content

Commit f70c20a

Browse files
Feng Wubonzini
authored andcommitted
KVM: Add an arch specific hooks in 'struct kvm_kernel_irqfd'
This patch adds an arch specific hooks 'arch_update' in 'struct kvm_kernel_irqfd'. On Intel side, it is used to update the IRTE when VT-d posted-interrupts is used. Signed-off-by: Feng Wu <[email protected]> Reviewed-by: Alex Williamson <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 9016cfb commit f70c20a

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

include/linux/kvm_host.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,5 +1172,7 @@ void kvm_arch_irq_bypass_del_producer(struct irq_bypass_consumer *,
11721172
struct irq_bypass_producer *);
11731173
void kvm_arch_irq_bypass_stop(struct irq_bypass_consumer *);
11741174
void kvm_arch_irq_bypass_start(struct irq_bypass_consumer *);
1175+
int kvm_arch_update_irqfd_routing(struct kvm *kvm, unsigned int host_irq,
1176+
uint32_t guest_irq, bool set);
11751177
#endif /* CONFIG_HAVE_KVM_IRQ_BYPASS */
11761178
#endif

virt/kvm/eventfd.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,13 @@ void __attribute__((weak)) kvm_arch_irq_bypass_start(
266266
struct irq_bypass_consumer *cons)
267267
{
268268
}
269+
270+
int __attribute__((weak)) kvm_arch_update_irqfd_routing(
271+
struct kvm *kvm, unsigned int host_irq,
272+
uint32_t guest_irq, bool set)
273+
{
274+
return 0;
275+
}
269276
#endif
270277

271278
static int
@@ -586,9 +593,19 @@ void kvm_irq_routing_update(struct kvm *kvm)
586593

587594
spin_lock_irq(&kvm->irqfds.lock);
588595

589-
list_for_each_entry(irqfd, &kvm->irqfds.items, list)
596+
list_for_each_entry(irqfd, &kvm->irqfds.items, list) {
590597
irqfd_update(kvm, irqfd);
591598

599+
#ifdef CONFIG_HAVE_KVM_IRQ_BYPASS
600+
if (irqfd->producer) {
601+
int ret = kvm_arch_update_irqfd_routing(
602+
irqfd->kvm, irqfd->producer->irq,
603+
irqfd->gsi, 1);
604+
WARN_ON(ret);
605+
}
606+
#endif
607+
}
608+
592609
spin_unlock_irq(&kvm->irqfds.lock);
593610
}
594611

0 commit comments

Comments
 (0)