* [PATCH] lib/crypto: x86/nh: Remove unnecessary check for SSE2 support on x86_64
@ 2026-11-05 4:37 Eric Biggers
2026-11-07 22:04 ` Eric Biggers
0 siblings, 1 reply; 2+ messages in thread
From: Eric Biggers @ 2026-11-05 4:37 UTC (permalink / raw)
To: linux-crypto
Cc: Ard Biesheuvel, Jason A . Donenfeld, Herbert Xu, x86,
Eric Biggers
Remove the unnecessary check for X86_FEATURE_XMM2 (and the have_sse2
static key it controls) from the x86_64 optimized NH code.
This code is 64-bit only, and x86_64 kernels require X86_FEATURE_XMM2.
(See X86_REQUIRED_FEATURE_XMM2.)
Also replace <linux/static_call.h> with <linux/jump_label.h>, since this
file uses static keys, not static calls.
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---
lib/crypto/x86/nh.h | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/lib/crypto/x86/nh.h b/lib/crypto/x86/nh.h
index 342636dcb750..3972c7ae28fd 100644
--- a/lib/crypto/x86/nh.h
+++ b/lib/crypto/x86/nh.h
@@ -6,9 +6,8 @@
*/
#include <asm/fpu/api.h>
-#include <linux/static_call.h>
+#include <linux/jump_label.h>
-static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_sse2);
static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_avx2);
asmlinkage void nh_sse2(const u32 *key, const u8 *message, size_t message_len,
@@ -19,8 +18,7 @@ asmlinkage void nh_avx2(const u32 *key, const u8 *message, size_t message_len,
static bool nh_arch(const u32 *key, const u8 *message, size_t message_len,
__le64 hash[NH_NUM_PASSES])
{
- if (message_len >= 64 && static_branch_likely(&have_sse2) &&
- irq_fpu_usable()) {
+ if (message_len >= 64 && irq_fpu_usable()) {
kernel_fpu_begin();
if (static_branch_likely(&have_avx2))
nh_avx2(key, message, message_len, hash);
@@ -35,9 +33,6 @@ static bool nh_arch(const u32 *key, const u8 *message, size_t message_len,
#define nh_mod_init_arch nh_mod_init_arch
static void nh_mod_init_arch(void)
{
- if (boot_cpu_has(X86_FEATURE_XMM2)) {
- static_branch_enable(&have_sse2);
- if (boot_cpu_has(X86_FEATURE_AVX2))
- static_branch_enable(&have_avx2);
- }
+ if (boot_cpu_has(X86_FEATURE_AVX2))
+ static_branch_enable(&have_avx2);
}
base-commit: 9fbbbaefd5f95551da18426c200cf41e1b4255a1
--
2.56.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] lib/crypto: x86/nh: Remove unnecessary check for SSE2 support on x86_64
2026-11-05 4:37 [PATCH] lib/crypto: x86/nh: Remove unnecessary check for SSE2 support on x86_64 Eric Biggers
@ 2026-11-07 22:04 ` Eric Biggers
0 siblings, 0 replies; 2+ messages in thread
From: Eric Biggers @ 2026-11-07 22:04 UTC (permalink / raw)
To: linux-crypto; +Cc: Ard Biesheuvel, Jason A . Donenfeld, Herbert Xu, x86
On Wed, Nov 04, 2026 at 08:37:10PM -0800, Eric Biggers wrote:
> Remove the unnecessary check for X86_FEATURE_XMM2 (and the have_sse2
> static key it controls) from the x86_64 optimized NH code.
>
> This code is 64-bit only, and x86_64 kernels require X86_FEATURE_XMM2.
> (See X86_REQUIRED_FEATURE_XMM2.)
>
> Also replace <linux/static_call.h> with <linux/jump_label.h>, since this
> file uses static keys, not static calls.
>
> Signed-off-by: Eric Biggers <ebiggers@kernel.org>
> ---
> lib/crypto/x86/nh.h | 13 ++++---------
> 1 file changed, 4 insertions(+), 9 deletions(-)
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git/log/?h=libcrypto-next
- Eric
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-07 22:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-05 4:37 [PATCH] lib/crypto: x86/nh: Remove unnecessary check for SSE2 support on x86_64 Eric Biggers
2026-11-07 22:04 ` Eric Biggers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox