Skip to content

Commit bab2204

Browse files
Dongli Zhangsean-jc
authored andcommitted
KVM: VMX: return early if msr_bitmap is not supported
The vmx_msr_filter_changed() may directly/indirectly calls only vmx_enable_intercept_for_msr() or vmx_disable_intercept_for_msr(). Those two functions may exit immediately if !cpu_has_vmx_msr_bitmap(). vmx_msr_filter_changed() -> vmx_disable_intercept_for_msr() -> pt_update_intercept_for_msr() -> vmx_set_intercept_for_msr() -> vmx_enable_intercept_for_msr() -> vmx_disable_intercept_for_msr() Therefore, we exit early if !cpu_has_vmx_msr_bitmap(). Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com> Link: https://lore.kernel.org/r/20240223202104.3330974-3-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent 8e24eee commit bab2204

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

arch/x86/kvm/vmx/vmx.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4127,6 +4127,9 @@ static void vmx_msr_filter_changed(struct kvm_vcpu *vcpu)
41274127
struct vcpu_vmx *vmx = to_vmx(vcpu);
41284128
u32 i;
41294129

4130+
if (!cpu_has_vmx_msr_bitmap())
4131+
return;
4132+
41304133
/*
41314134
* Redo intercept permissions for MSRs that KVM is passing through to
41324135
* the guest. Disabling interception will check the new MSR filter and

0 commit comments

Comments
 (0)