[PATCH] crypto: riscv - use real assembler for vector crypto extensions

Eric Biggers ebiggers at kernel.org
Wed Dec 20 07:31:55 PST 2023


On Wed, Dec 20, 2023 at 08:52:45AM +0100, Christoph Müllner wrote:
> On Wed, Dec 20, 2023 at 7:57 AM Eric Biggers <ebiggers at kernel.org> wrote:
> >
> > From: Eric Biggers <ebiggers at google.com>
> >
> > LLVM main and binutils master now both fully support v1.0 of the RISC-V
> > vector crypto extensions.  Therefore, delete riscv.pm and use the real
> > assembler mnemonics for the vector crypto instructions.
> >
> > Signed-off-by: Eric Biggers <ebiggers at google.com>
> 
> For OpenSSL, these hand-written assembler functions were mainly written
> to make OpenSSL's CI builds happy, which run on the latest Ubuntu LTS.
> 
> I'm happy to see these functions disappear, but I wonder if there is a
> guideline or best-practice for assembly optimizations like this.
>
> The upcoming Binutils release (presumably available in Jan 24) will
> (presumably) be available in Ubuntu 24.10.
> And until then most users won't be even building the code.
>
> 
> 
> Reviewed-by: Christoph Müllner <christoph.muellner at vrull.eu>

As far as I can tell, kernel code usually just relies on assembler support for
new instructions.  See e.g. CONFIG_AS_AVX512 for x86's AVX-512.  You can't build
the AVX-512 optimized crypto code unless your assembler supports AVX-512.
Beyond that observation, I don't think there's a specific guideline.

The kernel doesn't have CI on Ubuntu, at least not officially for upstream.
Either way, it's possible to install newer LLVM and binutils on old Linux
distros anyway.  Also, the RISC-V crypto code won't make it into v6.8 since it
depends on a separate patch that adds support for kernel mode vector.  It will
be merged into v6.9 at the earliest.

So my vote is to just rely on the LLVM and binutils support.

- Eric



More information about the linux-riscv mailing list