Re: [PATCH 27/61] KVM: x86: Introduce cpuid_entry_{change,set,clear}() mutators

From: Sean Christopherson
Date: Mon Feb 24 2020 - 17:42:22 EST


On Mon, Feb 24, 2020 at 02:43:07PM +0100, Vitaly Kuznetsov wrote:
> Sean Christopherson <sean.j.christopherson@xxxxxxxxx> writes:
>
> > diff --git a/arch/x86/kvm/cpuid.h b/arch/x86/kvm/cpuid.h
> > index 64e96e4086e2..51f19eade5a0 100644
> > --- a/arch/x86/kvm/cpuid.h
> > +++ b/arch/x86/kvm/cpuid.h
> > @@ -135,6 +135,37 @@ static __always_inline bool cpuid_entry_has(struct kvm_cpuid_entry2 *entry,
> > return cpuid_entry_get(entry, x86_feature);
> > }
> >
> > +static __always_inline void cpuid_entry_clear(struct kvm_cpuid_entry2 *entry,
> > + unsigned x86_feature)
> > +{
> > + u32 *reg = cpuid_entry_get_reg(entry, x86_feature);
> > +
> > + *reg &= ~__feature_bit(x86_feature);
> > +}
> > +
> > +static __always_inline void cpuid_entry_set(struct kvm_cpuid_entry2 *entry,
> > + unsigned x86_feature)
> > +{
> > + int *reg = cpuid_entry_get_reg(entry, x86_feature);
>
> I think 'reg' should be 'u32', similar to cpuid_entry_clear()

Doh, thanks!

> > +
> > + *reg |= __feature_bit(x86_feature);
> > +}
> > +
> > +static __always_inline void cpuid_entry_change(struct kvm_cpuid_entry2 *entry,
> > + unsigned x86_feature, bool set)
> > +{
> > + int *reg = cpuid_entry_get_reg(entry, x86_feature);
>
> Ditto.
>