Re: [PATCH] lib/crc: Add 4-way folding in NEON crc64_nvme implementation

From: Eric Biggers

Date: Sat Nov 21 2026 - 15:46:37 EST


On Wed, Nov 18, 2026 at 09:31:00PM +0530, Shreesh Adiga wrote:
> The partial block stage is enabled only for AArch64 as it needs the
> 128-bit TBL instruction not available in AArch32.
> Modified the loop dispatch on AArch64 to allow any len >= 128 rather
> than just multiple of 16 bytes.

Note that an AArch32 implementation of fold_partial_block() is possible,
e.g. vqtbl1q_u8() could be replaced with two vtbl2_u8(). Normally I'd
consider an AArch32 specific optimization not worth including, but it
might be worthwhile here since it would avoid divergence in the code due
to the following arch-specific precondition:

/* Assumes len >= 64. AArch32 also assumes len is multiple of 16. */

> lib/crc/arm64/crc64-neon.h | 15 +++---
> lib/crc/arm64/crc64.h | 18 ++++---
> lib/crc/crc64-neon.c | 96 +++++++++++++++++++++++++++++++++++---
> 3 files changed, 110 insertions(+), 19 deletions(-)

Anyway, I've applied this patch to
https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git/log/?h=crc-next

In general I'd prefer better comments in the code though, especially
documenting nonobvious decisions like why pmull and pmull2 are accessed
using inline asm instead of intrinsics.

So if you'd like to do a follow-up patch, it could be worthwhile to
address the above two issues.

Thanks,

- Eric