vpopcntdq support
cover vpopcntdq support
Hi,
This patchset adds the support for new CPUID feature bit that announces the vector population count instructions for dwords and qwords.
The path 1/2 adds new feature flags and handles clearing the feature bit in case xsave is not enabled.
The patch 2/2 enables passing the feature bit to a kvm/quemu guest.
The patchset is based on v4.10-rc3.
Regards,
Piotr
Piotr Luc (2):
x86/cpufeature: Add AVX512_VPOPCNTDQ feature
kvm: x86: Expose Intel VPOPCNTDQ feature to guest
arch/x86/include/asm/cpufeatures.h | 2 +- arch/x86/kernel/fpu/xstate.c | 1 + arch/x86/kvm/cpuid.c | 2 +- tools/arch/x86/include/asm/cpufeatures.h | 1 + 4 files changed, 4 insertions(+), 2 deletions(-)
Signature · 1 line
2.10.1
PATCH 1/2 x86/cpufeature: Add AVX512_VPOPCNTDQ feature
Vector population count instructions for dwords and qwords are to be used in future Intel Xeon & Xeon Phi processors. The bit 14 of CPUID[level:0x07, ECX] indicates that the new instructions are supported by a processor.
The spec can be found in the Intel Software Developer Manual (SDM) or in the Instruction Set Extensions Programming Reference (ISE).
Define new feature flag to enumerate the new instructions set in /proc/cpuinfo according to new CPUID bit.
Clear the feature bit in case xsave is disabled.
--- arch/x86/include/asm/cpufeatures.h | 2 +- arch/x86/kernel/fpu/xstate.c | 1 + tools/arch/x86/include/asm/cpufeatures.h | 1 + 3 files changed, 3 insertions(+), 1 deletion(-)
arch/x86/include/asm/cpufeatures.h +1 -1
@@ -288,6 +288,7 @@#define X86_FEATURE_AVX512VBMI (16*32+ 1)/* AVX512 Vector Bit Manipulation instructions*/ #define X86_FEATURE_PKU (16*32+ 3)/* Protection Keys for Userspace */ #define X86_FEATURE_OSPKE (16*32+ 4)/* OS Protection Keys Enable */ +#define X86_FEATURE_AVX512_VPOPCNTDQ (16*32+14)/* POPCNT for vectors of DW/QW */ #define X86_FEATURE_RDPID (16*32+ 22)/* RDPID instruction */ /* AMD-defined CPU features, CPUID level 0x80000007 (ebx), word 17 */
@@ -320,5 +321,4 @@#define X86_BUG_SWAPGS_FENCE X86_BUG(11)/* SWAPGS without input dep on GS */ #define X86_BUG_MONITOR X86_BUG(12)/* IPI required to wake up remote CPU */ #define X86_BUG_AMD_E400 X86_BUG(13)/* CPU is among the affected by Erratum 400 */ -#endif /* _ASM_X86_CPUFEATURES_H */
arch/x86/kernel/fpu/xstate.c +1 -0
@@ -78,6 +78,7 @@ void fpu__xstate_clear_all_cpu_caps(void)setup_clear_cpu_cap (X86_FEATURE_PKU );setup_clear_cpu_cap (X86_FEATURE_AVX512_4VNNIW );setup_clear_cpu_cap (X86_FEATURE_AVX512_4FMAPS ); +setup_clear_cpu_cap (X86_FEATURE_AVX512_VPOPCNTDQ ); }/*
tools/arch/x86/include/asm/cpufeatures.h +1 -0
@@ -280,6 +280,7 @@/* Intel-defined CPU features, CPUID level 0x00000007:0 (ecx), word 16 */ #define X86_FEATURE_PKU (16*32+ 3)/* Protection Keys for Userspace */ #define X86_FEATURE_OSPKE (16*32+ 4)/* OS Protection Keys Enable */ +#define X86_FEATURE_AVX512_VPOPCNTDQ (16*32+14)/* POPCNT for vectors of DW/QW */ /* AMD-defined CPU features, CPUID level 0x80000007 (ebx), word 17 */ #define X86_FEATURE_OVERFLOW_RECOV (17*32+0)/* MCA overflow recovery support */
Signature · 1 line
2.10.1
PATCH 2/2 kvm: x86: Expose Intel VPOPCNTDQ feature to guest
In reply to Piotr LucVector population count instructions for dwords and qwords are to be used in future Intel Xeon & Xeon Phi processors. The bit 14 of CPUID[level:0x07, ECX] indicates that the new instructions are supported by a processor.
The spec can be found in the Intel Software Developer Manual (SDM) or in the Instruction Set Extensions Programming Reference (ISE).
--- arch/x86/kvm/cpuid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/cpuid.c +1 -1
@@ -383,7 +383,7 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,/* cpuid 7.0.ecx*/ const u32 kvm_cpuid_7_0_ecx_x86_features = -F (AVX512VBMI ) |F (PKU ) |0 /*OSPKE*/ ; +F (AVX512VBMI ) |F (PKU ) |0 /*OSPKE*/ |F (AVX512_VPOPCNTDQ );/* cpuid 7.0.edx*/ const u32 kvm_cpuid_7_0_edx_x86_features =
Signature · 1 line
2.10.1
Paolo Bonzini
maintainerQuoted 11 lines · Piotr Luc
Hi,
This patchset adds the support for new CPUID feature bit that announces the vector population count instructions for dwords and qwords.
The path 1/2 adds new feature flags and handles clearing the feature bit in case xsave is not enabled.
The patch 2/2 enables passing the feature bit to a kvm/quemu guest.
The patchset is based on v4.10-rc3.
Thanks. I can use a topic branch for patch 1 to apply patch 2.
Regards,
Paolo
Quoted 13 lines
Regards,
PiotrPiotr Luc (2):
x86/cpufeature: AddAVX512_VPOPCNTDQfeature
kvm: x86: Expose Intel VPOPCNTDQ feature to guestarch/x86/include/asm/cpufeatures.h | 2 +- arch/x86/kernel/fpu/xstate.c | 1 + arch/x86/kvm/cpuid.c | 2 +- tools/arch/x86/include/asm/cpufeatures.h | 1 + 4 files changed, 4 insertions(+), 2 deletions(-)
Quoted 9 lines · Paolo Bonzini
Quoted 7 lines
The path 1/2 adds new feature flags and handles clearing the feature bit in
case xsave is not enabled.The patch 2/2 enables passing the feature bit to a kvm/quemu guest.
The patchset is based on v4.10-rc3.
Thanks. I can use a topic branch for patch 1 to apply patch 2.
OK, let's wait for path 1 to be picked up.
Regards,
Piotr
Quoted 4 lines
Regards,
Paolo
Re: [PATCH v1 1/2] x86/cpufeature: Add AVX512_VPOPCNTDQ feature
In reply to Piotr LucQuoted 12 lines · Piotr Luc
Vector population count instructions for dwords and qwords are to be used in future Intel Xeon & Xeon Phi processors. The bit 14 of CPUID[level:0x07, ECX] indicates that the new instructions are supported by a processor.
The spec can be found in the Intel Software Developer Manual (SDM) or in the Instruction Set Extensions Programming Reference (ISE).
Define new feature flag to enumerate the new instructions set in
/proc/cpuinfoaccording to new CPUID bit.
Clear the feature bit in case xsave is disabled.
Quoted 7 lines
Signed-off-by Piotr Luc <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Ingo Molnar <[email protected]>Cc H. Peter Anvin <[email protected]>---
Signature · 4 lines
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.tip-bot for Piotr Luc
merge bot[tip:x86/cpufeature] x86/cpufeature: Add AVX512_VPOPCNTDQ feature
In reply to Piotr Lucx86/cpufeature: Add AVX512_VPOPCNTDQ feature
Commit-ID: 06b35d93af0a5904aa832f58733be84ddbfe2e04 Gitweb: http://git.kernel.org/tip/06b35d93af0a5904aa832f58733be84ddbfe2e04 Author: Piotr Luc <[email protected]> AuthorDate: Tue, 10 Jan 2017 18:34:02 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Mon, 16 Jan 2017 20:40:53 +0100
x86/cpufeature: Add AVX512_VPOPCNTDQ feature
Vector population count instructions for dwords and qwords are going to be available in future Intel Xeon & Xeon Phi processors. Bit 14 of CPUID[level:0x07, ECX] indicates that the instructions are supported by a processor.
The specification can be found in the Intel Software Developer Manual (SDM) and in the Instruction Set Extensions Programming Reference (ISE).
Populate the feature bit and clear it when xsave is disabled.
--- arch/x86/include/asm/cpufeatures.h | 2 +- arch/x86/kernel/fpu/xstate.c | 1 + tools/arch/x86/include/asm/cpufeatures.h | 1 + 3 files changed, 3 insertions(+), 1 deletion(-)
arch/x86/include/asm/cpufeatures.h +1 -1
@@ -288,6 +288,7 @@#define X86_FEATURE_AVX512VBMI (16*32+ 1)/* AVX512 Vector Bit Manipulation instructions*/ #define X86_FEATURE_PKU (16*32+ 3)/* Protection Keys for Userspace */ #define X86_FEATURE_OSPKE (16*32+ 4)/* OS Protection Keys Enable */ +#define X86_FEATURE_AVX512_VPOPCNTDQ (16*32+14)/* POPCNT for vectors of DW/QW */ #define X86_FEATURE_RDPID (16*32+ 22)/* RDPID instruction */ /* AMD-defined CPU features, CPUID level 0x80000007 (ebx), word 17 */
@@ -320,5 +321,4 @@#define X86_BUG_SWAPGS_FENCE X86_BUG(11)/* SWAPGS without input dep on GS */ #define X86_BUG_MONITOR X86_BUG(12)/* IPI required to wake up remote CPU */ #define X86_BUG_AMD_E400 X86_BUG(13)/* CPU is among the affected by Erratum 400 */ -#endif /* _ASM_X86_CPUFEATURES_H */
arch/x86/kernel/fpu/xstate.c +1 -0
@@ -78,6 +78,7 @@ void fpu__xstate_clear_all_cpu_caps(void)setup_clear_cpu_cap (X86_FEATURE_PKU );setup_clear_cpu_cap (X86_FEATURE_AVX512_4VNNIW );setup_clear_cpu_cap (X86_FEATURE_AVX512_4FMAPS ); +setup_clear_cpu_cap (X86_FEATURE_AVX512_VPOPCNTDQ ); }/*
tools/arch/x86/include/asm/cpufeatures.h +1 -0
@@ -280,6 +280,7 @@/* Intel-defined CPU features, CPUID level 0x00000007:0 (ecx), word 16 */ #define X86_FEATURE_PKU (16*32+ 3)/* Protection Keys for Userspace */ #define X86_FEATURE_OSPKE (16*32+ 4)/* OS Protection Keys Enable */ +#define X86_FEATURE_AVX512_VPOPCNTDQ (16*32+14)/* POPCNT for vectors of DW/QW */ /* AMD-defined CPU features, CPUID level 0x80000007 (ebx), word 17 */ #define X86_FEATURE_OVERFLOW_RECOV (17*32+0)/* MCA overflow recovery support */
Paolo,
Quoted 6 lines · Paolo Bonzini
Quoted 5 lines · Piotr Luc
Hi,
This patchset adds the support for new CPUID feature bit that announces the vector population count instructions for dwords and qwords.
Quoted 8 lines
Quoted 6 lines
The path 1/2 adds new feature flags and handles clearing the feature bit in case xsave is not enabled.
The patch 2/2 enables passing the feature bit to a kvm/quemu guest.
The patchset is based on v4.10-rc3.
Thanks. I can use a topic branch for patch 1 to apply patch 2.
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/cpufeature
contains that patch now (nothing else for now):
06b35d93af0a: x86/cpufeature: Add AVX512_VPOPCNTDQ feature
So you can pull that into your tree as a base for the other one.
Thanks,
tglx
Re: [PATCH v1 2/2] kvm: x86: Expose Intel VPOPCNTDQ feature to guest
In reply to Piotr Luc2017-01-10 18:34+0100, Piotr Luc:
Quoted 17 lines
Vector population count instructions for dwords and qwords are to be used in future Intel Xeon & Xeon Phi processors. The bit 14 of CPUID[level:0x07, ECX] indicates that the new instructions are supported by a processor.
The spec can be found in the Intel Software Developer Manual (SDM) or in the Instruction Set Extensions Programming Reference (ISE).
Signed-off-by Piotr Luc <[email protected]>Cc Paolo Bonzini <[email protected]>Cc Radim Krčmář <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Ingo Molnar <[email protected]>Cc H. Peter Anvin <[email protected]>
Quoted 1 line
---
Applied on top of tglx's branch in kvm/next,
thanks to both.