Re: [PATCH v11 2/9] KVM: VMX: Set guest CET MSRs per KVM and host configuration

From: Paolo Bonzini
Date: Sat Apr 25 2020 - 09:26:59 EST


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?

Paolo

>> +{
>> + return ((supported_xss & mode_mask) &&
>> + (guest_cpuid_has(vcpu, X86_FEATURE_SHSTK) ||
>> + guest_cpuid_has(vcpu, X86_FEATURE_IBT)));
>> +}