From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [PATCH 4/9] KVM: x86: use generic function for MSI parsing Date: Fri, 6 May 2016 22:54:00 +0200 Message-ID: <1462568045-31085-5-git-send-email-rkrcmar@redhat.com> References: <1462568045-31085-1-git-send-email-rkrcmar@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Paolo Bonzini , "Lan, Tianyu" , Igor Mammedov , Jan Kiszka , Peter Xu To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:45885 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758275AbcEFUyb (ORCPT ); Fri, 6 May 2016 16:54:31 -0400 In-Reply-To: <1462568045-31085-1-git-send-email-rkrcmar@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Signed-off-by: Radim Kr=C4=8Dm=C3=A1=C5=99 --- arch/x86/kvm/irq_comm.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/arch/x86/kvm/irq_comm.c b/arch/x86/kvm/irq_comm.c index 54ead79e444b..3d17eee0987b 100644 --- a/arch/x86/kvm/irq_comm.c +++ b/arch/x86/kvm/irq_comm.c @@ -391,21 +391,16 @@ void kvm_scan_ioapic_routes(struct kvm_vcpu *vcpu= , kvm->arch.nr_reserved_ioapic_pins); for (i =3D 0; i < nr_ioapic_pins; ++i) { hlist_for_each_entry(entry, &table->map[i], link) { - u32 dest_id, dest_mode; - bool level; + struct kvm_lapic_irq irq; =20 if (entry->type !=3D KVM_IRQ_ROUTING_MSI) continue; - dest_id =3D (entry->msi.address_lo >> 12) & 0xff; - dest_mode =3D (entry->msi.address_lo >> 2) & 0x1; - level =3D entry->msi.data & MSI_DATA_TRIGGER_LEVEL; - if (level && kvm_apic_match_dest(vcpu, NULL, 0, - dest_id, dest_mode)) { - u32 vector =3D entry->msi.data & 0xff; =20 - __set_bit(vector, - ioapic_handled_vectors); - } + kvm_set_msi_irq(entry, &irq); + + if (irq.level && kvm_apic_match_dest(vcpu, NULL, 0, + irq.dest_id, irq.dest_mode)) + __set_bit(irq.vector, ioapic_handled_vectors); } } srcu_read_unlock(&kvm->irq_srcu, idx); --=20 2.8.2