Re: [PATCH] selftests: KVM: add sev_migrate_tests on machines without SEV-ES

From: Sean Christopherson
Date: Tue Feb 22 2022 - 11:12:41 EST


On Fri, Feb 18, 2022, Peter Gonda wrote:
> On Fri, Feb 18, 2022 at 3:09 AM Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote:
> > +#define X86_FEATURE_SEV (1 << 1)
> > +#define X86_FEATURE_SEV_ES (1 << 3)
>
> These conflict with these names but have different values:
> https://elixir.bootlin.com/linux/latest/source/arch/x86/include/asm/cpufeatures.h#L402.
> Is that normal in selftests or should we go with another name?

It's normal. The kernel uses semi-arbitrary values that don't map directly to
CPUID. I like Paolo's suggestion of pulling in KVM-Unit-Tests' approach for
dealing with CPUID features[*]; if/when that happens these definitions will become
less ad hoc.

[*] https://lore.kernel.org/all/16823e91-5caf-f52e-e0dc-28ebb9a87b47@xxxxxxxxxx