Linux cryptographic layer development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Shreesh Adiga" <16567adigashreesh@gmail.com>,
	"Eric Biggers" <ebiggers@kernel.org>,
	"Ard Biesheuvel" <ardb@kernel.org>,
	"Demian Shulhan" <demyansh@gmail.com>
Cc: linux-crypto@vger.kernel.org
Subject: Re: [PATCH v3] lib/crc: arm64: Add NEON PMULL+EOR3 crc64_nvme implementation
Date: Fri, 27 Nov 2026 17:10:46 +0000	[thread overview]
Message-ID: <sashiko-outbox-237967@kernel.org> (raw)
In-Reply-To: <20261127165747.512950-1-16567adigashreesh@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] lib/crc: arm64: eor3() fails to assemble on binutils 2.40 and
  earlier
--

commit 54e29282d614c667430bde2ef55715d4cb4f1a05
Author: Shreesh Adiga <16567adigashreesh@gmail.com>

lib/crc: arm64: Add NEON PMULL+EOR3 crc64_nvme implementation

This commit adds an arm64 NEON PMULL+EOR3 implementation of crc64_nvme for
processors with the SHA3 extension and dispatches to it via a static branch.

> diff --git a/lib/crc/arm64/crc64-neon.h b/lib/crc/arm64/crc64-neon.h
> index d872f4d4e2e78..40f37ff0407c8 100644
> --- a/lib/crc/arm64/crc64-neon.h
> +++ b/lib/crc/arm64/crc64-neon.h
> @@ -32,3 +32,18 @@ static inline uint64x2_t pmull64_hi_lo(uint64x2_t a, uint64x2_t b)
>  {
>  	return pmull64(vextq_u64(a, a, 1), b);
>  }
> +
> +/*
> + * Use inline asm instead of veor3q_u64() intrinsic: GCC 8.1 doesn't provide
> + * that, and the target("+sha3") attribute it needs prevents some GCC versions
> + * from inlining the PMULL helpers. This follows lib/raid/xor/arm64/xor-eor3.c.
> + */
> +static inline uint64x2_t eor3(uint64x2_t p, uint64x2_t q, uint64x2_t r)
> +{
> +	uint64x2_t res;
> +
> +	asm(".arch_extension sha3\n"
> +	    "eor3 %0.16b, %1.16b, %2.16b, %3.16b"
> +	    : "=w"(res) : "w"(p), "w"(q), "w"(r));
> +	return res;
> +}

[Severity: High]
Does eor3() fail to assemble on binutils 2.40 and earlier?

lib/crc/Makefile compiles crc64-neon.o with -march=armv8-a+crypto, so the
compiler emits .arch armv8-a+crypto and sets the assembler base architecture
to armv8-a.  In GNU binutils 2.40 and earlier, the sha3 extension and eor3
require armv8.2-a or later, unlike lib/raid/xor/arm64/xor-eor3.c which
prefixes .arch_extension sha3 with ARM64_ASM_PREAMBLE:

lib/raid/xor/arm64/xor-eor3.c:eor3() {
	asm(ARM64_ASM_PREAMBLE ".arch_extension sha3\n"
	    "eor3 %0.16b, %1.16b, %2.16b, %3.16b"
	    : "=w"(res) : "w"(p), "w"(q), "w"(r));
}

With the base architecture left at armv8-a, GNU as 2.40 and earlier reject
eor3 with "Error: selected processor does not support `eor3'".  Note that
selecting armv8.2-a or later via .arch (or ARM64_ASM_PREAMBLE) also resets
active extensions, so crypto must remain enabled (for example via
".arch armv8.2-a+crypto+sha3\n") for subsequent inlined pmull and pmull2
instructions in crc64_nvme_neon_pmull_eor3().

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261127165747.512950-1-16567adigashreesh@gmail.com?part=1

      reply	other threads:[~2026-11-27 17:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 16:57 [PATCH v3] lib/crc: arm64: Add NEON PMULL+EOR3 crc64_nvme implementation Shreesh Adiga
2026-11-27 17:10 ` sashiko-bot [this message]

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=sashiko-outbox-237967@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=16567adigashreesh@gmail.com \
    --cc=ardb@kernel.org \
    --cc=demyansh@gmail.com \
    --cc=ebiggers@kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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