From: Sean Christopherson Date: Tue, 4 Mar 2025 01:33:33 +0000 (-0800) Subject: KVM: x86: Isolate edge vs. level check in userspace I/O APIC route scanning X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=b1f7723a5a5b018f4bc3fb8e234510be7c44ad00;p=users%2Fdwmw2%2Flinux.git KVM: x86: Isolate edge vs. level check in userspace I/O APIC route scanning 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 Link: https://lore.kernel.org/r/20250304013335.4155703-2-seanjc@google.com Signed-off-by: Sean Christopherson --- diff --git a/arch/x86/kvm/irq_comm.c b/arch/x86/kvm/irq_comm.c index 8136695f7b96b..866f84392797b 100644 --- a/arch/x86/kvm/irq_comm.c +++ b/arch/x86/kvm/irq_comm.c @@ -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); } }