.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Calculate a CRC T10-DIF with vpmsum acceleration |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright 2017, Daniel Axtens, IBM Corporation. |
---|
5 | 6 | * [based on crc32c-vpmsum_glue.c] |
---|
6 | | - * |
---|
7 | | - * This program is free software; you can redistribute it and/or |
---|
8 | | - * modify it under the terms of the GNU General Public License |
---|
9 | | - * as published by the Free Software Foundation; either version 2 |
---|
10 | | - * of the License, or (at your option) any later version. |
---|
11 | 7 | */ |
---|
12 | 8 | |
---|
13 | 9 | #include <linux/crc-t10dif.h> |
---|
14 | 10 | #include <crypto/internal/hash.h> |
---|
| 11 | +#include <crypto/internal/simd.h> |
---|
15 | 12 | #include <linux/init.h> |
---|
16 | 13 | #include <linux/module.h> |
---|
17 | 14 | #include <linux/string.h> |
---|
18 | 15 | #include <linux/kernel.h> |
---|
19 | 16 | #include <linux/cpufeature.h> |
---|
| 17 | +#include <asm/simd.h> |
---|
20 | 18 | #include <asm/switch_to.h> |
---|
21 | 19 | |
---|
22 | 20 | #define VMX_ALIGN 16 |
---|
.. | .. |
---|
32 | 30 | unsigned int tail; |
---|
33 | 31 | u32 crc = crci; |
---|
34 | 32 | |
---|
35 | | - if (len < (VECTOR_BREAKPOINT + VMX_ALIGN) || in_interrupt()) |
---|
| 33 | + if (len < (VECTOR_BREAKPOINT + VMX_ALIGN) || !crypto_simd_usable()) |
---|
36 | 34 | return crc_t10dif_generic(crc, p, len); |
---|
37 | 35 | |
---|
38 | 36 | if ((unsigned long)p & VMX_ALIGN_MASK) { |
---|