Re: [PATCH] crypto: arm: workaround for building with old binutils
On Sat, Apr 11, 2015 at 03:32:34PM +0200, Ard Biesheuvel wrote: > From: Arnd Bergmann > > How about something like this: > > A warning will be emitted by make when descending into the arch/arm/crypto > directory, but only if any ARMv8 Crypto modules were in fact selected. > > /home/ard/linux-2.6/arch/arm/crypto/Makefile:22: These ARMv8 Crypto > Extensions modules need binutils 2.23 or higher > /home/ard/linux-2.6/arch/arm/crypto/Makefile:23: aes-arm-ce.o sha1-arm-ce.o > sha2-arm-ce.o ghash-arm-ce.o > > > ->8-- > Old versions of binutils (before 2.23) do not yet understand the > crypto-neon-fp-armv8 fpu instructions, and an attempt to build these > files results in a build failure: > > arch/arm/crypto/aes-ce-core.S:133: Error: selected processor does not support > ARM mode `vld1.8 {q10-q11},[ip]!' > arch/arm/crypto/aes-ce-core.S:133: Error: bad instruction `aese.8 q0,q8' > arch/arm/crypto/aes-ce-core.S:133: Error: bad instruction `aesmc.8 q0,q0' > arch/arm/crypto/aes-ce-core.S:133: Error: bad instruction `aese.8 q0,q9' > arch/arm/crypto/aes-ce-core.S:133: Error: bad instruction `aesmc.8 q0,q0' > > Since the affected versions are still in widespread use, and this breaks > 'allmodconfig' builds, we should try to at least get a successful kernel > build. Unfortunately, I could not come up with a way to make the Kconfig > symbol depend on the binutils version, which would be the nicest solution. > > Instead, this patch uses the 'as-instr' Kbuild macro to find out whether > the support is present in the assembler, and otherwise emits a non-fatal > warning indicating which selected modules could not be built. > > Signed-off-by: Arnd Bergmann > Link: > http://storage.kernelci.org/next/next-20150410/arm-allmodconfig/build.log > Fixes: 864cbeed4ab22d ("crypto: arm - add support for SHA1 using ARMv8 Crypto > Instructions") > [ard.biesheuvel: > - omit modules entirely instead of building empty ones if binutils is too old > - update commit log accordingly] > Signed-off-by: Ard Biesheuvel Patch applied. -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] crypto: arm: workaround for building with old binutils
On 11 April 2015 at 22:54, Arnd Bergmann wrote: > On Saturday 11 April 2015 15:32:34 Ard Biesheuvel wrote: >> From: Arnd Bergmann >> >> How about something like this: >> >> A warning will be emitted by make when descending into the arch/arm/crypto >> directory, but only if any ARMv8 Crypto modules were in fact selected. >> >> /home/ard/linux-2.6/arch/arm/crypto/Makefile:22: These ARMv8 Crypto >> Extensions modules need binutils 2.23 or higher >> /home/ard/linux-2.6/arch/arm/crypto/Makefile:23: aes-arm-ce.o sha1-arm-ce.o >> sha2-arm-ce.o ghash-arm-ce.o >> >> > > Looks good. Do you want me to do more randconfig tests on this, or put it in > right away to fix the allmodconfig problem? > It would be good to have confirmation that it fixes the actual symptom, so yes, more testing please. But I think the patch itself needs to go via Herbert's tree -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] crypto: arm: workaround for building with old binutils
On Saturday 11 April 2015 15:32:34 Ard Biesheuvel wrote: > From: Arnd Bergmann > > How about something like this: > > A warning will be emitted by make when descending into the arch/arm/crypto > directory, but only if any ARMv8 Crypto modules were in fact selected. > > /home/ard/linux-2.6/arch/arm/crypto/Makefile:22: These ARMv8 Crypto > Extensions modules need binutils 2.23 or higher > /home/ard/linux-2.6/arch/arm/crypto/Makefile:23: aes-arm-ce.o sha1-arm-ce.o > sha2-arm-ce.o ghash-arm-ce.o > > Looks good. Do you want me to do more randconfig tests on this, or put it in right away to fix the allmodconfig problem? Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] crypto: arm: workaround for building with old binutils
On Saturday 11 April 2015 12:35:19 Ard Biesheuvel wrote: > > Yes, that should work. Could we also move the CE objs to ce-obj-$() and put > > ifneq ($(ce-obj-y)$(ce-obj-m),) > if > obj-y += $(ce-obj-y) > obj-m += $(ce-obj-m) > else > $(warning ...) > endif > endif > > around it so you only get the warning if you have selected any of these > modules? Sounds good, I had not thought of that. > In any case, I strongly prefer to leave the .S files themselves alone if at > all possible Yes, makes sense. Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] crypto: arm: workaround for building with old binutils
From: Arnd Bergmann How about something like this: A warning will be emitted by make when descending into the arch/arm/crypto directory, but only if any ARMv8 Crypto modules were in fact selected. /home/ard/linux-2.6/arch/arm/crypto/Makefile:22: These ARMv8 Crypto Extensions modules need binutils 2.23 or higher /home/ard/linux-2.6/arch/arm/crypto/Makefile:23: aes-arm-ce.o sha1-arm-ce.o sha2-arm-ce.o ghash-arm-ce.o ->8-- Old versions of binutils (before 2.23) do not yet understand the crypto-neon-fp-armv8 fpu instructions, and an attempt to build these files results in a build failure: arch/arm/crypto/aes-ce-core.S:133: Error: selected processor does not support ARM mode `vld1.8 {q10-q11},[ip]!' arch/arm/crypto/aes-ce-core.S:133: Error: bad instruction `aese.8 q0,q8' arch/arm/crypto/aes-ce-core.S:133: Error: bad instruction `aesmc.8 q0,q0' arch/arm/crypto/aes-ce-core.S:133: Error: bad instruction `aese.8 q0,q9' arch/arm/crypto/aes-ce-core.S:133: Error: bad instruction `aesmc.8 q0,q0' Since the affected versions are still in widespread use, and this breaks 'allmodconfig' builds, we should try to at least get a successful kernel build. Unfortunately, I could not come up with a way to make the Kconfig symbol depend on the binutils version, which would be the nicest solution. Instead, this patch uses the 'as-instr' Kbuild macro to find out whether the support is present in the assembler, and otherwise emits a non-fatal warning indicating which selected modules could not be built. Signed-off-by: Arnd Bergmann Link: http://storage.kernelci.org/next/next-20150410/arm-allmodconfig/build.log Fixes: 864cbeed4ab22d ("crypto: arm - add support for SHA1 using ARMv8 Crypto Instructions") [ard.biesheuvel: - omit modules entirely instead of building empty ones if binutils is too old - update commit log accordingly] Signed-off-by: Ard Biesheuvel --- arch/arm/crypto/Makefile | 19 +++ 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/arch/arm/crypto/Makefile b/arch/arm/crypto/Makefile index b37597ad979c..fc5150702b64 100644 --- a/arch/arm/crypto/Makefile +++ b/arch/arm/crypto/Makefile @@ -4,14 +4,25 @@ obj-$(CONFIG_CRYPTO_AES_ARM) += aes-arm.o obj-$(CONFIG_CRYPTO_AES_ARM_BS) += aes-arm-bs.o -obj-$(CONFIG_CRYPTO_AES_ARM_CE) += aes-arm-ce.o obj-$(CONFIG_CRYPTO_SHA1_ARM) += sha1-arm.o obj-$(CONFIG_CRYPTO_SHA1_ARM_NEON) += sha1-arm-neon.o obj-$(CONFIG_CRYPTO_SHA256_ARM) += sha256-arm.o obj-$(CONFIG_CRYPTO_SHA512_ARM) += sha512-arm.o -obj-$(CONFIG_CRYPTO_SHA1_ARM_CE) += sha1-arm-ce.o -obj-$(CONFIG_CRYPTO_SHA2_ARM_CE) += sha2-arm-ce.o -obj-$(CONFIG_CRYPTO_GHASH_ARM_CE) += ghash-arm-ce.o + +ce-obj-$(CONFIG_CRYPTO_AES_ARM_CE) += aes-arm-ce.o +ce-obj-$(CONFIG_CRYPTO_SHA1_ARM_CE) += sha1-arm-ce.o +ce-obj-$(CONFIG_CRYPTO_SHA2_ARM_CE) += sha2-arm-ce.o +ce-obj-$(CONFIG_CRYPTO_GHASH_ARM_CE) += ghash-arm-ce.o + +ifneq ($(ce-obj-y)$(ce-obj-m),) +ifeq ($(call as-instr,.fpu crypto-neon-fp-armv8,y,n),y) +obj-y += $(ce-obj-y) +obj-m += $(ce-obj-m) +else +$(warning These ARMv8 Crypto Extensions modules need binutils 2.23 or higher) +$(warning $(ce-obj-y) $(ce-obj-m)) +endif +endif aes-arm-y := aes-armv4.o aes_glue.o aes-arm-bs-y := aesbs-core.o aesbs-glue.o -- 1.8.3.2 -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] crypto: arm: workaround for building with old binutils
> On 11 apr. 2015, at 10:55, Arnd Bergmann wrote: > >> On Saturday 11 April 2015 09:41:08 Ard Biesheuvel wrote: >> Could you perhaps put the rules that build these modules inside a >> >> ifneq ($(armv8-ce-flags),-DARMV8_CE_DISABLED) >> ... >> endif > > How about something like this: > > ifeq ($(call as-option,-Wa$(comma)-mfpu=crypto-neon-fp-armv8),) > $(warning ARMv8 Crypto Extensions need binutils 2.23 or higher) > else > ... > endif > > That would basically be a reimplementation of the missing "as-option-yn" > macro though, so we could also add that instead and do > > ifeq ($(call as-option-yn,-Wa$(comma)-mfpu=crypto-neon-fp-armv8),y) > $(warning ARMv8 Crypto Extensions need binutils 2.23 or higher) > else > ... > endif > Yes, that should work. Could we also move the CE objs to ce-obj-$() and put ifneq ($(ce-obj-y)$(ce-obj-m),) if obj-y += $(ce-obj-y) obj-m += $(ce-obj-m) else $(warning ...) endif endif around it so you only get the warning if you have selected any of these modules? In any case, I strongly prefer to leave the .S files themselves alone if at all possible Ard. -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] crypto: arm: workaround for building with old binutils
On Saturday 11 April 2015 09:41:08 Ard Biesheuvel wrote: > Could you perhaps put the rules that build these modules inside a > > ifneq ($(armv8-ce-flags),-DARMV8_CE_DISABLED) > ... > endif > How about something like this: ifeq ($(call as-option,-Wa$(comma)-mfpu=crypto-neon-fp-armv8),) $(warning ARMv8 Crypto Extensions need binutils 2.23 or higher) else ... endif That would basically be a reimplementation of the missing "as-option-yn" macro though, so we could also add that instead and do ifeq ($(call as-option-yn,-Wa$(comma)-mfpu=crypto-neon-fp-armv8),y) $(warning ARMv8 Crypto Extensions need binutils 2.23 or higher) else ... endif Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] crypto: arm: workaround for building with old binutils
On 10 April 2015 at 21:57, Arnd Bergmann wrote: > Old versions of binutils (before 2.23) do not yet understand the > crypto-neon-fp-armv8 fpu instructions, and an attempt to build these > files results in a build failure: > > arch/arm/crypto/aes-ce-core.S:133: Error: selected processor does not support > ARM mode `vld1.8 {q10-q11},[ip]!' > arch/arm/crypto/aes-ce-core.S:133: Error: bad instruction `aese.8 q0,q8' > arch/arm/crypto/aes-ce-core.S:133: Error: bad instruction `aesmc.8 q0,q0' > arch/arm/crypto/aes-ce-core.S:133: Error: bad instruction `aese.8 q0,q9' > arch/arm/crypto/aes-ce-core.S:133: Error: bad instruction `aesmc.8 q0,q0' > > Since the affected versions are still in widespread use, and this breaks > 'allmodconfig' builds, we should try to at least get a successful kernel > build. Unfortunately, I could not come up with a way to make the Kconfig > symbol depend on the binutils version, which would be the nicest solution. > > This patch uses the 'as-option' Kbuild macro to find out whether the > support is present in the assembler, and otherwise passes a macro > definition to each affected file, which in turn disables that code > entirely and results in empty modules. > > In order to help users figure out what to do, we also add a #warning > state in place of the removed to that tells users which version to use. > > Signed-off-by: Arnd Bergmann > Link: > http://storage.kernelci.org/next/next-20150410/arm-allmodconfig/build.log > Fixes: 864cbeed4ab22d ("crypto: arm - add support for SHA1 using ARMv8 Crypto > Instructions") > > diff --git a/arch/arm/crypto/Makefile b/arch/arm/crypto/Makefile > index ef46e898f98b..60f2101e0586 100644 > --- a/arch/arm/crypto/Makefile > +++ b/arch/arm/crypto/Makefile > @@ -25,6 +25,10 @@ sha2-arm-ce-y:= sha2-ce-core.o sha2-ce-glue.o > aes-arm-ce-y := aes-ce-core.o aes-ce-glue.o > ghash-arm-ce-y := ghash-ce-core.o ghash-ce-glue.o > > +armv8-ce-flags := $(call > as-option,-Wa$(comma)-mfpu=crypto-neon-fp-armv8,-DARMV8_CE_DISABLED) > +asflags-y := $(armv8-ce-flags) > +ccflags-y := $(armv8-ce-flags) > + Could you perhaps put the rules that build these modules inside a ifneq ($(armv8-ce-flags),-DARMV8_CE_DISABLED) ... endif block? > quiet_cmd_perl = PERL$@ >cmd_perl = $(PERL) $(<) > $(@) > > diff --git a/arch/arm/crypto/aes-ce-core.S b/arch/arm/crypto/aes-ce-core.S > index 8cfa468ee570..f2132ba91353 100644 > --- a/arch/arm/crypto/aes-ce-core.S > +++ b/arch/arm/crypto/aes-ce-core.S > @@ -8,11 +8,14 @@ > * published by the Free Software Foundation. > */ > > +#ifdef ARMV8_CE_DISABLED > +#warning ARMv8 Crypto Extensions need binutils 2.23 or higher > +#else > + > #include > #include > > .text > - .fpucrypto-neon-fp-armv8 > .align 3 > > .macro enc_round, state, key > @@ -516,3 +519,5 @@ ENTRY(ce_aes_invert) > vst1.8 {q0}, [r0] > bx lr > ENDPROC(ce_aes_invert) > + > +#endif > diff --git a/arch/arm/crypto/aes-ce-glue.c b/arch/arm/crypto/aes-ce-glue.c > index b445a5d56f43..4cba201a64a9 100644 > --- a/arch/arm/crypto/aes-ce-glue.c > +++ b/arch/arm/crypto/aes-ce-glue.c > @@ -510,13 +510,16 @@ static struct crypto_alg aes_algs[] = { { > > static int __init aes_init(void) > { > - if (!(elf_hwcap2 & HWCAP2_AES)) > + if (IS_ENABLED(ARMV8_CE_DISABLED) || !(elf_hwcap2 & HWCAP2_AES)) > return -ENODEV; > return crypto_register_algs(aes_algs, ARRAY_SIZE(aes_algs)); > } > > static void __exit aes_exit(void) > { > + if (IS_ENABLED(ARMV8_CE_DISABLED)) > + return; > + > crypto_unregister_algs(aes_algs, ARRAY_SIZE(aes_algs)); > } > > diff --git a/arch/arm/crypto/ghash-ce-core.S b/arch/arm/crypto/ghash-ce-core.S > index f6ab8bcc9efe..4fe75df41162 100644 > --- a/arch/arm/crypto/ghash-ce-core.S > +++ b/arch/arm/crypto/ghash-ce-core.S > @@ -8,6 +8,10 @@ > * by the Free Software Foundation. > */ > > +#ifdef ARMV8_CE_DISABLED > +#warning ARMv8 Crypto Extensions need binutils 2.23 or higher > +#else > + > #include > #include > > @@ -33,8 +37,6 @@ > XH_L.reqd14 > > .text > - .fpucrypto-neon-fp-armv8 > - > /* > * void pmull_ghash_update(int blocks, u64 dg[], const char *src, > * struct ghash_key const *k, const char > *head) > @@ -92,3 +94,5 @@ ENTRY(pmull_ghash_update) > vst1.64 {XL}, [r1] > bx lr > ENDPROC(pmull_ghash_update) > + > +#endif > diff --git a/arch/arm/crypto/ghash-ce-glue.c b/arch/arm/crypto/ghash-ce-glue.c > index 03a39fe29246..880afe904e5d 100644 > --- a/arch/arm/crypto/ghash-ce-glue.c > +++ b/arch/arm/crypto/ghash-ce-glue.c > @@ -293,7 +293,7 @@ static int __init ghash_ce_mod_init(void) > { > int err; > > - if (!(elf_hwcap2 & HWCAP2_PMULL)) > + if (IS_ENABLED(ARMV8_CE_DISABLED) || !(elf_hwcap2 & HWCAP2_AES)) >
[PATCH] crypto: arm: workaround for building with old binutils
Old versions of binutils (before 2.23) do not yet understand the crypto-neon-fp-armv8 fpu instructions, and an attempt to build these files results in a build failure: arch/arm/crypto/aes-ce-core.S:133: Error: selected processor does not support ARM mode `vld1.8 {q10-q11},[ip]!' arch/arm/crypto/aes-ce-core.S:133: Error: bad instruction `aese.8 q0,q8' arch/arm/crypto/aes-ce-core.S:133: Error: bad instruction `aesmc.8 q0,q0' arch/arm/crypto/aes-ce-core.S:133: Error: bad instruction `aese.8 q0,q9' arch/arm/crypto/aes-ce-core.S:133: Error: bad instruction `aesmc.8 q0,q0' Since the affected versions are still in widespread use, and this breaks 'allmodconfig' builds, we should try to at least get a successful kernel build. Unfortunately, I could not come up with a way to make the Kconfig symbol depend on the binutils version, which would be the nicest solution. This patch uses the 'as-option' Kbuild macro to find out whether the support is present in the assembler, and otherwise passes a macro definition to each affected file, which in turn disables that code entirely and results in empty modules. In order to help users figure out what to do, we also add a #warning state in place of the removed to that tells users which version to use. Signed-off-by: Arnd Bergmann Link: http://storage.kernelci.org/next/next-20150410/arm-allmodconfig/build.log Fixes: 864cbeed4ab22d ("crypto: arm - add support for SHA1 using ARMv8 Crypto Instructions") diff --git a/arch/arm/crypto/Makefile b/arch/arm/crypto/Makefile index ef46e898f98b..60f2101e0586 100644 --- a/arch/arm/crypto/Makefile +++ b/arch/arm/crypto/Makefile @@ -25,6 +25,10 @@ sha2-arm-ce-y:= sha2-ce-core.o sha2-ce-glue.o aes-arm-ce-y := aes-ce-core.o aes-ce-glue.o ghash-arm-ce-y := ghash-ce-core.o ghash-ce-glue.o +armv8-ce-flags := $(call as-option,-Wa$(comma)-mfpu=crypto-neon-fp-armv8,-DARMV8_CE_DISABLED) +asflags-y := $(armv8-ce-flags) +ccflags-y := $(armv8-ce-flags) + quiet_cmd_perl = PERL$@ cmd_perl = $(PERL) $(<) > $(@) diff --git a/arch/arm/crypto/aes-ce-core.S b/arch/arm/crypto/aes-ce-core.S index 8cfa468ee570..f2132ba91353 100644 --- a/arch/arm/crypto/aes-ce-core.S +++ b/arch/arm/crypto/aes-ce-core.S @@ -8,11 +8,14 @@ * published by the Free Software Foundation. */ +#ifdef ARMV8_CE_DISABLED +#warning ARMv8 Crypto Extensions need binutils 2.23 or higher +#else + #include #include .text - .fpucrypto-neon-fp-armv8 .align 3 .macro enc_round, state, key @@ -516,3 +519,5 @@ ENTRY(ce_aes_invert) vst1.8 {q0}, [r0] bx lr ENDPROC(ce_aes_invert) + +#endif diff --git a/arch/arm/crypto/aes-ce-glue.c b/arch/arm/crypto/aes-ce-glue.c index b445a5d56f43..4cba201a64a9 100644 --- a/arch/arm/crypto/aes-ce-glue.c +++ b/arch/arm/crypto/aes-ce-glue.c @@ -510,13 +510,16 @@ static struct crypto_alg aes_algs[] = { { static int __init aes_init(void) { - if (!(elf_hwcap2 & HWCAP2_AES)) + if (IS_ENABLED(ARMV8_CE_DISABLED) || !(elf_hwcap2 & HWCAP2_AES)) return -ENODEV; return crypto_register_algs(aes_algs, ARRAY_SIZE(aes_algs)); } static void __exit aes_exit(void) { + if (IS_ENABLED(ARMV8_CE_DISABLED)) + return; + crypto_unregister_algs(aes_algs, ARRAY_SIZE(aes_algs)); } diff --git a/arch/arm/crypto/ghash-ce-core.S b/arch/arm/crypto/ghash-ce-core.S index f6ab8bcc9efe..4fe75df41162 100644 --- a/arch/arm/crypto/ghash-ce-core.S +++ b/arch/arm/crypto/ghash-ce-core.S @@ -8,6 +8,10 @@ * by the Free Software Foundation. */ +#ifdef ARMV8_CE_DISABLED +#warning ARMv8 Crypto Extensions need binutils 2.23 or higher +#else + #include #include @@ -33,8 +37,6 @@ XH_L.reqd14 .text - .fpucrypto-neon-fp-armv8 - /* * void pmull_ghash_update(int blocks, u64 dg[], const char *src, * struct ghash_key const *k, const char *head) @@ -92,3 +94,5 @@ ENTRY(pmull_ghash_update) vst1.64 {XL}, [r1] bx lr ENDPROC(pmull_ghash_update) + +#endif diff --git a/arch/arm/crypto/ghash-ce-glue.c b/arch/arm/crypto/ghash-ce-glue.c index 03a39fe29246..880afe904e5d 100644 --- a/arch/arm/crypto/ghash-ce-glue.c +++ b/arch/arm/crypto/ghash-ce-glue.c @@ -293,7 +293,7 @@ static int __init ghash_ce_mod_init(void) { int err; - if (!(elf_hwcap2 & HWCAP2_PMULL)) + if (IS_ENABLED(ARMV8_CE_DISABLED) || !(elf_hwcap2 & HWCAP2_AES)) return -ENODEV; err = crypto_register_shash(&ghash_alg); @@ -312,6 +312,9 @@ err_shash: static void __exit ghash_ce_mod_exit(void) { + if (IS_ENABLED(ARMV8_CE_DISABLED)) + return; + crypto_unregister_ahash(&ghash_async_alg); crypto_unregister_shash(&ghash_alg); } diff --git a/arch/arm/crypto/sha1-ce-core.S b/arch/arm/crypto/sha1-ce-core.S index 4aad520935d8..ab0f