Skip to content

Commit 8ed26ab

Browse files
committed
KVM: clean up directives to compile out irqfds
Keep all #ifdef CONFIG_HAVE_KVM_IRQCHIP parts of eventfd.c together, and compile out the irqfds field of struct kvm if the symbol is not defined. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent a5d3df8 commit 8ed26ab

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

include/linux/kvm_host.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,13 +782,15 @@ struct kvm {
782782
struct list_head vm_list;
783783
struct mutex lock;
784784
struct kvm_io_bus __rcu *buses[KVM_NR_BUSES];
785+
#ifdef CONFIG_HAVE_KVM_IRQCHIP
785786
struct {
786787
spinlock_t lock;
787788
struct list_head items;
788789
/* resampler_list update side is protected by resampler_lock. */
789790
struct list_head resampler_list;
790791
struct mutex resampler_lock;
791792
} irqfds;
793+
#endif
792794
struct list_head ioeventfds;
793795
struct kvm_vm_stat stat;
794796
struct kvm_arch arch;

virt/kvm/eventfd.c

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -526,21 +526,7 @@ void kvm_unregister_irq_ack_notifier(struct kvm *kvm,
526526
synchronize_srcu(&kvm->irq_srcu);
527527
kvm_arch_post_irq_ack_notifier_list_update(kvm);
528528
}
529-
#endif
530-
531-
void
532-
kvm_eventfd_init(struct kvm *kvm)
533-
{
534-
#ifdef CONFIG_HAVE_KVM_IRQCHIP
535-
spin_lock_init(&kvm->irqfds.lock);
536-
INIT_LIST_HEAD(&kvm->irqfds.items);
537-
INIT_LIST_HEAD(&kvm->irqfds.resampler_list);
538-
mutex_init(&kvm->irqfds.resampler_lock);
539-
#endif
540-
INIT_LIST_HEAD(&kvm->ioeventfds);
541-
}
542529

543-
#ifdef CONFIG_HAVE_KVM_IRQCHIP
544530
/*
545531
* shutdown any irqfd's that match fd+gsi
546532
*/
@@ -1012,3 +998,15 @@ kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args)
1012998

1013999
return kvm_assign_ioeventfd(kvm, args);
10141000
}
1001+
1002+
void
1003+
kvm_eventfd_init(struct kvm *kvm)
1004+
{
1005+
#ifdef CONFIG_HAVE_KVM_IRQCHIP
1006+
spin_lock_init(&kvm->irqfds.lock);
1007+
INIT_LIST_HEAD(&kvm->irqfds.items);
1008+
INIT_LIST_HEAD(&kvm->irqfds.resampler_list);
1009+
mutex_init(&kvm->irqfds.resampler_lock);
1010+
#endif
1011+
INIT_LIST_HEAD(&kvm->ioeventfds);
1012+
}

0 commit comments

Comments
 (0)