Re: [PATCH] x86/cpufeatures: Cleanup AMD speculation feature bits
From: David Woodhouse
Date: Fri Jan 26 2018 - 17:00:01 EST
On Fri, 2018-01-26 at 22:52 +0100, Borislav Petkov wrote:
> On Fri, Jan 26, 2018 at 03:06:20PM -0600, Tom Lendacky wrote:
> >
> > So I like the idea of AMD_IBRS/AMD_IBPB/AMD_STIBP and then use the magic
> > quotes as appropriate.ÂÂWe could probably use the magic quotes on
> > AMD_STIBP and set X86_FEATURE_STIBP when we see X86_FEATURE_AMD_STIBP.
> Like this?
>
> We set the respective Intel features when we detect the AMD ones so that
> we get correct /proc/cpuinfo strings. The respective AMD ones are not
> shown.
>
> +
> + if (cpu_has(c, X86_FEATURE_AMD_IBRS))
> + set_cpu_cap(c, X86_FEATURE_IBRS);
No, there is no X86_FEATURE_IBRS; that was going to be the "we are
using IBRS" soft feature, analogous to X86_FEATURE_RETPOLINE and
X86_FEATURE_IBPB, actually used for the alternatives.
Intel doesn't *have* a feature bit for only IBRS. They have the bit
which indicates that *both* the SPEC_CTRL (with IBRS) and PRED_CMD
(with IBPB) registers are present.
If we wanted to do this kind of thing, we'd do it the other way round.
Turn the *Intel* feature into both 'IBRS' and 'IBPB' CPU-visible
features, and have those defined in the AMD word. Then use virtual bits
with "" for the software features, since we don't want *those* to
appear in /proc/cpuinfo.
I'll take a look at this in the morning.
Attachment:
smime.p7s
Description: S/MIME cryptographic signature