2015-01-30 10:03+0100, Paolo Bonzini: > On 29/01/2015 22:48, Radim Krčmář wrote: > > +/* KVM APIC implementation has two quirks > > + * - dest always begins at 0 while xAPIC MDA has offset 24, > > + * - IOxAPIC messages have to be delivered (directly) to x2APIC. > > + */ > > +static u32 > > +kvm_apic_mda(unsigned int dest, struct kvm_lapic *ipi, bool x2apic_dest) > > Please pass two struct kvm_lapic, so that you can write > > bool ipi = source != NULL; > bool x2apic_mda = apic_x2apic_mode(ipi ? source : dest); > > Looks a little nicer to me at least. Definitely. > > +{ > > + bool x2apic_mda = ipi ? apic_x2apic_mode(ipi) : x2apic_dest; > > + > > + if (!ipi && dest == APIC_BROADCAST) > > + dest = X2APIC_BROADCAST; > > This works, but it is not super-clear that you are shifting left by 24 > here, and right in kvm_apic_broadcast(). What if you just make it > > if (!ipi && dest == APIC_BROADCAST && x2apic_mda) > return X2APIC_BROADCAST. It's better, it will be that way in v2 of [5-8/8], thanks. (I was using it twice in earlier iterations and didn't think again.) -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html