Skip to content

Commit 3159d36

Browse files
rkrcmarbonzini
authored andcommitted
KVM: x86: use generic function for MSI parsing
Reviewed-by: Paolo Bonzini <[email protected]> Signed-off-by: Radim Krčmář <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 0ca52e7 commit 3159d36

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

arch/x86/kvm/irq_comm.c

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -388,21 +388,16 @@ void kvm_scan_ioapic_routes(struct kvm_vcpu *vcpu,
388388
kvm->arch.nr_reserved_ioapic_pins);
389389
for (i = 0; i < nr_ioapic_pins; ++i) {
390390
hlist_for_each_entry(entry, &table->map[i], link) {
391-
u32 dest_id, dest_mode;
392-
bool level;
391+
struct kvm_lapic_irq irq;
393392

394393
if (entry->type != KVM_IRQ_ROUTING_MSI)
395394
continue;
396-
dest_id = (entry->msi.address_lo >> 12) & 0xff;
397-
dest_mode = (entry->msi.address_lo >> 2) & 0x1;
398-
level = entry->msi.data & MSI_DATA_TRIGGER_LEVEL;
399-
if (level && kvm_apic_match_dest(vcpu, NULL, 0,
400-
dest_id, dest_mode)) {
401-
u32 vector = entry->msi.data & 0xff;
402-
403-
__set_bit(vector,
404-
ioapic_handled_vectors);
405-
}
395+
396+
kvm_set_msi_irq(entry, &irq);
397+
398+
if (irq.level && kvm_apic_match_dest(vcpu, NULL, 0,
399+
irq.dest_id, irq.dest_mode))
400+
__set_bit(irq.vector, ioapic_handled_vectors);
406401
}
407402
}
408403
srcu_read_unlock(&kvm->irq_srcu, idx);

0 commit comments

Comments
 (0)