Commit 101628de authored by Paolo Bonzini's avatar Paolo Bonzini

KVM: LAPIC: ARBPRI is a reserved register for x2APIC

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: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 1ef23e1f
...@@ -1318,7 +1318,7 @@ int kvm_lapic_reg_read(struct kvm_lapic *apic, u32 offset, int len, ...@@ -1318,7 +1318,7 @@ int kvm_lapic_reg_read(struct kvm_lapic *apic, u32 offset, int len,
unsigned char alignment = offset & 0xf; unsigned char alignment = offset & 0xf;
u32 result; u32 result;
/* this bitmask has a bit cleared for each reserved register */ /* this bitmask has a bit cleared for each reserved register */
static const u64 rmask = 0x43ff01ffffffe70cULL; u64 rmask = 0x43ff01ffffffe70cULL;
if ((alignment + len) > 4) { if ((alignment + len) > 4) {
apic_debug("KVM_APIC_READ: alignment error %x %d\n", apic_debug("KVM_APIC_READ: alignment error %x %d\n",
...@@ -1326,6 +1326,10 @@ int kvm_lapic_reg_read(struct kvm_lapic *apic, u32 offset, int len, ...@@ -1326,6 +1326,10 @@ int kvm_lapic_reg_read(struct kvm_lapic *apic, u32 offset, int len,
return 1; 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)))) { if (offset > 0x3f0 || !(rmask & (1ULL << (offset >> 4)))) {
apic_debug("KVM_APIC_READ: read reserved register %x\n", apic_debug("KVM_APIC_READ: read reserved register %x\n",
offset); offset);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment