[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 2/8] apic: add send_msi() to APICCommonClass
From: |
Michael S. Tsirkin |
Subject: |
Re: [Qemu-devel] [PATCH v4 2/8] apic: add send_msi() to APICCommonClass |
Date: |
Sun, 9 Oct 2016 23:54:40 +0300 |
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čmář wrote:
> > The MMIO based interface to APIC doesn't work well with MSIs that have
> > upper address bits set (remapped x2APIC MSIs). A specialized interface
> > is a quick and dirty way to avoid the shortcoming.
> >
> > Reviewed-by: Igor Mammedov <address@hidden>
> > Signed-off-by: Radim Krčmář <address@hidden>
>
> Reviewed-by: Peter Xu <address@hidden>
>
> And...
>
> > ---
> > 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(-)
> >
> > 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);
> > }
> >
> > +static void kvm_send_msi(MSIMessage *msg)
> > +{
> > + int ret;
> > +
> > + ret = kvm_irqchip_send_msi(kvm_state, *msg);
> > + if (ret < 0) {
> > + fprintf(stderr, "KVM: injection failed, MSI lost (%s)\n",
> > + strerror(-ret));
>
> Maybe use error_report() better? A nit not sufficient for a new spin
> though.
>
> 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.
>
> -- 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.
--
MST