From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60930) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btajt-0005w3-OZ for qemu-devel@nongnu.org; Mon, 10 Oct 2016 09:35:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1btajq-00059d-8J for qemu-devel@nongnu.org; Mon, 10 Oct 2016 09:35:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54816) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btajq-000598-2M for qemu-devel@nongnu.org; Mon, 10 Oct 2016 09:35:30 -0400 Date: Mon, 10 Oct 2016 15:35:26 +0200 From: Radim =?utf-8?B?S3LEjW3DocWZ?= Message-ID: <20161010133525.GA30525@potion> References: <20161005130657.3399-1-rkrcmar@redhat.com> <20161005130657.3399-3-rkrcmar@redhat.com> <20161008063759.GF3666@pxdev.xzpeter.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20161008063759.GF3666@pxdev.xzpeter.org> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v4 2/8] apic: add send_msi() to APICCommonClass List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Xu Cc: qemu-devel@nongnu.org, Igor Mammedov , Paolo Bonzini , Richard Henderson , Eduardo Habkost , "Michael S. Tsirkin" 2016-10-08 14:37+0800, Peter Xu: > On Wed, Oct 05, 2016 at 03:06:51PM +0200, Radim Kr=C4=8Dm=C3=A1=C5=99 w= rote: >> The MMIO based interface to APIC doesn't work well with MSIs that have >> upper address bits set (remapped x2APIC MSIs). A specialized interfac= e >> is a quick and dirty way to avoid the shortcoming. >>=20 >> Reviewed-by: Igor Mammedov >> Signed-off-by: Radim Kr=C4=8Dm=C3=A1=C5=99 >=20 > Reviewed-by: Peter Xu Thanks. >> --- >> v4: r-b Igor >> v2: change apic_send_msi() to accept MSIMessage [Igor] >> --- >> hw/i386/kvm/apic.c | 19 +++++++++++++------ >> hw/i386/xen/xen_apic.c | 6 ++++++ >> hw/intc/apic.c | 8 ++++++-- >> include/hw/i386/apic_internal.h | 4 ++++ >> 4 files changed, 29 insertions(+), 8 deletions(-) >>=20 >> diff --git a/hw/i386/kvm/apic.c b/hw/i386/kvm/apic.c >> index c016e63fc2ba..be55102c00ca 100644 >> --- a/hw/i386/kvm/apic.c >> +++ b/hw/i386/kvm/apic.c >> @@ -169,6 +169,17 @@ static void kvm_apic_external_nmi(APICCommonState= *s) >> run_on_cpu(CPU(s->cpu), do_inject_external_nmi, s); >> } >> =20 >> +static void kvm_send_msi(MSIMessage *msg) >> +{ >> + int ret; >> + >> + ret =3D kvm_irqchip_send_msi(kvm_state, *msg); >> + if (ret < 0) { >> + fprintf(stderr, "KVM: injection failed, MSI lost (%s)\n", >> + strerror(-ret)); >=20 > Maybe use error_report() better? A nit not sufficient for a new spin > though. Yes, but it is a separate logical change, so I'd do that in a separate cleaup patch that amends it in the whole file ... (And I prefer to copy-paste code verbatim.) > And, this patch is assuming MSIMessage as host endianess (which is > good to me). Not sure whether we need fixes for the whole MSIMessage > cleanup (after all, kvm_irqchip_send_msi() is taking it as LE). Or we > can do it afterwards since it won't break anything AFAIU. This patch doesn't affect existing callers, and IR known to be broken, so I think we can sort endianess out later ...