From: Eric Biggers <ebiggers@kernel.org>
To: AlanSong-oc <AlanSong-oc@zhaoxin.com>
Cc: herbert@gondor.apana.org.au, Jason@zx2c4.com, ardb@kernel.org,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
CobeChen@zhaoxin.com, TonyWWang-oc@zhaoxin.com,
YunShen@zhaoxin.com, GeorgeXue@zhaoxin.com,
LeoLiu-oc@zhaoxin.com, HansHu@zhaoxin.com, x86@kernel.org
Subject: Re: [PATCH v2 1/2] lib/crypto: x86/sha1: PHE Extensions optimized SHA1 transform function
Date: Mon, 12 Jan 2026 11:34:45 -0800 [thread overview]
Message-ID: <20260112193445.GA1952@sol> (raw)
In-Reply-To: <7aa1603d-6520-414a-a2a1-3a5289724814@zhaoxin.com>
On Mon, Jan 12, 2026 at 05:12:01PM +0800, AlanSong-oc wrote:
> > Is it supported in both 32-bit and 64-bit modes? Your patch doesn't
> > check for CONFIG_64BIT. Should it? New optimized assembly code
> > generally should be 64-bit only.
>
> The XSHA1 and XSHA256 are supported in both 32-bit and 64-bit modes.
> Since newly optimized assembly code is typically 64-bit only, and XSHA1
> and XSHA256 fully support 64-bit mode, an explicit CONFIG_64BIT check
> should not required.
Right, all the x86-optimized SHA-1 and SHA-256 code is already 64-bit
specific, due to CONFIG_CRYPTO_LIB_SHA1_ARCH and
CONFIG_CRYPTO_LIB_SHA256_ARCH being enabled only when CONFIG_x86_64=y.
So there's no need to check for 64-bit again.
> > What is the difference between X86_FEATURE_PHE and X86_FEATURE_PHE_EN,
> > and why are both needed?
>
> The X86_FEATURE_PHE indicates the presence of the XSHA1 and XSHA256
> instructions, whereas the X86_FEATURE_PHE_EN indicates that these
> instructions are enabled for normal use.
I still don't understand the difference.
If you look at the other CPU feature flags, like X86_FEATURE_SHA_NI for
example, there's just a single flag for the feature. We don't have
X86_FEATURE_SHA_NI and X86_FEATURE_SHA_NI_EN. If the CPU supports the
feature but the kernel decides it can't or shouldn't be used for
whatever reason, the kernel just doesn't set the flag. There's no
separate flag that tracks the CPU support independently.
Why can't the PHE flag work the same way?
- Eric
next prev parent reply other threads:[~2026-01-12 19:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-19 8:03 [PATCH v2 0/2] lib/crypto: x86/sha: Add PHE Extensions support AlanSong-oc
2025-12-19 8:03 ` [PATCH v2 1/2] lib/crypto: x86/sha1: PHE Extensions optimized SHA1 transform function AlanSong-oc
2025-12-19 18:18 ` Eric Biggers
2026-01-12 9:12 ` AlanSong-oc
2026-01-12 19:34 ` Eric Biggers [this message]
2026-01-15 7:47 ` AlanSong-oc
2025-12-19 8:03 ` [PATCH v2 2/2] lib/crypto: x86/sha256: PHE Extensions optimized SHA256 " AlanSong-oc
2025-12-19 18:33 ` [PATCH v2 0/2] lib/crypto: x86/sha: Add PHE Extensions support Eric Biggers
2026-01-12 9:12 ` AlanSong-oc
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=20260112193445.GA1952@sol \
--to=ebiggers@kernel.org \
--cc=AlanSong-oc@zhaoxin.com \
--cc=CobeChen@zhaoxin.com \
--cc=GeorgeXue@zhaoxin.com \
--cc=HansHu@zhaoxin.com \
--cc=Jason@zx2c4.com \
--cc=LeoLiu-oc@zhaoxin.com \
--cc=TonyWWang-oc@zhaoxin.com \
--cc=YunShen@zhaoxin.com \
--cc=ardb@kernel.org \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox