Re: [PATCH] x86/cpufeatures: Add CPUID_LNX_5 to track recently added Linux-defined word

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


On 4/4/24 17:16, Sean Christopherson wrote:
> 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@xxxxxxx>
> Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>

I don't think I noticed this KVM code before, or at least how it
depended on the enum.  But the BUILD_BUG_ON() will surely make the
ignorant among us aware _now_.  Looks good:

Acked-by: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux