Skip to content

Commit 459a351

Browse files
sean-jcbonzini
authored andcommitted
KVM: Allow building irqbypass.ko as as module when kvm.ko is a module
Convert HAVE_KVM_IRQ_BYPASS into a tristate so that selecting IRQ_BYPASS_MANAGER follows KVM={m,y}, i.e. doesn't force irqbypass.ko to be built-in. Note, PPC allows building KVM as a module, but selects HAVE_KVM_IRQ_BYPASS from a boolean Kconfig, i.e. KVM PPC unnecessarily forces irqbpass.ko to be built-in. But that flaw is a longstanding PPC specific issue. Fixes: 61df71e ("kvm: move "select IRQ_BYPASS_MANAGER" to common code") Cc: [email protected] Signed-off-by: Sean Christopherson <[email protected]> Message-ID: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 81d480f commit 459a351

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

include/linux/kvm_host.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2382,7 +2382,7 @@ static inline bool kvm_is_visible_memslot(struct kvm_memory_slot *memslot)
23822382
struct kvm_vcpu *kvm_get_running_vcpu(void);
23832383
struct kvm_vcpu * __percpu *kvm_get_running_vcpus(void);
23842384

2385-
#ifdef CONFIG_HAVE_KVM_IRQ_BYPASS
2385+
#if IS_ENABLED(CONFIG_HAVE_KVM_IRQ_BYPASS)
23862386
bool kvm_arch_has_irq_bypass(void);
23872387
int kvm_arch_irq_bypass_add_producer(struct irq_bypass_consumer *,
23882388
struct irq_bypass_producer *);

virt/kvm/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ config KVM_COMPAT
7575
depends on KVM && COMPAT && !(S390 || ARM64 || RISCV)
7676

7777
config HAVE_KVM_IRQ_BYPASS
78-
bool
78+
tristate
7979
select IRQ_BYPASS_MANAGER
8080

8181
config HAVE_KVM_VCPU_ASYNC_IOCTL

virt/kvm/eventfd.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ irqfd_shutdown(struct work_struct *work)
149149
/*
150150
* It is now safe to release the object's resources
151151
*/
152-
#ifdef CONFIG_HAVE_KVM_IRQ_BYPASS
152+
#if IS_ENABLED(CONFIG_HAVE_KVM_IRQ_BYPASS)
153153
irq_bypass_unregister_consumer(&irqfd->consumer);
154154
#endif
155155
eventfd_ctx_put(irqfd->eventfd);
@@ -274,7 +274,7 @@ static void irqfd_update(struct kvm *kvm, struct kvm_kernel_irqfd *irqfd)
274274
write_seqcount_end(&irqfd->irq_entry_sc);
275275
}
276276

277-
#ifdef CONFIG_HAVE_KVM_IRQ_BYPASS
277+
#if IS_ENABLED(CONFIG_HAVE_KVM_IRQ_BYPASS)
278278
void __attribute__((weak)) kvm_arch_irq_bypass_stop(
279279
struct irq_bypass_consumer *cons)
280280
{
@@ -424,7 +424,7 @@ kvm_irqfd_assign(struct kvm *kvm, struct kvm_irqfd *args)
424424
if (events & EPOLLIN)
425425
schedule_work(&irqfd->inject);
426426

427-
#ifdef CONFIG_HAVE_KVM_IRQ_BYPASS
427+
#if IS_ENABLED(CONFIG_HAVE_KVM_IRQ_BYPASS)
428428
if (kvm_arch_has_irq_bypass()) {
429429
irqfd->consumer.token = (void *)irqfd->eventfd;
430430
irqfd->consumer.add_producer = kvm_arch_irq_bypass_add_producer;
@@ -609,14 +609,14 @@ void kvm_irq_routing_update(struct kvm *kvm)
609609
spin_lock_irq(&kvm->irqfds.lock);
610610

611611
list_for_each_entry(irqfd, &kvm->irqfds.items, list) {
612-
#ifdef CONFIG_HAVE_KVM_IRQ_BYPASS
612+
#if IS_ENABLED(CONFIG_HAVE_KVM_IRQ_BYPASS)
613613
/* Under irqfds.lock, so can read irq_entry safely */
614614
struct kvm_kernel_irq_routing_entry old = irqfd->irq_entry;
615615
#endif
616616

617617
irqfd_update(kvm, irqfd);
618618

619-
#ifdef CONFIG_HAVE_KVM_IRQ_BYPASS
619+
#if IS_ENABLED(CONFIG_HAVE_KVM_IRQ_BYPASS)
620620
if (irqfd->producer &&
621621
kvm_arch_irqfd_route_changed(&old, &irqfd->irq_entry)) {
622622
int ret = kvm_arch_update_irqfd_routing(

0 commit comments

Comments
 (0)