lkml.org 
[lkml]   [2021]   [Jan]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRE: [PATCH v2 2/2] KVM: SVM: Add support for Virtual SPEC_CTRL
From
Date


> -----Original Message-----
> From: Sean Christopherson <seanjc@google.com>
> Sent: Wednesday, December 30, 2020 10:08 AM
> To: Borislav Petkov <bp@alien8.de>
> Cc: Moger, Babu <Babu.Moger@amd.com>; pbonzini@redhat.com;
> tglx@linutronix.de; mingo@redhat.com; fenghua.yu@intel.com;
> tony.luck@intel.com; wanpengli@tencent.com; kvm@vger.kernel.org;
> Lendacky, Thomas <Thomas.Lendacky@amd.com>; peterz@infradead.org;
> joro@8bytes.org; x86@kernel.org; kyung.min.park@intel.com; linux-
> kernel@vger.kernel.org; krish.sadhukhan@oracle.com; hpa@zytor.com;
> mgross@linux.intel.com; vkuznets@redhat.com; Phillips, Kim
> <kim.phillips@amd.com>; Huang2, Wei <Wei.Huang2@amd.com>;
> jmattson@google.com
> Subject: Re: [PATCH v2 2/2] KVM: SVM: Add support for Virtual SPEC_CTRL
>
> On Wed, Dec 30, 2020, Borislav Petkov wrote:
> > On Tue, Dec 22, 2020 at 04:31:55PM -0600, Babu Moger wrote:
> > > @@ -2549,7 +2559,10 @@ static int svm_get_msr(struct kvm_vcpu *vcpu,
> struct msr_data *msr_info)
> > > !guest_cpuid_has(vcpu, X86_FEATURE_AMD_SSBD))
> > > return 1;
> > >
> > > - msr_info->data = svm->spec_ctrl;
> > > + if (static_cpu_has(X86_FEATURE_V_SPEC_CTRL))
> > > + msr_info->data = svm->vmcb->save.spec_ctrl;
> > > + else
> > > + msr_info->data = svm->spec_ctrl;
> > > break;
> > > case MSR_AMD64_VIRT_SPEC_CTRL:
> > > if (!msr_info->host_initiated &&
> > > @@ -2640,6 +2653,8 @@ static int svm_set_msr(struct kvm_vcpu *vcpu,
> struct msr_data *msr)
> > > return 1;
> > >
> > > svm->spec_ctrl = data;
> > > + if (static_cpu_has(X86_FEATURE_V_SPEC_CTRL))
> > > + svm->vmcb->save.spec_ctrl = data;
> > > if (!data)
> > > break;
> > >
> >
> > Are the get/set_msr() accessors such a fast path that they need
> > static_cpu_has() ?
>
> Nope, they can definitely use boot_cpu_has().

With Tom's latest comment, this change may not be required.
I will remove these changes.
Thanks
Babu

\
 
 \ /
  Last update: 2021-01-04 19:39    [W:0.059 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site