[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <01de50c9-3339-4bdf-a880-ae66a1a8051e@intel.com>
Date: Thu, 4 Apr 2024 17:33:06 -0700
From: Dave Hansen <dave.hansen@...el.com>
To: Sean Christopherson <seanjc@...gle.com>,
Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>,
x86@...nel.org, Paolo Bonzini <pbonzini@...hat.com>
Cc: linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
Sandipan Das <sandipan.das@....com>
Subject: Re: [PATCH] x86/cpufeatures: Add CPUID_LNX_5 to track recently added
Linux-defined word
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@....com>
> Signed-off-by: Sean Christopherson <seanjc@...gle.com>
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@...ux.intel.com>
Powered by blists - more mailing lists