Re: [PATCH v11 2/9] KVM: VMX: Set guest CET MSRs per KVM and host configuration
From: Yang Weijiang
Date: Sun Apr 26 2020 - 11:24:06 EST
On Sat, Apr 25, 2020 at 03:26:30PM +0200, Paolo Bonzini wrote:
> On 23/04/20 18:27, Sean Christopherson wrote:
> >>
> >> +static bool is_cet_mode_allowed(struct kvm_vcpu *vcpu, u32 mode_mask)
> > CET itself isn't a mode. And since this ends up being an inner helper for
> > is_cet_supported(), I think __is_cet_supported() would be the way to go.
> >
> > Even @mode_mask is a bit confusing without the context of it being kernel
> > vs. user. The callers are very readable, e.g. I'd much prefer passing the
> > mask as opposed to doing 'bool kernel'. Maybe s/mode_mask/cet_mask? That
> > doesn't exactly make things super clear, but at least the reader knows the
> > mask is for CET features.
>
> What about is_cet_state_supported and xss_states?
>
It's good for me, I'll change them accordingly, thank you for review!
> Paolo
>
> >> +{
> >> + return ((supported_xss & mode_mask) &&
> >> + (guest_cpuid_has(vcpu, X86_FEATURE_SHSTK) ||
> >> + guest_cpuid_has(vcpu, X86_FEATURE_IBT)));
> >> +}