Commit 2dde374e authored by Ard Biesheuvel's avatar Ard Biesheuvel Committed by Herbert Xu

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: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 6d6254d7
/* /*
* Accelerated CRC-T10DIF using arm64 NEON and Crypto Extensions instructions * Accelerated CRC-T10DIF using arm64 NEON and Crypto Extensions instructions
* *
* Copyright (C) 2016 Linaro Ltd <ard.biesheuvel@linaro.org> * Copyright (C) 2016 - 2017 Linaro Ltd <ard.biesheuvel@linaro.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <crypto/internal/hash.h> #include <crypto/internal/hash.h>
#include <asm/neon.h> #include <asm/neon.h>
#include <asm/simd.h>
#define CRC_T10DIF_PMULL_CHUNK_SIZE 16U #define CRC_T10DIF_PMULL_CHUNK_SIZE 16U
...@@ -48,9 +49,13 @@ static int crct10dif_update(struct shash_desc *desc, const u8 *data, ...@@ -48,9 +49,13 @@ static int crct10dif_update(struct shash_desc *desc, const u8 *data,
} }
if (length > 0) { if (length > 0) {
kernel_neon_begin_partial(14); if (may_use_simd()) {
*crc = crc_t10dif_pmull(*crc, data, length); kernel_neon_begin();
kernel_neon_end(); *crc = crc_t10dif_pmull(*crc, data, length);
kernel_neon_end();
} else {
*crc = crc_t10dif_generic(*crc, data, length);
}
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment