lkml.org 
[lkml]   [2020]   [Feb]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 05/26] KVM: x86: Move MSR_TSC_AUX existence checks into vendor code
Date
Sean Christopherson <sean.j.christopherson@intel.com> writes:

> Move the MSR_TSC_AUX existence check into vendor code using the newly
> introduced ->has_virtualized_msr() hook to help pave the way toward the
> removal of ->rdtscp_supported().
>
> No functional change intended.
>
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> ---
> arch/x86/kvm/svm.c | 7 +++++++
> arch/x86/kvm/vmx/vmx.c | 7 +++++++
> arch/x86/kvm/x86.c | 4 ----
> 3 files changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> index 1f9323fbad81..4c8427f57b71 100644
> --- a/arch/x86/kvm/svm.c
> +++ b/arch/x86/kvm/svm.c
> @@ -5987,6 +5987,13 @@ static bool svm_cpu_has_accelerated_tpr(void)
>
> static bool svm_has_virtualized_msr(u32 index)
> {
> + switch (index) {
> + case MSR_TSC_AUX:
> + return boot_cpu_has(X86_FEATURE_RDTSCP);
> + default:
> + break;
> + }
> +
> return true;
> }
>
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index 3f2c094434e8..9588914e941e 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -6276,6 +6276,13 @@ static void vmx_handle_exit_irqoff(struct kvm_vcpu *vcpu,
>
> static bool vmx_has_virtualized_msr(u32 index)
> {
> + switch (index) {
> + case MSR_TSC_AUX:
> + return cpu_has_vmx_rdtscp();
> + default:
> + break;
> + }
> +
> return true;
> }
>
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 94f90fe1c0de..a8619c52ea86 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -5241,10 +5241,6 @@ static void kvm_init_msr_list(void)
> if (!kvm_mpx_supported())
> continue;
> break;
> - case MSR_TSC_AUX:
> - if (!kvm_x86_ops->rdtscp_supported())
> - continue;
> - break;
> case MSR_IA32_RTIT_CTL:
> case MSR_IA32_RTIT_STATUS:
> if (!kvm_x86_ops->pt_supported())

Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>

--
Vitaly

\
 
 \ /
  Last update: 2020-02-05 15:40    [W:1.856 / U:3.552 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site