Skip to content

Commit fae0a87

Browse files
sean-jcgregkh
authored andcommitted
KVM: Allow building irqbypass.ko as as module when kvm.ko is a module
commit 459a351 upstream. 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]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 3bc2208 commit fae0a87

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
@@ -2330,7 +2330,7 @@ static inline bool kvm_is_visible_memslot(struct kvm_memory_slot *memslot)
23302330
struct kvm_vcpu *kvm_get_running_vcpu(void);
23312331
struct kvm_vcpu * __percpu *kvm_get_running_vcpus(void);
23322332

2333-
#ifdef CONFIG_HAVE_KVM_IRQ_BYPASS
2333+
#if IS_ENABLED(CONFIG_HAVE_KVM_IRQ_BYPASS)
23342334
bool kvm_arch_has_irq_bypass(void);
23352335
int kvm_arch_irq_bypass_add_producer(struct irq_bypass_consumer *,
23362336
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
{
@@ -425,7 +425,7 @@ kvm_irqfd_assign(struct kvm *kvm, struct kvm_irqfd *args)
425425
if (events & EPOLLIN)
426426
schedule_work(&irqfd->inject);
427427

428-
#ifdef CONFIG_HAVE_KVM_IRQ_BYPASS
428+
#if IS_ENABLED(CONFIG_HAVE_KVM_IRQ_BYPASS)
429429
if (kvm_arch_has_irq_bypass()) {
430430
irqfd->consumer.token = (void *)irqfd->eventfd;
431431
irqfd->consumer.add_producer = kvm_arch_irq_bypass_add_producer;
@@ -618,14 +618,14 @@ void kvm_irq_routing_update(struct kvm *kvm)
618618
spin_lock_irq(&kvm->irqfds.lock);
619619

620620
list_for_each_entry(irqfd, &kvm->irqfds.items, list) {
621-
#ifdef CONFIG_HAVE_KVM_IRQ_BYPASS
621+
#if IS_ENABLED(CONFIG_HAVE_KVM_IRQ_BYPASS)
622622
/* Under irqfds.lock, so can read irq_entry safely */
623623
struct kvm_kernel_irq_routing_entry old = irqfd->irq_entry;
624624
#endif
625625

626626
irqfd_update(kvm, irqfd);
627627

628-
#ifdef CONFIG_HAVE_KVM_IRQ_BYPASS
628+
#if IS_ENABLED(CONFIG_HAVE_KVM_IRQ_BYPASS)
629629
if (irqfd->producer &&
630630
kvm_arch_irqfd_route_changed(&old, &irqfd->irq_entry)) {
631631
int ret = kvm_arch_update_irqfd_routing(

0 commit comments

Comments
 (0)