All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: linux-crypto@vger.kernel.org
Cc: Ard Biesheuvel <ardb@kernel.org>,
	"Jason A . Donenfeld" <Jason@zx2c4.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	x86@kernel.org, Eric Biggers <ebiggers@kernel.org>
Subject: [PATCH] lib/crypto: x86/nh: Remove unnecessary check for SSE2 support on x86_64
Date: Wed,  4 Nov 2026 20:37:10 -0800	[thread overview]
Message-ID: <20261105043710.310742-1-ebiggers@kernel.org> (raw)

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


             reply	other threads:[~2026-11-05  4:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05  4:37 Eric Biggers [this message]
2026-11-07 22:04 ` [PATCH] lib/crypto: x86/nh: Remove unnecessary check for SSE2 support on x86_64 Eric Biggers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261105043710.310742-1-ebiggers@kernel.org \
    --to=ebiggers@kernel.org \
    --cc=Jason@zx2c4.com \
    --cc=ardb@kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.