2016-10-08 14:37+0800, Peter Xu: > 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 <imamm...@redhat.com> >> Signed-off-by: Radim Krčmář <rkrc...@redhat.com> > > Reviewed-by: Peter Xu <pet...@redhat.com>
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(-) >> >> 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. 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 ...