Re: [PATCH v2 07/21] KVM: x86: Add a framework for enabling KVM-governed x86 features

From: Sean Christopherson
Date: Mon Aug 14 2023 - 13:21:23 EST


On Mon, Aug 14, 2023, Zeng Guang wrote:
>
> On 7/29/2023 9:15 AM, Sean Christopherson wrote:
> > +static __always_inline int kvm_governed_feature_index(unsigned int x86_feature)
> > +{
> > + switch (x86_feature) {
> > +#define KVM_GOVERNED_FEATURE(x) case x: return KVM_GOVERNED_##x;
> > +#include "governed_features.h"
> > + default:
> > + return -1;
> > + }
> > +}
> > +
> > +static __always_inline int kvm_is_governed_feature(unsigned int x86_feature)
> > +{
> > + return kvm_governed_feature_index(x86_feature) >= 0;
> > +}
> > +
>
> I think it proper to return a bool, not "int" instead.

Yeah. I'm pretty sure someone brought this up in v1 too, and I spaced on it.