Re: [PATCH] KVM: LAPIC: ARBPRI is a reserved register for x2APIC

From: Paolo Bonzini
Date: Fri Jul 05 2019 - 08:46:15 EST


On 05/07/19 14:37, Liran Alon wrote:
>> + u64 rmask = 0x43ff01ffffffe70cULL;
> Why not rename this to âused_bits_maskâ and calculate it properly by macros?
> It seems a lot nicer than having a pre-calculated magic.

Yes, I wanted to do the same but I didn't have time right now. I am
planning to cleanup after the merge window, but if a patch comes soon I
can apply it instead of course. :)

Something like

#define APIC_VALID_REG_MASK(reg) (1ull << ((reg) >> 4))
#define APIC_VALID_REGS_MASK(first, count) \
(APIC_VALID_REG_MASK(first) * (1ull << ((count) - 1)))

followed by

if (offset > 0x3f0 ||
!(valid_regs_mask & APIC_VALID_REG_MASK(offset))

Paolo

> -Liran
>