Re: [PATCH v3 3/8] x86/sev: Require the RMPREAD instruction after Fam19h

From: Borislav Petkov
Date: Fri Oct 18 2024 - 09:06:52 EST


On Mon, Sep 30, 2024 at 01:59:54PM -0500, Tom Lendacky wrote:
> The one issue we run into is that family 0x19 contains both Milan (zen3)
> and Genoa (zen4), so I'm not sure what to use as a good #define name. We
> have the same problem with family 0x17 which contains zen1 and zen2.
>
> I might be able to change the if statement to something like:
>
> if (!cpu_has(c, X86_FEATURE_HYPERVISOR) &&
> (cpu_feature_enabled(X86_FEATURE_ZEN3) ||
> cpu_feature_enabled(X86_FEATURE_ZEN4) ||
> cpu_feature_enabled(X86_FEATURE_RMPREAD)) &&
> snp_probe_rmptable_info()) {
>
> which might make the intent clearer.
>
> But, yes, I get your point about making grepping much easier, along with
> code readability. Maybe Boris and I can put our heads together to figure
> something out.

Right, that's why I'm adding the synthetic feature flags - for things like
that.

I think it is very readable this way and if this check needs to be repeated,
we can carve it out into a separate helper or so...

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette