Files
linux/lib/crc/arm64/crc64.h
Ard Biesheuvel e0718ed60d lib/crc: arm64: Drop unnecessary chunking logic from crc64
On arm64, kernel mode NEON executes with preemption enabled, so there is
no need to chunk the input by hand.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20260330144630.33026-8-ardb@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
2026-04-02 16:14:53 -07:00

29 lines
612 B
C

/* SPDX-License-Identifier: GPL-2.0-only */
/*
* CRC64 using ARM64 PMULL instructions
*/
#include <linux/cpufeature.h>
#include <asm/simd.h>
#include <linux/minmax.h>
#include <linux/sizes.h>
u64 crc64_nvme_arm64_c(u64 crc, const u8 *p, size_t len);
#define crc64_be_arch crc64_be_generic
static inline u64 crc64_nvme_arch(u64 crc, const u8 *p, size_t len)
{
if (len >= 128 && cpu_have_named_feature(PMULL) &&
likely(may_use_simd())) {
size_t chunk = len & ~15;
scoped_ksimd()
crc = crc64_nvme_arm64_c(crc, p, chunk);
p += chunk;
len &= 15;
}
return crc64_nvme_generic(crc, p, len);
}