From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48437) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btL7P-00059E-8h for qemu-devel@nongnu.org; Sun, 09 Oct 2016 16:54:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1btL7K-0005mq-7v for qemu-devel@nongnu.org; Sun, 09 Oct 2016 16:54:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35372) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btL7K-0005mm-1L for qemu-devel@nongnu.org; Sun, 09 Oct 2016 16:54:42 -0400 Date: Sun, 9 Oct 2016 23:54:40 +0300 From: "Michael S. Tsirkin" Message-ID: <20161009235332-mutt-send-email-mst@kernel.org> 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: Radim =?utf-8?B?S3LEjW3DocWZ?= , qemu-devel@nongnu.org, Igor Mammedov , Paolo Bonzini , Richard Henderson , Eduardo Habkost On Sat, Oct 08, 2016 at 02:37:59PM +0800, Peter Xu wrote: > 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 hav= e > > upper address bits set (remapped x2APIC MSIs). A specialized interfa= ce > > 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 >=20 > And... >=20 > > --- > > 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(APICCommonStat= e *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. >=20 > 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. >=20 > -- peterx I think this is a bug really. Paolo? We really need to start annotating le fields e.g. the way Linux does this, to allow static checks with sparse. --=20 MST