RE: [PATCH v4 29/71] x86/cpu/intel: Switch to new Intel CPU model defines

From: Luck, Tony
Date: Thu Apr 25 2024 - 12:29:53 EST


> > +static bool vfm_match(struct cpuinfo_x86 *c, u32 vfm)
> > +{
> > + return c->x86_vendor == VFM_VENDOR(vfm) &&
> > + c->x86 == VFM_FAMILY(vfm) &&
> > + c->x86_model == VFM_MODEL(vfm);
> > +}
>
> Why is that one here?
>
> It looks generic enough to put it in asm/processor.h so that it can get
> used elsewhere too instead of homegrowing things again...

Looking at it now in the context of where this patch series ended, it looks
to be superfluous. It just reduces to:

static bool vfm_match(struct cpuinfo_x86 *c, u32 vfm)
{
return c->x86_vfm == vfm;
}

But since it is only used in one place, I should just do that test inline without
a helper:

if (c->x86_vfm == spectre_bad_microcodes[i].vfm &&
c->x86_stepping == spectre_bad_microcodes[i].stepping)
return (c->microcode <= spectre_bad_microcodes[i].microcode);

-Tony