KVM: x86: Use KVM cpu caps to detect MSR_TSC_AUX virt support
authorSean Christopherson <sean.j.christopherson@intel.com>
Mon, 2 Mar 2020 23:56:57 +0000 (15:56 -0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 16 Mar 2020 16:58:35 +0000 (17:58 +0100)
Check for MSR_TSC_AUX virtualization via kvm_cpu_cap_has() and drop
->rdtscp_supported().

Note, vmx_rdtscp_supported() needs to hang around a tiny bit longer due
other usage in VMX code.

No functional change intended.

Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/svm.c
arch/x86/kvm/vmx/vmx.c
arch/x86/kvm/x86.c

index c46373016574f9158bc5fd14b4fb0ee292ffbbe8..00a1be55e90a2eab68218b133b71293bdcddfe75 100644 (file)
@@ -1156,7 +1156,6 @@ struct kvm_x86_ops {
        int (*get_tdp_level)(struct kvm_vcpu *vcpu);
        u64 (*get_mt_mask)(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio);
        int (*get_lpage_level)(void);
-       bool (*rdtscp_supported)(void);
 
        void (*set_tdp_cr3)(struct kvm_vcpu *vcpu, unsigned long cr3);
 
index 0236f2f98cbd2f5cf5395ab48238fc00370c2438..f802d9c196e9ac01ce8c9e858066f705ab2a5492 100644 (file)
@@ -6074,11 +6074,6 @@ static int svm_get_lpage_level(void)
        return PT_PDPE_LEVEL;
 }
 
-static bool svm_rdtscp_supported(void)
-{
-       return boot_cpu_has(X86_FEATURE_RDTSCP);
-}
-
 static bool svm_pt_supported(void)
 {
        return false;
@@ -7445,7 +7440,6 @@ static struct kvm_x86_ops svm_x86_ops __ro_after_init = {
 
        .cpuid_update = svm_cpuid_update,
 
-       .rdtscp_supported = svm_rdtscp_supported,
        .pt_supported = svm_pt_supported,
 
        .set_supported_cpuid = svm_set_supported_cpuid,
index fe7b4ae867d83bfbe80b0a9a68f9bcc4fd0d9b4b..80e8b842310414081782e4c4eacf30f059d3c105 100644 (file)
@@ -7939,9 +7939,6 @@ static struct kvm_x86_ops vmx_x86_ops __ro_after_init = {
        .get_lpage_level = vmx_get_lpage_level,
 
        .cpuid_update = vmx_cpuid_update,
-
-       .rdtscp_supported = vmx_rdtscp_supported,
-
        .set_supported_cpuid = vmx_set_supported_cpuid,
 
        .has_wbinvd_exit = cpu_has_vmx_wbinvd_exit,
index 51a49a6ed070875927948b10ddd2d013634e2fd3..fd0889f2f37fae1053e619a66ea08f7e1888f8d1 100644 (file)
@@ -5215,7 +5215,7 @@ static void kvm_init_msr_list(void)
                                continue;
                        break;
                case MSR_TSC_AUX:
-                       if (!kvm_x86_ops->rdtscp_supported())
+                       if (!kvm_cpu_cap_has(X86_FEATURE_RDTSCP))
                                continue;
                        break;
                case MSR_IA32_RTIT_CTL: