KVM: x86: Move open-coded CPUID leaf 0x80000021 EAX bit propagation code
authorKim Phillips <kim.phillips@amd.com>
Tue, 24 Jan 2023 16:33:13 +0000 (10:33 -0600)
committerBorislav Petkov (AMD) <bp@alien8.de>
Wed, 25 Jan 2023 11:33:13 +0000 (12:33 +0100)
commitc35ac8c4bf600ee23bacb20f863aa7830efb23fb
treef29888f4c00c640be71285786d5cb119dd236047
parent8415a74852d7c24795007ee9862d25feb519007c
KVM: x86: Move open-coded CPUID leaf 0x80000021 EAX bit propagation code

Move code from __do_cpuid_func() to kvm_set_cpu_caps() in preparation for adding
the features in their native leaf.

Also drop the bit description comments as it will be more self-describing once
the individual features are added.

Whilst there, switch to using the more efficient cpu_feature_enabled() instead
of static_cpu_has().

Note, LFENCE_RDTSC and "NULL selector clears base" are currently synthetic,
Linux-defined feature flags as Linux tracking of the features predates AMD's
definition.  Keep the manual propagation of the flags from their synthetic
counterparts until the kernel fully converts to AMD's definition, otherwise KVM
would stop synthesizing the flags as intended.

Signed-off-by: Kim Phillips <kim.phillips@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Acked-by: Sean Christopherson <seanjc@google.com>
Link: https://lore.kernel.org/r/20230124163319.2277355-3-kim.phillips@amd.com
arch/x86/kvm/cpuid.c