diff options
author | Sean Christopherson <sean.j.christopherson@intel.com> | 2020-09-23 21:04:03 +0300 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2020-09-28 14:57:59 +0300 |
commit | ef1d2ee12e6cd5abbf9986f35238f2fb2cd21a6d (patch) | |
tree | 58e0428b362e0ed624061a0b660c535389ca0e17 /arch/x86/kvm | |
parent | 1e7a483037e8fa884c688f2213c8af10f2e8e96a (diff) | |
download | linux-ef1d2ee12e6cd5abbf9986f35238f2fb2cd21a6d.tar.xz |
KVM: VMX: Check guest support for RDTSCP before processing MSR_TSC_AUX
Check for RDTSCP support prior to checking if MSR_TSC_AUX is in the uret
MSRs array so that the array lookup and manipulation are back-to-back.
This paves the way toward adding a helper to wrap the lookup and
manipulation.
No functional change intended.
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Message-Id: <20200923180409.32255-10-sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r-- | arch/x86/kvm/vmx/vmx.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index ae3c01cde79d..068783a13ac8 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -1651,9 +1651,11 @@ static void setup_msrs(struct vcpu_vmx *vmx) index = __vmx_find_uret_msr(vmx, MSR_EFER); if (index >= 0 && update_transition_efer(vmx, index)) move_msr_up(vmx, index, nr_active_uret_msrs++); - index = __vmx_find_uret_msr(vmx, MSR_TSC_AUX); - if (index >= 0 && guest_cpuid_has(&vmx->vcpu, X86_FEATURE_RDTSCP)) - move_msr_up(vmx, index, nr_active_uret_msrs++); + if (guest_cpuid_has(&vmx->vcpu, X86_FEATURE_RDTSCP)) { + index = __vmx_find_uret_msr(vmx, MSR_TSC_AUX); + if (index >= 0) + move_msr_up(vmx, index, nr_active_uret_msrs++); + } index = __vmx_find_uret_msr(vmx, MSR_IA32_TSX_CTRL); if (index >= 0) move_msr_up(vmx, index, nr_active_uret_msrs++); |