Re: [PATCH v7 7/7] KVM: x86: Add user-space access interface for CET MSRs

Yang Weijiang
2019-10-18T01:29:16Z

On Thu, Oct 17, 2019 at 12:58:11PM -0700, Sean Christopherson wrote:
> On Wed, Oct 02, 2019 at 01:57:50PM -0700, Jim Mattson wrote:
> > On Thu, Sep 26, 2019 at 7:17 PM Yang Weijiang <weijiang.yang@intel.com> wrote:
> > >
> > > There're two different places storing Guest CET states, the states
> > > managed with XSAVES/XRSTORS, as restored/saved
> > > in previous patch, can be read/write directly from/to the MSRs.
> > > For those stored in VMCS fields, they're access via vmcs_read/
> > > vmcs_write.
> > >
> > > Signed-off-by: Yang Weijiang <weijiang.yang@intel.com>
> > > ---
> > > arch/x86/kvm/vmx/vmx.c | 83 ++++++++++++++++++++++++++++++++++++++++++
> > > 1 file changed, 83 insertions(+)
> > >
> > > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> > > index 44913e4ab558..5265db7cd2af 100644
> > > --- a/arch/x86/kvm/vmx/vmx.c
> > > +++ b/arch/x86/kvm/vmx/vmx.c
> > > @@ -1671,6 +1671,49 @@ static int vmx_get_msr_feature(struct kvm_msr_entry *msr)
> > > return 0;
> > > }
> > >
> > > +static int check_cet_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
> >
> > I'd suggest changing return type to bool, since you are essentially
> > returning true or false.
>
> I'd also be more explicit in the name, e.g. is_valid_cet_msr().
Sure, thank you two.