]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
KVM: Fold kvm_arch_irqfd_route_changed() into kvm_arch_update_irqfd_routing()
authorSean Christopherson <seanjc@google.com>
Wed, 11 Jun 2025 22:45:36 +0000 (15:45 -0700)
committerSean Christopherson <seanjc@google.com>
Mon, 23 Jun 2025 16:50:33 +0000 (09:50 -0700)
Fold kvm_arch_irqfd_route_changed() into kvm_arch_update_irqfd_routing().
Calling arch code to know whether or not to call arch code is absurd.

Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
Link: https://lore.kernel.org/r/20250611224604.313496-35-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/arm64/kvm/arm.c
arch/x86/kvm/irq.c
include/linux/kvm_host.h
virt/kvm/eventfd.c

index 94fb2f096a2067b49cec56e0b518e4f83b2b6563..04f2116927b1e0f8d6def159eabe3d2664c7f353 100644 (file)
@@ -2761,20 +2761,15 @@ void kvm_arch_irq_bypass_del_producer(struct irq_bypass_consumer *cons,
        kvm_vgic_v4_unset_forwarding(irqfd->kvm, prod->irq);
 }
 
-bool kvm_arch_irqfd_route_changed(struct kvm_kernel_irq_routing_entry *old,
-                                 struct kvm_kernel_irq_routing_entry *new)
-{
-       if (old->type != KVM_IRQ_ROUTING_MSI ||
-           new->type != KVM_IRQ_ROUTING_MSI)
-               return true;
-
-       return memcmp(&old->msi, &new->msi, sizeof(new->msi));
-}
-
 void kvm_arch_update_irqfd_routing(struct kvm_kernel_irqfd *irqfd,
                                   struct kvm_kernel_irq_routing_entry *old,
                                   struct kvm_kernel_irq_routing_entry *new)
 {
+       if (old->type == KVM_IRQ_ROUTING_MSI &&
+           new->type == KVM_IRQ_ROUTING_MSI &&
+           !memcmp(&old->msi, &new->msi, sizeof(new->msi)))
+               return;
+
        /*
         * Remapping the vLPI requires taking the its_lock mutex to resolve
         * the new translation. We're in spinlock land at this point, so no
index b7b0fbc218b82f5b0267937653b37ac6d54a037b..23e0acc07cb68f988a8823f08bdaa519c2c824fe 100644 (file)
@@ -610,17 +610,12 @@ void kvm_arch_update_irqfd_routing(struct kvm_kernel_irqfd *irqfd,
                                   struct kvm_kernel_irq_routing_entry *old,
                                   struct kvm_kernel_irq_routing_entry *new)
 {
-       kvm_pi_update_irte(irqfd, new);
-}
-
-bool kvm_arch_irqfd_route_changed(struct kvm_kernel_irq_routing_entry *old,
-                                 struct kvm_kernel_irq_routing_entry *new)
-{
-       if (old->type != KVM_IRQ_ROUTING_MSI ||
-           new->type != KVM_IRQ_ROUTING_MSI)
-               return true;
+       if (old->type == KVM_IRQ_ROUTING_MSI &&
+           new->type == KVM_IRQ_ROUTING_MSI &&
+           !memcmp(&old->msi, &new->msi, sizeof(new->msi)))
+               return;
 
-       return !!memcmp(&old->msi, &new->msi, sizeof(new->msi));
+       kvm_pi_update_irte(irqfd, new);
 }
 
 #ifdef CONFIG_KVM_IOAPIC
index 8e74ac0f90b160d8060b1c7288acc0773724c11e..fb9ec06aa807acdefe536f7db0d788976a0c6071 100644 (file)
@@ -2413,8 +2413,6 @@ void kvm_arch_irq_bypass_start(struct irq_bypass_consumer *);
 void kvm_arch_update_irqfd_routing(struct kvm_kernel_irqfd *irqfd,
                                   struct kvm_kernel_irq_routing_entry *old,
                                   struct kvm_kernel_irq_routing_entry *new);
-bool kvm_arch_irqfd_route_changed(struct kvm_kernel_irq_routing_entry *,
-                                 struct kvm_kernel_irq_routing_entry *);
 #endif /* CONFIG_HAVE_KVM_IRQ_BYPASS */
 
 #ifdef CONFIG_HAVE_KVM_INVALID_WAKEUPS
index 719b242fc9358734842ddd1f98e8e142da884315..59b1e64697f15f567dbad8970c7c49da0c9cc5d8 100644 (file)
@@ -291,13 +291,6 @@ void __weak kvm_arch_update_irqfd_routing(struct kvm_kernel_irqfd *irqfd,
 {
 
 }
-
-bool __attribute__((weak)) kvm_arch_irqfd_route_changed(
-                               struct kvm_kernel_irq_routing_entry *old,
-                               struct kvm_kernel_irq_routing_entry *new)
-{
-       return true;
-}
 #endif
 
 static int
@@ -616,8 +609,7 @@ void kvm_irq_routing_update(struct kvm *kvm)
                irqfd_update(kvm, irqfd);
 
 #if IS_ENABLED(CONFIG_HAVE_KVM_IRQ_BYPASS)
-               if (irqfd->producer &&
-                   kvm_arch_irqfd_route_changed(&old, &irqfd->irq_entry))
+               if (irqfd->producer)
                        kvm_arch_update_irqfd_routing(irqfd, &old, &irqfd->irq_entry);
 #endif
        }