]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
KVM: x86: Isolate edge vs. level check in userspace I/O APIC route scanning
authorSean Christopherson <seanjc@google.com>
Tue, 4 Mar 2025 01:33:33 +0000 (17:33 -0800)
committerSean Christopherson <seanjc@google.com>
Thu, 24 Apr 2025 18:18:35 +0000 (11:18 -0700)
Extract and isolate the trigger mode check in kvm_scan_ioapic_routes() in
anticipation of moving destination matching logic to a common helper (for
userspace vs. in-kernel I/O APIC emulation).

No functional change intended.

Reviewed-by: Kai Huang <kai.huang@intel.com>
Link: https://lore.kernel.org/r/20250304013335.4155703-2-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/irq_comm.c

index 8136695f7b96b5142d0c8173a83e4d4eb3aa860b..866f84392797ba21ca5c81cc98e7da48f3986539 100644 (file)
@@ -424,10 +424,12 @@ void kvm_scan_ioapic_routes(struct kvm_vcpu *vcpu,
 
                        kvm_set_msi_irq(vcpu->kvm, entry, &irq);
 
-                       if (irq.trig_mode &&
-                           (kvm_apic_match_dest(vcpu, NULL, APIC_DEST_NOSHORT,
-                                                irq.dest_id, irq.dest_mode) ||
-                            kvm_apic_pending_eoi(vcpu, irq.vector)))
+                       if (!irq.trig_mode)
+                               continue;
+
+                       if (kvm_apic_match_dest(vcpu, NULL, APIC_DEST_NOSHORT,
+                                               irq.dest_id, irq.dest_mode) ||
+                            kvm_apic_pending_eoi(vcpu, irq.vector))
                                __set_bit(irq.vector, ioapic_handled_vectors);
                }
        }