kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Babu Moger <babu.moger@amd.com>
To: Sean Christopherson <seanjc@google.com>, Borislav Petkov <bp@alien8.de>
Cc: "pbonzini@redhat.com" <pbonzini@redhat.com>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"fenghua.yu@intel.com" <fenghua.yu@intel.com>,
	"tony.luck@intel.com" <tony.luck@intel.com>,
	"wanpengli@tencent.com" <wanpengli@tencent.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"Lendacky, Thomas" <Thomas.Lendacky@amd.com>,
	"peterz@infradead.org" <peterz@infradead.org>,
	"joro@8bytes.org" <joro@8bytes.org>,
	"x86@kernel.org" <x86@kernel.org>,
	"kyung.min.park@intel.com" <kyung.min.park@intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"krish.sadhukhan@oracle.com" <krish.sadhukhan@oracle.com>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"mgross@linux.intel.com" <mgross@linux.intel.com>,
	"vkuznets@redhat.com" <vkuznets@redhat.com>,
	"Phillips, Kim" <kim.phillips@amd.com>,
	"Huang2, Wei" <Wei.Huang2@amd.com>,
	"jmattson@google.com" <jmattson@google.com>
Subject: RE: [PATCH v2 2/2] KVM: SVM: Add support for Virtual SPEC_CTRL
Date: Mon, 4 Jan 2021 12:37:13 -0600	[thread overview]
Message-ID: <8a392a10-9367-31ee-1a63-bc57a40ab82d@amd.com> (raw)
In-Reply-To: <X+yl57S8vuU2pRil@google.com>



> -----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

  reply	other threads:[~2021-01-04 18:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-22 22:31 [PATCH v2 0/2] x86: Add the feature Virtual SPEC_CTRL Babu Moger
2020-12-22 22:31 ` [PATCH v2 1/2] x86/cpufeatures: Add the Virtual SPEC_CTRL feature Babu Moger
2020-12-30  7:15   ` Borislav Petkov
2020-12-22 22:31 ` [PATCH v2 2/2] KVM: SVM: Add support for Virtual SPEC_CTRL Babu Moger
2020-12-30  7:15   ` Borislav Petkov
2020-12-30 16:08     ` Sean Christopherson
2021-01-04 18:37       ` Babu Moger [this message]
2021-01-04 15:47   ` Tom Lendacky
2021-01-04 18:35     ` Babu Moger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8a392a10-9367-31ee-1a63-bc57a40ab82d@amd.com \
    --to=babu.moger@amd.com \
    --cc=Thomas.Lendacky@amd.com \
    --cc=Wei.Huang2@amd.com \
    --cc=bp@alien8.de \
    --cc=fenghua.yu@intel.com \
    --cc=hpa@zytor.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kim.phillips@amd.com \
    --cc=krish.sadhukhan@oracle.com \
    --cc=kvm@vger.kernel.org \
    --cc=kyung.min.park@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgross@linux.intel.com \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).