* [PATCH] lib/crc: arm64: use .arch_extension to enable CRC and crypto
@ 2026-11-05 15:41 Emanuele Rocca
2026-11-05 19:42 ` Eric Biggers
0 siblings, 1 reply; 2+ messages in thread
From: Emanuele Rocca @ 2026-11-05 15:41 UTC (permalink / raw)
To: Eric Biggers; +Cc: Ard Biesheuvel, linux-crypto, linux-kernel
Instead of using ".cpu generic+crc+crypto", use ".arch_extension crc" and
".arch_extension crypto" to enable the required instructions.
The ".cpu generic+crc+crypto" directive replaces the assembler's current
feature set with generic+crc+crypto, dropping any other features that were
previously enabled, for example by -march or by a toolchain configured with
--with-arch=armv9-a. In contrast, ".arch_extension" enables the requested
extensions while preserving the current feature set.
This is not a functional change: crc32-core.S only uses base A64
instructions plus CRC32 and PMULL, which remain available, and BTI landing
pads are emitted as HINT instructions. However, using .arch_extension
avoids the pitfall of silently disabling features. See commit 9142c2f8f84b
("octeontx2: use arch_extension to enable LSE").
Signed-off-by: Emanuele Rocca <emanuele.rocca@arm.com>
---
lib/crc/arm64/crc32-core.S | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/crc/arm64/crc32-core.S b/lib/crc/arm64/crc32-core.S
index 49d02cc485b3..0877d07ed1bf 100644
--- a/lib/crc/arm64/crc32-core.S
+++ b/lib/crc/arm64/crc32-core.S
@@ -11,7 +11,8 @@
#include <linux/linkage.h>
#include <asm/assembler.h>
- .cpu generic+crc+crypto
+ .arch_extension crc
+ .arch_extension crypto
.macro bitle, reg
.endm
--
2.55.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] lib/crc: arm64: use .arch_extension to enable CRC and crypto
2026-11-05 15:41 [PATCH] lib/crc: arm64: use .arch_extension to enable CRC and crypto Emanuele Rocca
@ 2026-11-05 19:42 ` Eric Biggers
0 siblings, 0 replies; 2+ messages in thread
From: Eric Biggers @ 2026-11-05 19:42 UTC (permalink / raw)
To: Emanuele Rocca; +Cc: Ard Biesheuvel, linux-crypto, linux-kernel
On Thu, Nov 05, 2026 at 03:41:45PM +0000, Emanuele Rocca wrote:
> Instead of using ".cpu generic+crc+crypto", use ".arch_extension crc" and
> ".arch_extension crypto" to enable the required instructions.
>
> The ".cpu generic+crc+crypto" directive replaces the assembler's current
> feature set with generic+crc+crypto, dropping any other features that were
> previously enabled, for example by -march or by a toolchain configured with
> --with-arch=armv9-a. In contrast, ".arch_extension" enables the requested
> extensions while preserving the current feature set.
>
> This is not a functional change: crc32-core.S only uses base A64
> instructions plus CRC32 and PMULL, which remain available, and BTI landing
> pads are emitted as HINT instructions. However, using .arch_extension
> avoids the pitfall of silently disabling features. See commit 9142c2f8f84b
> ("octeontx2: use arch_extension to enable LSE").
>
> Signed-off-by: Emanuele Rocca <emanuele.rocca@arm.com>
Thanks. Just to confirm, all supported versions of binutils and clang
support this? (As per Documentation/process/changes.rst, the kernel
currently supports binutils 2.30 and later, and clang 17.0.1 and later.)
A lot of the arm64 crypto code uses ".arch armv8-a+crypto". Should
those be replaced with ".arch_extension crypto" for the same reason?
- Eric
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-05 19:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-05 15:41 [PATCH] lib/crc: arm64: use .arch_extension to enable CRC and crypto Emanuele Rocca
2026-11-05 19:42 ` Eric Biggers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox