Skip to content

Commit

Permalink
KVM: LAPIC: ARBPRI is a reserved register for x2APIC
Browse files Browse the repository at this point in the history
kvm-unit-tests were adjusted to match bare metal behavior, but KVM
itself was not doing what bare metal does; fix that.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
Paolo Bonzini committed Jul 5, 2019
1 parent 1ef23e1 commit 101628d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion arch/x86/kvm/lapic.c
Original file line number Diff line number Diff line change
Expand Up @@ -1318,14 +1318,18 @@ int kvm_lapic_reg_read(struct kvm_lapic *apic, u32 offset, int len,
unsigned char alignment = offset & 0xf;
u32 result;
/* this bitmask has a bit cleared for each reserved register */
static const u64 rmask = 0x43ff01ffffffe70cULL;
u64 rmask = 0x43ff01ffffffe70cULL;

if ((alignment + len) > 4) {
apic_debug("KVM_APIC_READ: alignment error %x %d\n",
offset, len);
return 1;
}

/* ARBPRI is also reserved on x2APIC */
if (apic_x2apic_mode(apic))
rmask &= ~(1 << (APIC_ARBPRI >> 4));

if (offset > 0x3f0 || !(rmask & (1ULL << (offset >> 4)))) {
apic_debug("KVM_APIC_READ: read reserved register %x\n",
offset);
Expand Down

0 comments on commit 101628d

Please sign in to comment.