Messages in this thread Patch in this message | | | From | Jim Mattson <> | Date | Thu, 3 Feb 2022 12:50:53 -0800 | Subject | Re: [PATCH 2/2] x86/cpufeatures: Add macros for Intel's new fast rep string features |
| |
On Thu, Feb 3, 2022 at 12:25 PM Dave Hansen <dave.hansen@intel.com> wrote: > > On 2/3/22 11:43, Jim Mattson wrote: > > Even if no one else cares, these features should be exposed to kvm > > guests, and the code for the KVM_GET_SUPPORTED_CPUID ioctl is more > > readable if the bits have corresponding X86_FEATURE macros. > > I went digging around KVM_GET_SUPPORTED_CPUID and didn't see any obvious > unreadable things resulting from not having these defines. Maybe I'm > looking in the wrong spot. Do you have a slightly more specific pointer?
These features are not currently enumerated by KVM_GET_SUPPORTED_CPUID. They would be added as follows [gmail mangles diffs; sorry]:
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index 28be02adc669..11e621b6faac 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -599,7 +599,7 @@ void kvm_set_cpu_caps(void) kvm_cpu_cap_set(X86_FEATURE_SPEC_CTRL_SSBD);
kvm_cpu_cap_mask(CPUID_7_1_EAX, - F(AVX_VNNI) | F(AVX512_BF16) + F(AVX_VNNI) | F(AVX512_BF16) | F(FZRM) | F(FSRS) | F(FSRC) );
kvm_cpu_cap_mask(CPUID_D_1_EAX, (Of course, we can always define these macros in that file, if that's preferable.)
> > +#define X86_FEATURE_FZRM (12*32+10) /* Fast zero-length REP MOVSB */ > > +#define X86_FEATURE_FSRS (12*32+11) /* Fast short REP STOSB */ > > +#define X86_FEATURE_FSRC (12*32+12) /* Fast short REP {CMPSB,SCASB} */ > > If the use really is for inside the kernel, maybe we should hide them > from cpuinfo: > > #define X86_FEATURE_FSRC (12*32+12) /* "" Fast short REP {CMPSB,SCASB} */
That sounds good to me.
| |