aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64/crypto/aes-ce-ccm-glue.c
diff options
context:
space:
mode:
authorArd Biesheuvel <ardb@kernel.org>2021-08-27 09:03:39 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2021-09-17 11:05:10 +0800
commit36a916af641dc71ef7d4b98417bf4019ddeb4ebe (patch)
tree069d49cbb87cf43294ea53262af93902798d9026 /arch/arm64/crypto/aes-ce-ccm-glue.c
parentcrypto: arm64/aes-ce - stop using SIMD helper for skciphers (diff)
downloadlinux-dev-36a916af641dc71ef7d4b98417bf4019ddeb4ebe.tar.xz
linux-dev-36a916af641dc71ef7d4b98417bf4019ddeb4ebe.zip
crypto: arm64/aes-ccm - yield NEON when processing auth-only data
In SIMD accelerated crypto drivers, we typically yield the SIMD unit after processing 4 KiB of input, to avoid scheduling blackouts caused by the fact that claiming the SIMD unit disables preemption as well as softirq processing. The arm64 CCM driver does this implicitly for the ciphertext, due to the fact that the skcipher API never processes more than a single page at a time. However, the scatterwalk performed by this driver when processing the authenticate-only data will keep the SIMD unit occupied until it completes. So cap the scatterwalk steps to 4 KiB. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'arch/arm64/crypto/aes-ce-ccm-glue.c')
-rw-r--r--arch/arm64/crypto/aes-ce-ccm-glue.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/arm64/crypto/aes-ce-ccm-glue.c b/arch/arm64/crypto/aes-ce-ccm-glue.c
index f6d19b0dc893..fe9c837ac4b9 100644
--- a/arch/arm64/crypto/aes-ce-ccm-glue.c
+++ b/arch/arm64/crypto/aes-ce-ccm-glue.c
@@ -161,6 +161,7 @@ static void ccm_calculate_auth_mac(struct aead_request *req, u8 mac[])
scatterwalk_start(&walk, sg_next(walk.sg));
n = scatterwalk_clamp(&walk, len);
}
+ n = min_t(u32, n, SZ_4K); /* yield NEON at least every 4k */
p = scatterwalk_map(&walk);
ccm_update_mac(ctx, mac, p, n, &macp);
len -= n;