lkml.org 
[lkml]   [2015]   [Jan]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 5/8] KVM: x86: use MDA for interrupt matching
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.)


\
 
 \ /
  Last update: 2015-01-30 14:21    [W:0.061 / U:0.424 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site