]> www.infradead.org Git - users/dwmw2/linux.git/commit
x86/cpufeatures: Add CPUID_LNX_5 to track recently added Linux-defined word
authorSean Christopherson <seanjc@google.com>
Fri, 5 Apr 2024 00:16:14 +0000 (17:16 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Apr 2024 14:19:36 +0000 (16:19 +0200)
commit76299c3f11b46eefcc3222477ba7bd675e435fd1
tree02a516eaa507d9cc7dc77597612e73f7f7ea5c3f
parent571d80f8a4581ba48fd3dc834e91139ec95abe52
x86/cpufeatures: Add CPUID_LNX_5 to track recently added Linux-defined word

commit 8cb4a9a82b21623dbb4b3051dd30d98356cf95bc upstream.

Add CPUID_LNX_5 to track cpufeatures' word 21, and add the appropriate
compile-time assert in KVM to prevent direct lookups on the features in
CPUID_LNX_5.  KVM uses X86_FEATURE_* flags to manage guest CPUID, and so
must translate features that are scattered by Linux from the Linux-defined
bit to the hardware-defined bit, i.e. should never try to directly access
scattered features in guest CPUID.

Opportunistically add NR_CPUID_WORDS to enum cpuid_leafs, along with a
compile-time assert in KVM's CPUID infrastructure to ensure that future
additions update cpuid_leafs along with NCAPINTS.

No functional change intended.

Fixes: 7f274e609f3d ("x86/cpufeatures: Add new word for scattered features")
Cc: Sandipan Das <sandipan.das@amd.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Acked-by: Dave Hansen <dave.hansen@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/include/asm/cpufeature.h
arch/x86/kvm/reverse_cpuid.h