linux/lib/crc
Ard Biesheuvel e3babebfb8 lib/crc: arm: Enable arm64's NEON intrinsics implementation of crc64
Tweak the NEON intrinsics crc64 code written for arm64 so it can be
built for 32-bit ARM as well. The only workaround needed is to provide
alternatives for vmull_p64() and vmull_high_p64() on Clang, which only
defines those when building for the AArch64 or arm64ec ISA. Use the same
helpers for GCC too, to avoid doubling the size of the test/validation
matrix.

KUnit benchmark results (Cortex-A53 @ 1 Ghz)

Before:

   # crc64_nvme_benchmark: len=1: 35 MB/s
   # crc64_nvme_benchmark: len=16: 78 MB/s
   # crc64_nvme_benchmark: len=64: 87 MB/s
   # crc64_nvme_benchmark: len=127: 88 MB/s
   # crc64_nvme_benchmark: len=128: 88 MB/s
   # crc64_nvme_benchmark: len=200: 89 MB/s
   # crc64_nvme_benchmark: len=256: 89 MB/s
   # crc64_nvme_benchmark: len=511: 89 MB/s
   # crc64_nvme_benchmark: len=512: 89 MB/s
   # crc64_nvme_benchmark: len=1024: 90 MB/s
   # crc64_nvme_benchmark: len=3173: 90 MB/s
   # crc64_nvme_benchmark: len=4096: 90 MB/s
   # crc64_nvme_benchmark: len=16384: 90 MB/s

After:

   # crc64_nvme_benchmark: len=1: 32 MB/s
   # crc64_nvme_benchmark: len=16: 76 MB/s
   # crc64_nvme_benchmark: len=64: 71 MB/s
   # crc64_nvme_benchmark: len=127: 88 MB/s
   # crc64_nvme_benchmark: len=128: 618 MB/s
   # crc64_nvme_benchmark: len=200: 542 MB/s
   # crc64_nvme_benchmark: len=256: 920 MB/s
   # crc64_nvme_benchmark: len=511: 836 MB/s
   # crc64_nvme_benchmark: len=512: 1261 MB/s
   # crc64_nvme_benchmark: len=1024: 1531 MB/s
   # crc64_nvme_benchmark: len=3173: 1731 MB/s
   # crc64_nvme_benchmark: len=4096: 1851 MB/s
   # crc64_nvme_benchmark: len=16384: 1858 MB/s

Don't bother with big-endian, as it doesn't work correctly on Clang, and
is barely used these days.

Note that ARM disables preemption and softirq processing when using
kernel mode SIMD, so take care not to hog the CPU for too long.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://patch.msgid.link/20260422171655.3437334-15-ardb+git@google.com
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
2026-05-28 13:14:23 -07:00
..
arm lib/crc: arm: Enable arm64's NEON intrinsics implementation of crc64 2026-05-28 13:14:23 -07:00
arm64 lib/crc: Turn NEON intrinsics crc64 implementation into common code 2026-05-28 13:14:22 -07:00
loongarch lib/crc: Drop inline from all *_mod_init_arch() functions 2025-08-15 19:06:08 -07:00
mips lib/crc: Drop inline from all *_mod_init_arch() functions 2025-08-15 19:06:08 -07:00
powerpc lib/crc: Drop inline from all *_mod_init_arch() functions 2025-08-15 19:06:08 -07:00
riscv lib/crc: riscv: Migrate optimized CRC code into lib/crc/ 2025-06-30 09:31:57 -07:00
s390 lib/crc: s390: Migrate optimized CRC code into lib/crc/ 2025-06-30 09:31:57 -07:00
sparc lib/crc: Drop inline from all *_mod_init_arch() functions 2025-08-15 19:06:08 -07:00
tests lib/crc: tests: Make crc_kunit test only the enabled CRC variants 2026-03-09 13:29:46 -07:00
x86 lib/crc: Drop inline from all *_mod_init_arch() functions 2025-08-15 19:06:08 -07:00
.gitignore
.kunitconfig lib/crc: tests: Add a .kunitconfig file 2026-03-09 13:29:47 -07:00
crc-ccitt.c lib/crc: Explicitly include <linux/export.h> 2025-06-30 09:31:57 -07:00
crc-itu-t.c lib/crc: Explicitly include <linux/export.h> 2025-06-30 09:31:57 -07:00
crc-t10dif-main.c lib/crc: Explicitly include <linux/export.h> 2025-06-30 09:31:57 -07:00
crc4.c lib/crc: Explicitly include <linux/export.h> 2025-06-30 09:31:57 -07:00
crc7.c lib/crc: Explicitly include <linux/export.h> 2025-06-30 09:31:57 -07:00
crc8.c lib/crc: Explicitly include <linux/export.h> 2025-06-30 09:31:57 -07:00
crc16.c lib/crc: Explicitly include <linux/export.h> 2025-06-30 09:31:57 -07:00
crc32-main.c lib/crc: Explicitly include <linux/export.h> 2025-06-30 09:31:57 -07:00
crc64-main.c lib/crc: Explicitly include <linux/export.h> 2025-06-30 09:31:57 -07:00
crc64-neon.c lib/crc: Turn NEON intrinsics crc64 implementation into common code 2026-05-28 13:14:22 -07:00
gen_crc32table.c
gen_crc64table.c
Kconfig lib/crc: arm: Enable arm64's NEON intrinsics implementation of crc64 2026-05-28 13:14:23 -07:00
Makefile lib/crc: arm: Enable arm64's NEON intrinsics implementation of crc64 2026-05-28 13:14:23 -07:00