crypto: x86/aria - fix build failure with old binutils
Subsystems (2)
cover crypto: x86/aria - fix build failure with old binutils
There is build failure issue when old binutils is used.
The minimum version of binutils to build kernel is 2.23 but it doesn't support GFNI.
But aria-avx, aria-avx2, and aria-avx512 use GFNI.
So, the build will be failed when old binutils is used.
In order to fix this issue, it checks build environment is using binutils, which don't support GFNI or not.
In addition, it also checks AVX512 for aria-avx512.
aria-avx and aria-avx2 use GFNI optionally.
So, if binutils doesn't support GFNI, it hides GFNI code. But aria-avx512 mandatorily requires GFNI and AVX512.
So, if binutils doesn't support GFNI or AVX512, it disallows select to build.
In order to check whether the using binutils is supporting GFNI, it adds AS_GFNI.
Taehee Yoo (3):
crypto: x86/aria-avx - fix build failure with old binutils
crypto: x86/aria-avx2 - fix build failure with old binutils
crypto: x86/aria-avx15 - fix build failure with old binutils
arch/x86/Kconfig.assembler | 5 +++++ arch/x86/crypto/Kconfig | 2 +- arch/x86/crypto/aria-aesni-avx-asm_64.S | 10 ++++++++++ arch/x86/crypto/aria-aesni-avx2-asm_64.S | 10 +++++++++- arch/x86/crypto/aria_aesni_avx2_glue.c | 4 +++- arch/x86/crypto/aria_aesni_avx_glue.c | 4 +++- 6 files changed, 31 insertions(+), 4 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/3 crypto: x86/aria-avx - fix build failure with old binutils
The minimum version of binutils for kernel build is currently 2.23 and it doesn't support GFNI.
So, it fails to build the aria-avx if the old binutils is used. The code using GFNI is an optional part of aria-avx.
So, it disables GFNI part in it when the old binutils is used. In order to check whether the using binutils is supporting GFNI or not, AS_GFNI is added.
--- arch/x86/Kconfig.assembler | 5 +++++ arch/x86/crypto/aria-aesni-avx-asm_64.S | 10 ++++++++++ arch/x86/crypto/aria_aesni_avx_glue.c | 4 +++- 3 files changed, 18 insertions(+), 1 deletion(-)
arch/x86/Kconfig.assembler +5 -0
@@ -19,3 +19,8 @@ config AS_TPAUSE def_bool $(as-instr,tpause %ecx) help Supported by binutils >= 2.31.1 and LLVM integrated assembler >= V7 + +config AS_GFNI + def_bool $(as-instr,vgf2p8mulb %xmm0$(comma)%xmm1$(comma)%xmm2) + help + Supported by binutils >= 2.30 and LLVM integrated assembler
arch/x86/crypto/aria-aesni-avx-asm_64.S +10 -0
@@ -286,6 +286,7 @@ vpbroadcastb ((round * 16) + idx + 4)(rk), t0; \ vpxor t0, x7, x7; +#ifdef CONFIG_AS_GFNI #define aria_sbox_8way_gfni(x0, x1, x2, x3, \ x4, x5, x6, x7, \ t0, t1, t2, t3, \
@@ -308,6 +309,8 @@ vgf2p8affineinvqb $0, t2, x3, x3; \ vgf2p8affineinvqb $0, t2, x7, x7 +#endif /* CONFIG_AS_GFNI */ + #define aria_sbox_8way(x0, x1, x2, x3, \ x4, x5, x6, x7, \ t0, t1, t2, t3, \
@@ -547,6 +550,7 @@ y4, y5, y6, y7, \ mem_tmp, 8); +#ifdef CONFIG_AS_GFNI #define aria_fe_gfni(x0, x1, x2, x3, \ x4, x5, x6, x7, \ y0, y1, y2, y3, \
@@ -701,6 +705,8 @@ y4, y5, y6, y7, \ mem_tmp, 8); +#endif /* CONFIG_AS_GFNI */ + /* NB: section is mergeable, all elements must be aligned 16-byte blocks */ .section .rodata.cst16, "aM", @progbits, 16 .align 16
@@ -752,6 +758,7 @@ .Ltf_hi__x2__and__fwd_aff: .octa 0x3F893781E95FE1576CDA64D2BA0CB204 +#ifdef CONFIG_AS_GFNI .section .rodata.cst8, "aM", @progbits, 8 .align 8 /* AES affine: */
@@ -812,6 +819,7 @@ BV8(0, 0, 0, 0, 0, 1, 0, 0), BV8(0, 0, 0, 0, 0, 0, 1, 0), BV8(0, 0, 0, 0, 0, 0, 0, 1)) +#endif /* CONFIG_AS_GFNI */ /* 4-bit mask */ .section .rodata.cst4.L0f0f0f0f, "aM", @progbits, 4
@@ -1080,6 +1088,7 @@ SYM_TYPED_FUNC_START(aria_aesni_avx_ctr_crypt_16way) RET; SYM_FUNC_END(aria_aesni_avx_ctr_crypt_16way) +#ifdef CONFIG_AS_GFNI SYM_FUNC_START_LOCAL(__aria_aesni_avx_gfni_crypt_16way) /* input: * %r9: rk
@@ -1298,3 +1307,4 @@ SYM_TYPED_FUNC_START(aria_aesni_avx_gfni_ctr_crypt_16way) FRAME_END RET; SYM_FUNC_END(aria_aesni_avx_gfni_ctr_crypt_16way) +#endif /* CONFIG_AS_GFNI */
arch/x86/crypto/aria_aesni_avx_glue.c +3 -1
@@ -26,6 +26,7 @@ asmlinkage void aria_aesni_avx_ctr_crypt_16way(const void *ctx, u8 *dst,const u8 *src, u8 *keystream, u8 *iv);EXPORT_SYMBOL_GPL (aria_aesni_avx_ctr_crypt_16way); +#ifdef CONFIG_AS_GFNI asmlinkage void aria_aesni_avx_gfni_encrypt_16way(const void *ctx, u8 *dst,const u8 *src);EXPORT_SYMBOL_GPL (aria_aesni_avx_gfni_encrypt_16way);
@@ -36,6 +37,7 @@ asmlinkage void aria_aesni_avx_gfni_ctr_crypt_16way(const void *ctx, u8 *dst,const u8 *src, u8 *keystream, u8 *iv);EXPORT_SYMBOL_GPL (aria_aesni_avx_gfni_ctr_crypt_16way); +#endif /* CONFIG_AS_GFNI */ static struct aria_avx_ops aria_ops;
@@ -201,7 +203,7 @@ static int __init aria_avx_init(void)return -ENODEV ; } -if (boot_cpu_has (X86_FEATURE_GFNI )) { +if (boot_cpu_has (X86_FEATURE_GFNI ) &&IS_ENABLED (CONFIG_AS_GFNI )) { aria_ops.aria_encrypt_16way = aria_aesni_avx_gfni_encrypt_16way; aria_ops.aria_decrypt_16way = aria_aesni_avx_gfni_decrypt_16way; aria_ops.aria_ctr_crypt_16way = aria_aesni_avx_gfni_ctr_crypt_16way;
Signature · 1 line
2.34.1
PATCH 2/3 crypto: x86/aria-avx2 - fix build failure with old binutils
In reply to Taehee YooThe minimum version of binutils for kernel build is currently 2.23 and it doesn't support GFNI.
So, it fails to build the aria-avx2 if the old binutils is used. The code using GFNI is an optional part of aria-avx2.
So, it disables GFNI part in it when the old binutils is used.
--- arch/x86/crypto/aria-aesni-avx2-asm_64.S | 10 +++++++++- arch/x86/crypto/aria_aesni_avx2_glue.c | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-)
arch/x86/crypto/aria-aesni-avx2-asm_64.S +9 -1
@@ -302,6 +302,7 @@ vpbroadcastb ((round * 16) + idx + 4)(rk), t0; \ vpxor t0, x7, x7; +#ifdef CONFIG_AS_GFNI #define aria_sbox_8way_gfni(x0, x1, x2, x3, \ x4, x5, x6, x7, \ t0, t1, t2, t3, \
@@ -324,6 +325,7 @@ vgf2p8affineinvqb $0, t2, x3, x3; \ vgf2p8affineinvqb $0, t2, x7, x7 +#endif /* CONFIG_AS_GFNI */ #define aria_sbox_8way(x0, x1, x2, x3, \ x4, x5, x6, x7, \ t0, t1, t2, t3, \
@@ -596,7 +598,7 @@ aria_load_state_8way(y0, y1, y2, y3, \ y4, y5, y6, y7, \ mem_tmp, 8); - +#ifdef CONFIG_AS_GFNI #define aria_fe_gfni(x0, x1, x2, x3, \ x4, x5, x6, x7, \ y0, y1, y2, y3, \
@@ -750,6 +752,7 @@ aria_load_state_8way(y0, y1, y2, y3, \ y4, y5, y6, y7, \ mem_tmp, 8); +#endif /* CONFIG_AS_GFNI */ .section .rodata.cst32.shufb_16x16b, "aM", @progbits, 32 .align 32
@@ -803,6 +806,7 @@ .Ltf_hi__x2__and__fwd_aff: .octa 0x3F893781E95FE1576CDA64D2BA0CB204 +#ifdef CONFIG_AS_GFNI .section .rodata.cst8, "aM", @progbits, 8 .align 8 /* AES affine: */
@@ -864,6 +868,8 @@ BV8(0, 0, 0, 0, 0, 0, 1, 0), BV8(0, 0, 0, 0, 0, 0, 0, 1)) +#endif /* CONFIG_AS_GFNI */ + /* 4-bit mask */ .section .rodata.cst4.L0f0f0f0f, "aM", @progbits, 4 .align 4
@@ -1213,6 +1219,7 @@ SYM_TYPED_FUNC_START(aria_aesni_avx2_ctr_crypt_32way) RET; SYM_FUNC_END(aria_aesni_avx2_ctr_crypt_32way) +#ifdef CONFIG_AS_GFNI SYM_FUNC_START_LOCAL(__aria_aesni_avx2_gfni_crypt_32way) /* input: * %r9: rk
@@ -1431,3 +1438,4 @@ SYM_TYPED_FUNC_START(aria_aesni_avx2_gfni_ctr_crypt_32way) FRAME_END RET; SYM_FUNC_END(aria_aesni_avx2_gfni_ctr_crypt_32way) +#endif /* CONFIG_AS_GFNI */
arch/x86/crypto/aria_aesni_avx2_glue.c +3 -1
@@ -26,6 +26,7 @@ asmlinkage void aria_aesni_avx2_ctr_crypt_32way(const void *ctx, u8 *dst,const u8 *src, u8 *keystream, u8 *iv);EXPORT_SYMBOL_GPL (aria_aesni_avx2_ctr_crypt_32way); +#ifdef CONFIG_AS_GFNI asmlinkage void aria_aesni_avx2_gfni_encrypt_32way(const void *ctx, u8 *dst,const u8 *src);EXPORT_SYMBOL_GPL (aria_aesni_avx2_gfni_encrypt_32way);
@@ -36,6 +37,7 @@ asmlinkage void aria_aesni_avx2_gfni_ctr_crypt_32way(const void *ctx, u8 *dst,const u8 *src, u8 *keystream, u8 *iv);EXPORT_SYMBOL_GPL (aria_aesni_avx2_gfni_ctr_crypt_32way); +#endif /* CONFIG_AS_GFNI */ static struct aria_avx_ops aria_ops;
@@ -215,7 +217,7 @@ static int __init aria_avx2_init(void)return -ENODEV ; } -if (boot_cpu_has (X86_FEATURE_GFNI )) { +if (boot_cpu_has (X86_FEATURE_GFNI ) &&IS_ENABLED (CONFIG_AS_GFNI )) { aria_ops.aria_encrypt_16way = aria_aesni_avx_gfni_encrypt_16way; aria_ops.aria_decrypt_16way = aria_aesni_avx_gfni_decrypt_16way; aria_ops.aria_ctr_crypt_16way = aria_aesni_avx_gfni_ctr_crypt_16way;
Signature · 1 line
2.34.1
PATCH 3/3 crypto: x86/aria-avx15 - fix build failure with old binutils
In reply to Taehee YooThe minimum version of binutils for kernel build is currently 2.23 and it doesn't support GFNI.
So, it fails to build the aria-avx512 if the old binutils is used. aria-avx512 requires GFNI, so it should not be allowed to build if the old binutils is used.
The AS_AVX512 and AS_GFNI are added to the Kconfig to disable build aria-avx512 if the old binutils is used.
--- arch/x86/crypto/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/crypto/Kconfig +1 -1
@@ -325,7 +325,7 @@ config CRYPTO_ARIA_AESNI_AVX2_X86_64 config CRYPTO_ARIA_GFNI_AVX512_X86_64 tristate "Ciphers: ARIA with modes: ECB, CTR (AVX512/GFNI)" - depends on X86 && 64BIT + depends on X86 && 64BIT && AS_AVX512 && AS_GFNI select CRYPTO_SKCIPHER select CRYPTO_SIMD select CRYPTO_ALGAPI
Signature · 1 line
2.34.1
Herbert Xu
maintainerQuoted 25 lines · Taehee Yoo
There is build failure issue when old binutils is used.
The minimum version of binutils to build kernel is 2.23 but it doesn't support GFNI.
But aria-avx, aria-avx2, and aria-avx512 use GFNI.
So, the build will be failed when old binutils is used.In order to fix this issue, it checks build environment is using binutils, which don't support GFNI or not.
In addition, it also checks AVX512 for aria-avx512.aria-avx and aria-avx2 use GFNI optionally.
So, if binutils doesn't support GFNI, it hides GFNI code. But aria-avx512 mandatorily requires GFNI and AVX512.
So, if binutils doesn't support GFNI or AVX512, it disallows select to build.In order to check whether the using binutils is supporting GFNI, it adds
AS_GFNI.Taehee Yoo (3):
crypto: x86/aria-avx - fix build failure with old binutils
crypto: x86/aria-avx2 - fix build failure with old binutils
crypto: x86/aria-avx15 - fix build failure with old binutils
Quoted 10 lines
arch/x86/Kconfig.assembler | 5 +++++ arch/x86/crypto/Kconfig | 2 +- arch/x86/crypto/aria-aesni-avx-asm_64.S | 10 ++++++++++ arch/x86/crypto/aria-aesni-avx2-asm_64.S | 10 +++++++++- arch/x86/crypto/aria_aesni_avx2_glue.c | 4 +++- arch/x86/crypto/aria_aesni_avx_glue.c | 4 +++- 6 files changed, 31 insertions(+), 4 deletions(-)Signature · 1 line
2.34.1
All applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt