From: Eric Biggers Date: Wed, 1 Apr 2026 00:05:42 +0000 (-0700) Subject: lib/crypto: arm64/gf128hash: Remove obsolete chunking logic X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d3a5cc5c9237cd6ffd1f84c1af306e315cf0cf3d;p=thirdparty%2Fkernel%2Flinux.git lib/crypto: arm64/gf128hash: Remove obsolete chunking logic Since commit aefbab8e77eb ("arm64: fpsimd: Preserve/restore kernel mode NEON at context switch"), kernel-mode NEON sections have been preemptible on arm64. And since commit 7dadeaa6e851 ("sched: Further restrict the preemption modes"), voluntary preemption is no longer supported on arm64 either. Therefore, there's no longer any need to limit the length of kernel-mode NEON sections on arm64. Simplify the GHASH and POLYVAL code accordingly. Reviewed-by: Ard Biesheuvel Link: https://lore.kernel.org/r/20260401000548.133151-4-ebiggers@kernel.org Signed-off-by: Eric Biggers --- diff --git a/lib/crypto/arm64/gf128hash.h b/lib/crypto/arm64/gf128hash.h index b2c85585b7583..1d1179f87f8d1 100644 --- a/lib/crypto/arm64/gf128hash.h +++ b/lib/crypto/arm64/gf128hash.h @@ -89,16 +89,8 @@ static void ghash_blocks_arch(struct polyval_elem *acc, const u8 *data, size_t nblocks) { if (static_branch_likely(&have_asimd) && may_use_simd()) { - do { - /* Allow rescheduling every 4 KiB. */ - size_t n = min_t(size_t, nblocks, - 4096 / GHASH_BLOCK_SIZE); - - scoped_ksimd() - pmull_ghash_update_p8(n, acc, data, &key->h); - data += n * GHASH_BLOCK_SIZE; - nblocks -= n; - } while (nblocks); + scoped_ksimd() + pmull_ghash_update_p8(nblocks, acc, data, &key->h); } else { ghash_blocks_generic(acc, &key->h, data, nblocks); } @@ -110,16 +102,8 @@ static void polyval_blocks_arch(struct polyval_elem *acc, const u8 *data, size_t nblocks) { if (static_branch_likely(&have_pmull) && may_use_simd()) { - do { - /* Allow rescheduling every 4 KiB. */ - size_t n = min_t(size_t, nblocks, - 4096 / POLYVAL_BLOCK_SIZE); - - scoped_ksimd() - polyval_blocks_pmull(acc, key, data, n); - data += n * POLYVAL_BLOCK_SIZE; - nblocks -= n; - } while (nblocks); + scoped_ksimd() + polyval_blocks_pmull(acc, key, data, nblocks); } else { polyval_blocks_generic(acc, &key->h_powers[NUM_H_POWERS - 1], data, nblocks);