Skip to content

Commit

Permalink
KVM: VMX: Fix x2APIC MSR intercept handling on !APICV platforms
Browse files Browse the repository at this point in the history
Fix an inverted flag for intercepting x2APIC MSRs and intercept writes
by default, even when APICV is enabled.

Fixes: 3eb9001 ("KVM: x86: VMX: Prevent MSR passthrough when MSR access is denied")
Co-developed-by: Peter Xu <[email protected]>
[sean: added changelog]
Signed-off-by: Sean Christopherson <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
  • Loading branch information
xzpeter authored and bonzini committed Oct 19, 2020
1 parent 6a2e092 commit 628ade2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions arch/x86/kvm/vmx/vmx.c
Original file line number Diff line number Diff line change
Expand Up @@ -3787,9 +3787,10 @@ static void vmx_update_msr_bitmap_x2apic(struct kvm_vcpu *vcpu, u8 mode)
int msr;

for (msr = 0x800; msr <= 0x8ff; msr++) {
bool intercepted = !!(mode & MSR_BITMAP_MODE_X2APIC_APICV);
bool apicv = !!(mode & MSR_BITMAP_MODE_X2APIC_APICV);

vmx_set_intercept_for_msr(vcpu, msr, MSR_TYPE_RW, intercepted);
vmx_set_intercept_for_msr(vcpu, msr, MSR_TYPE_R, !apicv);
vmx_set_intercept_for_msr(vcpu, msr, MSR_TYPE_W, true);
}

if (mode & MSR_BITMAP_MODE_X2APIC) {
Expand Down

0 comments on commit 628ade2

Please sign in to comment.