mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
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>
This commit is contained in:
committed by
Paolo Bonzini
parent
1e7a483037
commit
ef1d2ee12e
@@ -1651,9 +1651,11 @@ static void setup_msrs(struct vcpu_vmx *vmx)
|
|||||||
index = __vmx_find_uret_msr(vmx, MSR_EFER);
|
index = __vmx_find_uret_msr(vmx, MSR_EFER);
|
||||||
if (index >= 0 && update_transition_efer(vmx, index))
|
if (index >= 0 && update_transition_efer(vmx, index))
|
||||||
move_msr_up(vmx, index, nr_active_uret_msrs++);
|
move_msr_up(vmx, index, nr_active_uret_msrs++);
|
||||||
index = __vmx_find_uret_msr(vmx, MSR_TSC_AUX);
|
if (guest_cpuid_has(&vmx->vcpu, X86_FEATURE_RDTSCP)) {
|
||||||
if (index >= 0 && guest_cpuid_has(&vmx->vcpu, X86_FEATURE_RDTSCP))
|
index = __vmx_find_uret_msr(vmx, MSR_TSC_AUX);
|
||||||
move_msr_up(vmx, index, nr_active_uret_msrs++);
|
if (index >= 0)
|
||||||
|
move_msr_up(vmx, index, nr_active_uret_msrs++);
|
||||||
|
}
|
||||||
index = __vmx_find_uret_msr(vmx, MSR_IA32_TSX_CTRL);
|
index = __vmx_find_uret_msr(vmx, MSR_IA32_TSX_CTRL);
|
||||||
if (index >= 0)
|
if (index >= 0)
|
||||||
move_msr_up(vmx, index, nr_active_uret_msrs++);
|
move_msr_up(vmx, index, nr_active_uret_msrs++);
|
||||||
|
|||||||
Reference in New Issue
Block a user