mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: Emanuele Rocca <emanuele.rocca@arm.com>,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] lib/crc: arm64: use .arch_extension to enable CRC and crypto
Date: Sat, 7 Nov 2026 13:37:16 -0800	[thread overview]
Message-ID: <20261107213716.GC137269@quark> (raw)
In-Reply-To: <68e24de8-0c94-473b-b2a1-47b9b79eb974@app.fastmail.com>

On Fri, Nov 06, 2026 at 09:57:01AM +0100, Ard Biesheuvel wrote:
> Hello Emanuele,
> 
> On Thu, 5 Nov 2026, at 16:41, 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").
> >
> 
> I don't mind the patch, but I will point out that issues such as these can
> never occur in .S sources. The emitted instructions are always the same, and
> the only reason we need the .arch is so that the assembler permits the use
> of the special ones.
> 
> Commit 9142c2f8f84b is different because it uses .arch in inline asm, where
> it switches the assembler into a different mode behind the back of the
> compiler, leading it to reject instructions generated by the compiler.
> 

Thanks.  Emanuele, could you maybe note that in the commit message?

Also, this patch is not complete even for lib/crc/arm64/, since
lib/crc/arm64/crc-t10dif-core.S still uses "armv8-a+crypto".  If we're
bothering with this, I would suggest just taking care of both
crc32-core.S and crc-t10dif-core.S in one patch.  (The crypto files I
mentioned before should be a different patch.)

- Eric

      reply	other threads:[~2026-11-07 21:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05 15:41 Emanuele Rocca
2026-11-05 19:42 ` Eric Biggers
2026-11-06  8:16   ` Emanuele Rocca
2026-11-06  8:57 ` Ard Biesheuvel
2026-11-07 21:37   ` Eric Biggers [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=20261107213716.GC137269@quark \
    --to=ebiggers@kernel.org \
    --cc=ardb@kernel.org \
    --cc=emanuele.rocca@arm.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.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

all inboxes | Powered by JetHome®