Skip to content

Commit a725d56

Browse files
committed
KVM: Introduce CONFIG_HAVE_KVM_IRQ_ROUTING
Quite a bit of code in KVM has been conditionalized on availability of IOAPIC emulation. However, most of it is generically applicable to platforms that don't have an IOPIC, but a different type of irq chip. Make code that only relies on IRQ routing, not an APIC itself, on CONFIG_HAVE_KVM_IRQ_ROUTING, so that we can reuse it later. Signed-off-by: Alexander Graf <agraf@suse.de> Acked-by: Michael S. Tsirkin <mst@redhat.com>
1 parent 8175e5b commit a725d56

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

arch/x86/kvm/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ config KVM
2929
select MMU_NOTIFIER
3030
select ANON_INODES
3131
select HAVE_KVM_IRQCHIP
32+
select HAVE_KVM_IRQ_ROUTING
3233
select HAVE_KVM_EVENTFD
3334
select KVM_APIC_ARCHITECTURE
3435
select KVM_ASYNC_PF

include/linux/kvm_host.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ struct kvm_kernel_irq_routing_entry {
304304
struct hlist_node link;
305305
};
306306

307-
#ifdef __KVM_HAVE_IOAPIC
307+
#ifdef CONFIG_HAVE_KVM_IRQ_ROUTING
308308

309309
struct kvm_irq_routing_table {
310310
int chip[KVM_NR_IRQCHIPS][KVM_IRQCHIP_NUM_PINS];
@@ -432,7 +432,7 @@ void kvm_vcpu_uninit(struct kvm_vcpu *vcpu);
432432
int __must_check vcpu_load(struct kvm_vcpu *vcpu);
433433
void vcpu_put(struct kvm_vcpu *vcpu);
434434

435-
#ifdef __KVM_HAVE_IOAPIC
435+
#ifdef CONFIG_HAVE_KVM_IRQ_ROUTING
436436
int kvm_irqfd_init(void);
437437
void kvm_irqfd_exit(void);
438438
#else
@@ -957,7 +957,7 @@ static inline int mmu_notifier_retry(struct kvm *kvm, unsigned long mmu_seq)
957957
}
958958
#endif
959959

960-
#ifdef KVM_CAP_IRQ_ROUTING
960+
#ifdef CONFIG_HAVE_KVM_IRQ_ROUTING
961961

962962
#define KVM_MAX_IRQ_ROUTES 1024
963963

virt/kvm/Kconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ config HAVE_KVM
66
config HAVE_KVM_IRQCHIP
77
bool
88

9+
config HAVE_KVM_IRQ_ROUTING
10+
bool
11+
912
config HAVE_KVM_EVENTFD
1013
bool
1114
select EVENTFD

virt/kvm/eventfd.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
#include "iodev.h"
3737

38-
#ifdef __KVM_HAVE_IOAPIC
38+
#ifdef CONFIG_HAVE_KVM_IRQ_ROUTING
3939
/*
4040
* --------------------------------------------------------------------
4141
* irqfd: Allows an fd to be used to inject an interrupt to the guest
@@ -433,7 +433,7 @@ kvm_irqfd_assign(struct kvm *kvm, struct kvm_irqfd *args)
433433
void
434434
kvm_eventfd_init(struct kvm *kvm)
435435
{
436-
#ifdef __KVM_HAVE_IOAPIC
436+
#ifdef CONFIG_HAVE_KVM_IRQ_ROUTING
437437
spin_lock_init(&kvm->irqfds.lock);
438438
INIT_LIST_HEAD(&kvm->irqfds.items);
439439
INIT_LIST_HEAD(&kvm->irqfds.resampler_list);
@@ -442,7 +442,7 @@ kvm_eventfd_init(struct kvm *kvm)
442442
INIT_LIST_HEAD(&kvm->ioeventfds);
443443
}
444444

445-
#ifdef __KVM_HAVE_IOAPIC
445+
#ifdef CONFIG_HAVE_KVM_IRQ_ROUTING
446446
/*
447447
* shutdown any irqfd's that match fd+gsi
448448
*/

virt/kvm/kvm_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2404,7 +2404,7 @@ static long kvm_dev_ioctl_check_extension_generic(long arg)
24042404
case KVM_CAP_SIGNAL_MSI:
24052405
#endif
24062406
return 1;
2407-
#ifdef KVM_CAP_IRQ_ROUTING
2407+
#ifdef CONFIG_HAVE_KVM_IRQ_ROUTING
24082408
case KVM_CAP_IRQ_ROUTING:
24092409
return KVM_MAX_IRQ_ROUTES;
24102410
#endif

0 commit comments

Comments
 (0)