Skip to contentSkip to conversation

x86/crc: drop checks of CONFIG_AS_VPCLMULQDQ

PATCH Applied Eric Biggers 1 participant 2 messages May 31, 2025 – Jun 8, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/crc: drop checks of CONFIG_AS_VPCLMULQDQ

From: Eric Biggers <[email protected]>

Now that the minimum binutils version supports VPCLMULQDQ (and the minimum clang version does too), there is no need to check for assembler support before compiling code that uses these instructions.

---

I'd be glad to apply this to the crc tree. Arnd, let me know if you'd like to instead go with a patch that handles all of arch/x86/ at the same time. That would be fine with me too.

 arch/x86/lib/crc-pclmul-template.S | 7 -------
 arch/x86/lib/crc-pclmul-template.h | 3 +--
 2 files changed, 1 insertion(+), 9 deletions(-)
arch/x86/lib/crc-pclmul-template.S +0 -7
index ae0b6144c503c..a02f7dc8053e0 100644
@@ -559,11 +559,10 @@
 	pop		CONSTS_PTR
 #endif
 	RET
 .endm
 
-#ifdef CONFIG_AS_VPCLMULQDQ
 #define DEFINE_CRC_PCLMUL_FUNCS(prefix, bits, lsb)			\
 SYM_FUNC_START(prefix##_pclmul_sse);					\
 	_crc_pclmul	n=bits, lsb_crc=lsb, vl=16, avx_level=0;	\
 SYM_FUNC_END(prefix##_pclmul_sse);					\
 									\
@@ -572,11 +571,5 @@ SYM_FUNC_START(prefix##_vpclmul_avx2);					\
 SYM_FUNC_END(prefix##_vpclmul_avx2);					\
 									\
 SYM_FUNC_START(prefix##_vpclmul_avx512);				\
 	_crc_pclmul	n=bits, lsb_crc=lsb, vl=64, avx_level=512;	\
 SYM_FUNC_END(prefix##_vpclmul_avx512);
-#else
-#define DEFINE_CRC_PCLMUL_FUNCS(prefix, bits, lsb)			\
-SYM_FUNC_START(prefix##_pclmul_sse);					\
-	_crc_pclmul	n=bits, lsb_crc=lsb, vl=16, avx_level=0;	\
-SYM_FUNC_END(prefix##_pclmul_sse);
-#endif // !CONFIG_AS_VPCLMULQDQ
arch/x86/lib/crc-pclmul-template.h +1 -2
index c5b3bfe11d8da..51cba520a7dbd 100644
@@ -25,12 +25,11 @@ crc_t prefix##_vpclmul_avx512(crc_t crc, const u8 *p, size_t len,	\
 			      const void *consts_ptr);			\
 DEFINE_STATIC_CALL(prefix##_pclmul, prefix##_pclmul_sse)
 
 #define INIT_CRC_PCLMUL(prefix)						\
 do {									\
-	if (IS_ENABLED(CONFIG_AS_VPCLMULQDQ) &&				\
-	    boot_cpu_has(X86_FEATURE_VPCLMULQDQ) &&			\
+	if (boot_cpu_has(X86_FEATURE_VPCLMULQDQ) &&			\
 	    boot_cpu_has(X86_FEATURE_AVX2) &&				\
 	    cpu_has_xfeatures(XFEATURE_MASK_YMM, NULL)) {		\
 		if (boot_cpu_has(X86_FEATURE_AVX512BW) &&		\
 		    boot_cpu_has(X86_FEATURE_AVX512VL) &&		\
 		    !boot_cpu_has(X86_FEATURE_PREFER_YMM) &&		\
Signature · 1 line
2.49.0
author Applied
#1 lore raw
Quoted 9 lines · Eric Biggers

From: Eric Biggers <[email protected]>

Now that the minimum binutils version supports VPCLMULQDQ (and the minimum clang version does too), there is no need to check for assembler support before compiling code that uses these instructions.

---

Quoted 7 lines

I'd be glad to apply this to the crc tree. Arnd, let me know if you'd like to instead go with a patch that handles all of arch/x86/ at the same time. That would be fine with me too.

 arch/x86/lib/crc-pclmul-template.S | 7 -------
 arch/x86/lib/crc-pclmul-template.h | 3 +--
 2 files changed, 1 insertion(+), 9 deletions(-)

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git/log/?h=crc-next

- Eric