mirror of
https://github.com/torvalds/linux.git
synced 2026-05-24 15:12:13 +02:00
crypto: x86 - Remove CONFIG_AS_AVX512 handling
Current minimum required version of binutils is 2.25, which supports AVX-512 instruction mnemonics. Remove check for assembler support of AVX-512 instructions and all relevant macros for conditional compilation. No functional change intended. Signed-off-by: Uros Bizjak <ubizjak@gmail.com> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: "David S. Miller" <davem@davemloft.net> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@kernel.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Reviewed-by: Eric Biggers <ebiggers@kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
d032a27e8f
commit
bc23fe6dc1
|
|
@ -320,7 +320,7 @@ config CRYPTO_ARIA_AESNI_AVX2_X86_64
|
||||||
|
|
||||||
config CRYPTO_ARIA_GFNI_AVX512_X86_64
|
config CRYPTO_ARIA_GFNI_AVX512_X86_64
|
||||||
tristate "Ciphers: ARIA with modes: ECB, CTR (AVX512/GFNI)"
|
tristate "Ciphers: ARIA with modes: ECB, CTR (AVX512/GFNI)"
|
||||||
depends on X86 && 64BIT && AS_AVX512 && AS_GFNI
|
depends on X86 && 64BIT && AS_GFNI
|
||||||
select CRYPTO_SKCIPHER
|
select CRYPTO_SKCIPHER
|
||||||
select CRYPTO_ALGAPI
|
select CRYPTO_ALGAPI
|
||||||
select CRYPTO_ARIA
|
select CRYPTO_ARIA
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,7 @@ obj-$(CONFIG_CRYPTO_AEGIS128_AESNI_SSE2) += aegis128-aesni.o
|
||||||
aegis128-aesni-y := aegis128-aesni-asm.o aegis128-aesni-glue.o
|
aegis128-aesni-y := aegis128-aesni-asm.o aegis128-aesni-glue.o
|
||||||
|
|
||||||
obj-$(CONFIG_CRYPTO_CHACHA20_X86_64) += chacha-x86_64.o
|
obj-$(CONFIG_CRYPTO_CHACHA20_X86_64) += chacha-x86_64.o
|
||||||
chacha-x86_64-y := chacha-avx2-x86_64.o chacha-ssse3-x86_64.o chacha_glue.o
|
chacha-x86_64-y := chacha-avx2-x86_64.o chacha-ssse3-x86_64.o chacha-avx512vl-x86_64.o chacha_glue.o
|
||||||
chacha-x86_64-$(CONFIG_AS_AVX512) += chacha-avx512vl-x86_64.o
|
|
||||||
|
|
||||||
obj-$(CONFIG_CRYPTO_AES_NI_INTEL) += aesni-intel.o
|
obj-$(CONFIG_CRYPTO_AES_NI_INTEL) += aesni-intel.o
|
||||||
aesni-intel-y := aesni-intel_asm.o aesni-intel_glue.o
|
aesni-intel-y := aesni-intel_asm.o aesni-intel_glue.o
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ SIGMA:
|
||||||
.byte 13, 7, 12, 3, 11, 14, 1, 9, 2, 5, 15, 8, 10, 0, 4, 6
|
.byte 13, 7, 12, 3, 11, 14, 1, 9, 2, 5, 15, 8, 10, 0, 4, 6
|
||||||
.byte 6, 14, 11, 0, 15, 9, 3, 8, 10, 12, 13, 1, 5, 2, 7, 4
|
.byte 6, 14, 11, 0, 15, 9, 3, 8, 10, 12, 13, 1, 5, 2, 7, 4
|
||||||
.byte 10, 8, 7, 1, 2, 4, 6, 5, 13, 15, 9, 3, 0, 11, 14, 12
|
.byte 10, 8, 7, 1, 2, 4, 6, 5, 13, 15, 9, 3, 0, 11, 14, 12
|
||||||
#ifdef CONFIG_AS_AVX512
|
|
||||||
.section .rodata.cst64.BLAKE2S_SIGMA2, "aM", @progbits, 640
|
.section .rodata.cst64.BLAKE2S_SIGMA2, "aM", @progbits, 640
|
||||||
.align 64
|
.align 64
|
||||||
SIGMA2:
|
SIGMA2:
|
||||||
|
|
@ -43,7 +42,6 @@ SIGMA2:
|
||||||
.long 6, 13, 0, 14, 12, 2, 1, 11, 15, 4, 5, 8, 7, 9, 3, 10
|
.long 6, 13, 0, 14, 12, 2, 1, 11, 15, 4, 5, 8, 7, 9, 3, 10
|
||||||
.long 15, 5, 4, 13, 10, 7, 3, 11, 12, 2, 0, 6, 9, 8, 1, 14
|
.long 15, 5, 4, 13, 10, 7, 3, 11, 12, 2, 0, 6, 9, 8, 1, 14
|
||||||
.long 8, 7, 14, 11, 13, 15, 0, 12, 10, 4, 5, 6, 3, 2, 1, 9
|
.long 8, 7, 14, 11, 13, 15, 0, 12, 10, 4, 5, 6, 3, 2, 1, 9
|
||||||
#endif /* CONFIG_AS_AVX512 */
|
|
||||||
|
|
||||||
.text
|
.text
|
||||||
SYM_FUNC_START(blake2s_compress_ssse3)
|
SYM_FUNC_START(blake2s_compress_ssse3)
|
||||||
|
|
@ -174,7 +172,6 @@ SYM_FUNC_START(blake2s_compress_ssse3)
|
||||||
RET
|
RET
|
||||||
SYM_FUNC_END(blake2s_compress_ssse3)
|
SYM_FUNC_END(blake2s_compress_ssse3)
|
||||||
|
|
||||||
#ifdef CONFIG_AS_AVX512
|
|
||||||
SYM_FUNC_START(blake2s_compress_avx512)
|
SYM_FUNC_START(blake2s_compress_avx512)
|
||||||
vmovdqu (%rdi),%xmm0
|
vmovdqu (%rdi),%xmm0
|
||||||
vmovdqu 0x10(%rdi),%xmm1
|
vmovdqu 0x10(%rdi),%xmm1
|
||||||
|
|
@ -253,4 +250,3 @@ SYM_FUNC_START(blake2s_compress_avx512)
|
||||||
vzeroupper
|
vzeroupper
|
||||||
RET
|
RET
|
||||||
SYM_FUNC_END(blake2s_compress_avx512)
|
SYM_FUNC_END(blake2s_compress_avx512)
|
||||||
#endif /* CONFIG_AS_AVX512 */
|
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,7 @@ void blake2s_compress(struct blake2s_state *state, const u8 *block,
|
||||||
SZ_4K / BLAKE2S_BLOCK_SIZE);
|
SZ_4K / BLAKE2S_BLOCK_SIZE);
|
||||||
|
|
||||||
kernel_fpu_begin();
|
kernel_fpu_begin();
|
||||||
if (IS_ENABLED(CONFIG_AS_AVX512) &&
|
if (static_branch_likely(&blake2s_use_avx512))
|
||||||
static_branch_likely(&blake2s_use_avx512))
|
|
||||||
blake2s_compress_avx512(state, block, blocks, inc);
|
blake2s_compress_avx512(state, block, blocks, inc);
|
||||||
else
|
else
|
||||||
blake2s_compress_ssse3(state, block, blocks, inc);
|
blake2s_compress_ssse3(state, block, blocks, inc);
|
||||||
|
|
@ -59,8 +58,7 @@ static int __init blake2s_mod_init(void)
|
||||||
if (boot_cpu_has(X86_FEATURE_SSSE3))
|
if (boot_cpu_has(X86_FEATURE_SSSE3))
|
||||||
static_branch_enable(&blake2s_use_ssse3);
|
static_branch_enable(&blake2s_use_ssse3);
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_AS_AVX512) &&
|
if (boot_cpu_has(X86_FEATURE_AVX) &&
|
||||||
boot_cpu_has(X86_FEATURE_AVX) &&
|
|
||||||
boot_cpu_has(X86_FEATURE_AVX2) &&
|
boot_cpu_has(X86_FEATURE_AVX2) &&
|
||||||
boot_cpu_has(X86_FEATURE_AVX512F) &&
|
boot_cpu_has(X86_FEATURE_AVX512F) &&
|
||||||
boot_cpu_has(X86_FEATURE_AVX512VL) &&
|
boot_cpu_has(X86_FEATURE_AVX512VL) &&
|
||||||
|
|
|
||||||
|
|
@ -45,8 +45,7 @@ static unsigned int chacha_advance(unsigned int len, unsigned int maxblocks)
|
||||||
static void chacha_dosimd(u32 *state, u8 *dst, const u8 *src,
|
static void chacha_dosimd(u32 *state, u8 *dst, const u8 *src,
|
||||||
unsigned int bytes, int nrounds)
|
unsigned int bytes, int nrounds)
|
||||||
{
|
{
|
||||||
if (IS_ENABLED(CONFIG_AS_AVX512) &&
|
if (static_branch_likely(&chacha_use_avx512vl)) {
|
||||||
static_branch_likely(&chacha_use_avx512vl)) {
|
|
||||||
while (bytes >= CHACHA_BLOCK_SIZE * 8) {
|
while (bytes >= CHACHA_BLOCK_SIZE * 8) {
|
||||||
chacha_8block_xor_avx512vl(state, dst, src, bytes,
|
chacha_8block_xor_avx512vl(state, dst, src, bytes,
|
||||||
nrounds);
|
nrounds);
|
||||||
|
|
@ -258,8 +257,7 @@ static int __init chacha_simd_mod_init(void)
|
||||||
cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM, NULL)) {
|
cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM, NULL)) {
|
||||||
static_branch_enable(&chacha_use_avx2);
|
static_branch_enable(&chacha_use_avx2);
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_AS_AVX512) &&
|
if (boot_cpu_has(X86_FEATURE_AVX512VL) &&
|
||||||
boot_cpu_has(X86_FEATURE_AVX512VL) &&
|
|
||||||
boot_cpu_has(X86_FEATURE_AVX512BW)) /* kmovq */
|
boot_cpu_has(X86_FEATURE_AVX512BW)) /* kmovq */
|
||||||
static_branch_enable(&chacha_use_avx512vl);
|
static_branch_enable(&chacha_use_avx512vl);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2811,18 +2811,10 @@ if ($avx>2) {
|
||||||
# reason stack layout is kept identical to poly1305_blocks_avx2. If not
|
# reason stack layout is kept identical to poly1305_blocks_avx2. If not
|
||||||
# for this tail, we wouldn't have to even allocate stack frame...
|
# for this tail, we wouldn't have to even allocate stack frame...
|
||||||
|
|
||||||
if($kernel) {
|
|
||||||
$code .= "#ifdef CONFIG_AS_AVX512\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
&declare_function("poly1305_blocks_avx512", 32, 4);
|
&declare_function("poly1305_blocks_avx512", 32, 4);
|
||||||
poly1305_blocks_avxN(1);
|
poly1305_blocks_avxN(1);
|
||||||
&end_function("poly1305_blocks_avx512");
|
&end_function("poly1305_blocks_avx512");
|
||||||
|
|
||||||
if ($kernel) {
|
|
||||||
$code .= "#endif\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$kernel && $avx>3) {
|
if (!$kernel && $avx>3) {
|
||||||
########################################################################
|
########################################################################
|
||||||
# VPMADD52 version using 2^44 radix.
|
# VPMADD52 version using 2^44 radix.
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ static void poly1305_simd_blocks(void *ctx, const u8 *inp, size_t len,
|
||||||
const size_t bytes = min_t(size_t, len, SZ_4K);
|
const size_t bytes = min_t(size_t, len, SZ_4K);
|
||||||
|
|
||||||
kernel_fpu_begin();
|
kernel_fpu_begin();
|
||||||
if (IS_ENABLED(CONFIG_AS_AVX512) && static_branch_likely(&poly1305_use_avx512))
|
if (static_branch_likely(&poly1305_use_avx512))
|
||||||
poly1305_blocks_avx512(ctx, inp, bytes, padbit);
|
poly1305_blocks_avx512(ctx, inp, bytes, padbit);
|
||||||
else if (static_branch_likely(&poly1305_use_avx2))
|
else if (static_branch_likely(&poly1305_use_avx2))
|
||||||
poly1305_blocks_avx2(ctx, inp, bytes, padbit);
|
poly1305_blocks_avx2(ctx, inp, bytes, padbit);
|
||||||
|
|
@ -265,8 +265,8 @@ static int __init poly1305_simd_mod_init(void)
|
||||||
if (boot_cpu_has(X86_FEATURE_AVX) && boot_cpu_has(X86_FEATURE_AVX2) &&
|
if (boot_cpu_has(X86_FEATURE_AVX) && boot_cpu_has(X86_FEATURE_AVX2) &&
|
||||||
cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM, NULL))
|
cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM, NULL))
|
||||||
static_branch_enable(&poly1305_use_avx2);
|
static_branch_enable(&poly1305_use_avx2);
|
||||||
if (IS_ENABLED(CONFIG_AS_AVX512) && boot_cpu_has(X86_FEATURE_AVX) &&
|
if (boot_cpu_has(X86_FEATURE_AVX) && boot_cpu_has(X86_FEATURE_AVX2) &&
|
||||||
boot_cpu_has(X86_FEATURE_AVX2) && boot_cpu_has(X86_FEATURE_AVX512F) &&
|
boot_cpu_has(X86_FEATURE_AVX512F) &&
|
||||||
cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM | XFEATURE_MASK_AVX512, NULL) &&
|
cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM | XFEATURE_MASK_AVX512, NULL) &&
|
||||||
/* Skylake downclocks unacceptably much when using zmm, but later generations are fast. */
|
/* Skylake downclocks unacceptably much when using zmm, but later generations are fast. */
|
||||||
boot_cpu_data.x86_vfm != INTEL_SKYLAKE_X)
|
boot_cpu_data.x86_vfm != INTEL_SKYLAKE_X)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user