mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
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>
29 lines
612 B
C
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);
|
|
}
|