aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2017-07-24 06:28:06 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2017-08-03 21:27:16 -0400
commit2dde374e1ff0663ca46b343949c242959028f976 (patch)
treea6b9fc1f0a3a7f6be7ace44e3dcced23ccf194a9
parent6d6254d728a2e696aa697b4b44cb7736851f62e3 (diff)
crypto: arm64/crct10dif - add non-SIMD generic fallback
The arm64 kernel will shortly disallow nested kernel mode NEON, so add a fallback to scalar C code that can be invoked in that case. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--arch/arm64/crypto/crct10dif-ce-glue.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/arch/arm64/crypto/crct10dif-ce-glue.c b/arch/arm64/crypto/crct10dif-ce-glue.c
index 60cb590c2590..96f0cae4a022 100644
--- a/arch/arm64/crypto/crct10dif-ce-glue.c
+++ b/arch/arm64/crypto/crct10dif-ce-glue.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Accelerated CRC-T10DIF using arm64 NEON and Crypto Extensions instructions 2 * Accelerated CRC-T10DIF using arm64 NEON and Crypto Extensions instructions
3 * 3 *
4 * Copyright (C) 2016 Linaro Ltd <ard.biesheuvel@linaro.org> 4 * Copyright (C) 2016 - 2017 Linaro Ltd <ard.biesheuvel@linaro.org>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
@@ -18,6 +18,7 @@
18#include <crypto/internal/hash.h> 18#include <crypto/internal/hash.h>
19 19
20#include <asm/neon.h> 20#include <asm/neon.h>
21#include <asm/simd.h>
21 22
22#define CRC_T10DIF_PMULL_CHUNK_SIZE 16U 23#define CRC_T10DIF_PMULL_CHUNK_SIZE 16U
23 24
@@ -48,9 +49,13 @@ static int crct10dif_update(struct shash_desc *desc, const u8 *data,
48 } 49 }
49 50
50 if (length > 0) { 51 if (length > 0) {
51 kernel_neon_begin_partial(14); 52 if (may_use_simd()) {
52 *crc = crc_t10dif_pmull(*crc, data, length); 53 kernel_neon_begin();
53 kernel_neon_end(); 54 *crc = crc_t10dif_pmull(*crc, data, length);
55 kernel_neon_end();
56 } else {
57 *crc = crc_t10dif_generic(*crc, data, length);
58 }
54 } 59 }
55 60
56 return 0; 61 return 0;