All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto: arm: workaround for building with old binutils
@ 2015-04-11 13:32 ` Ard Biesheuvel
  0 siblings, 0 replies; 22+ messages in thread
From: Ard Biesheuvel @ 2015-04-11 13:32 UTC (permalink / raw)
  To: herbert, linux-kernel, linux, linux-crypto, linux-arm-kernel,
	davem, arnd
  Cc: Ard Biesheuvel

From: Arnd Bergmann <arnd@arndb.de>

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 <arnd@arndb.de>
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 <ard.biesheuvel@linaro.org>
---
 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

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH] crypto: arm: workaround for building with old binutils
@ 2015-04-11 13:32 ` Ard Biesheuvel
  0 siblings, 0 replies; 22+ messages in thread
From: Ard Biesheuvel @ 2015-04-11 13:32 UTC (permalink / raw)
  To: linux-arm-kernel

From: Arnd Bergmann <arnd@arndb.de>

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 <arnd@arndb.de>
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 <ard.biesheuvel@linaro.org>
---
 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

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH] crypto: arm: workaround for building with old binutils
  2015-04-11 13:32 ` Ard Biesheuvel
@ 2015-04-11 20:54   ` Arnd Bergmann
  -1 siblings, 0 replies; 22+ messages in thread
From: Arnd Bergmann @ 2015-04-11 20:54 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: herbert, linux-kernel, linux, linux-crypto, linux-arm-kernel, davem

On Saturday 11 April 2015 15:32:34 Ard Biesheuvel wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH] crypto: arm: workaround for building with old binutils
@ 2015-04-11 20:54   ` Arnd Bergmann
  0 siblings, 0 replies; 22+ messages in thread
From: Arnd Bergmann @ 2015-04-11 20:54 UTC (permalink / raw)
  To: linux-arm-kernel

On Saturday 11 April 2015 15:32:34 Ard Biesheuvel wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] crypto: arm: workaround for building with old binutils
  2015-04-11 20:54   ` Arnd Bergmann
  (?)
@ 2015-04-12  9:23     ` Ard Biesheuvel
  -1 siblings, 0 replies; 22+ messages in thread
From: Ard Biesheuvel @ 2015-04-12  9:23 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Herbert Xu, linux-kernel, Russell King - ARM Linux, linux-crypto,
	linux-arm-kernel, David S. Miller

On 11 April 2015 at 22:54, Arnd Bergmann <arnd@arndb.de> wrote:
> On Saturday 11 April 2015 15:32:34 Ard Biesheuvel wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>>
>> 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

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] crypto: arm: workaround for building with old binutils
@ 2015-04-12  9:23     ` Ard Biesheuvel
  0 siblings, 0 replies; 22+ messages in thread
From: Ard Biesheuvel @ 2015-04-12  9:23 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Herbert Xu, linux-kernel, Russell King - ARM Linux, linux-crypto,
	linux-arm-kernel, David S. Miller

On 11 April 2015 at 22:54, Arnd Bergmann <arnd@arndb.de> wrote:
> On Saturday 11 April 2015 15:32:34 Ard Biesheuvel wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>>
>> 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

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH] crypto: arm: workaround for building with old binutils
@ 2015-04-12  9:23     ` Ard Biesheuvel
  0 siblings, 0 replies; 22+ messages in thread
From: Ard Biesheuvel @ 2015-04-12  9:23 UTC (permalink / raw)
  To: linux-arm-kernel

On 11 April 2015 at 22:54, Arnd Bergmann <arnd@arndb.de> wrote:
> On Saturday 11 April 2015 15:32:34 Ard Biesheuvel wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>>
>> 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

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] crypto: arm: workaround for building with old binutils
  2015-04-11 13:32 ` Ard Biesheuvel
@ 2015-04-13  4:12   ` Herbert Xu
  -1 siblings, 0 replies; 22+ messages in thread
From: Herbert Xu @ 2015-04-13  4:12 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: linux-kernel, linux, linux-crypto, linux-arm-kernel, davem, arnd

On Sat, Apr 11, 2015 at 03:32:34PM +0200, Ard Biesheuvel wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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 <arnd@arndb.de>
> 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 <ard.biesheuvel@linaro.org>

Patch applied.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH] crypto: arm: workaround for building with old binutils
@ 2015-04-13  4:12   ` Herbert Xu
  0 siblings, 0 replies; 22+ messages in thread
From: Herbert Xu @ 2015-04-13  4:12 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Apr 11, 2015 at 03:32:34PM +0200, Ard Biesheuvel wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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 <arnd@arndb.de>
> 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 <ard.biesheuvel@linaro.org>

Patch applied.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] crypto: arm: workaround for building with old binutils
  2015-04-11 10:35       ` Ard Biesheuvel
@ 2015-04-11 20:44         ` Arnd Bergmann
  -1 siblings, 0 replies; 22+ messages in thread
From: Arnd Bergmann @ 2015-04-11 20:44 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Ard Biesheuvel, Russell King, Herbert Xu, linux-kernel,
	linux-crypto, David S. Miller

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 <as check>
> 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

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH] crypto: arm: workaround for building with old binutils
@ 2015-04-11 20:44         ` Arnd Bergmann
  0 siblings, 0 replies; 22+ messages in thread
From: Arnd Bergmann @ 2015-04-11 20:44 UTC (permalink / raw)
  To: linux-arm-kernel

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 <as check>
> 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

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] crypto: arm: workaround for building with old binutils
  2015-04-11  8:55     ` Arnd Bergmann
  (?)
@ 2015-04-11 10:35       ` Ard Biesheuvel
  -1 siblings, 0 replies; 22+ messages in thread
From: Ard Biesheuvel @ 2015-04-11 10:35 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Herbert Xu, linux-kernel, Russell King, linux-crypto,
	linux-arm-kernel, David S. Miller


> On 11 apr. 2015, at 10:55, Arnd Bergmann <arnd@arndb.de> 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 <as check>
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.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] crypto: arm: workaround for building with old binutils
@ 2015-04-11 10:35       ` Ard Biesheuvel
  0 siblings, 0 replies; 22+ messages in thread
From: Ard Biesheuvel @ 2015-04-11 10:35 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Herbert Xu, linux-kernel, Russell King, linux-crypto,
	linux-arm-kernel, David S. Miller


> On 11 apr. 2015, at 10:55, Arnd Bergmann <arnd@arndb.de> 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 <as check>
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.


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH] crypto: arm: workaround for building with old binutils
@ 2015-04-11 10:35       ` Ard Biesheuvel
  0 siblings, 0 replies; 22+ messages in thread
From: Ard Biesheuvel @ 2015-04-11 10:35 UTC (permalink / raw)
  To: linux-arm-kernel


> On 11 apr. 2015, at 10:55, Arnd Bergmann <arnd@arndb.de> 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 <as check>
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.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] crypto: arm: workaround for building with old binutils
  2015-04-11  7:41   ` Ard Biesheuvel
  (?)
@ 2015-04-11  8:55     ` Arnd Bergmann
  -1 siblings, 0 replies; 22+ messages in thread
From: Arnd Bergmann @ 2015-04-11  8:55 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: Herbert Xu, linux-kernel, Russell King, linux-crypto,
	linux-arm-kernel, David S. Miller

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

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] crypto: arm: workaround for building with old binutils
@ 2015-04-11  8:55     ` Arnd Bergmann
  0 siblings, 0 replies; 22+ messages in thread
From: Arnd Bergmann @ 2015-04-11  8:55 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: Herbert Xu, linux-kernel, Russell King, linux-crypto,
	linux-arm-kernel, David S. Miller

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

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH] crypto: arm: workaround for building with old binutils
@ 2015-04-11  8:55     ` Arnd Bergmann
  0 siblings, 0 replies; 22+ messages in thread
From: Arnd Bergmann @ 2015-04-11  8:55 UTC (permalink / raw)
  To: linux-arm-kernel

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

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] crypto: arm: workaround for building with old binutils
  2015-04-10 19:57 ` Arnd Bergmann
  (?)
@ 2015-04-11  7:41   ` Ard Biesheuvel
  -1 siblings, 0 replies; 22+ messages in thread
From: Ard Biesheuvel @ 2015-04-11  7:41 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Herbert Xu, linux-kernel, Russell King, linux-crypto,
	linux-arm-kernel, David S. Miller

On 10 April 2015 at 21:57, Arnd Bergmann <arnd@arndb.de> 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 <arnd@arndb.de>
> 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 <linux/linkage.h>
>  #include <asm/assembler.h>
>
>         .text
> -       .fpu            crypto-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 <linux/linkage.h>
>  #include <asm/assembler.h>
>
> @@ -33,8 +37,6 @@
>         XH_L            .req    d14
>
>         .text
> -       .fpu            crypto-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..ab0fe554a6cf 100644
> --- a/arch/arm/crypto/sha1-ce-core.S
> +++ b/arch/arm/crypto/sha1-ce-core.S
> @@ -9,11 +9,14 @@
>   * published by the Free Software Foundation.
>   */
>
> +#ifdef ARMV8_CE_DISABLED
> +#warning ARMv8 Crypto Extensions need binutils 2.23 or higher
> +#else
> +
>  #include <linux/linkage.h>
>  #include <asm/assembler.h>
>
>         .text
> -       .fpu            crypto-neon-fp-armv8
>
>         k0              .req    q0
>         k1              .req    q1
> @@ -132,3 +135,5 @@ ENTRY(sha1_ce_transform)
>         vstr            dgbs, [r2, #16]
>         bx              lr
>  ENDPROC(sha1_ce_transform)
> +
> +#endif
> diff --git a/arch/arm/crypto/sha1-ce-glue.c b/arch/arm/crypto/sha1-ce-glue.c
> index a9dd90df9fd7..045cabad9296 100644
> --- a/arch/arm/crypto/sha1-ce-glue.c
> +++ b/arch/arm/crypto/sha1-ce-glue.c
> @@ -136,13 +136,16 @@ static struct shash_alg alg = {
>
>  static int __init sha1_ce_mod_init(void)
>  {
> -       if (!(elf_hwcap2 & HWCAP2_SHA1))
> +       if (IS_ENABLED(ARMV8_CE_DISABLED) || !(elf_hwcap2 & HWCAP2_AES))
>                 return -ENODEV;
>         return crypto_register_shash(&alg);
>  }
>
>  static void __exit sha1_ce_mod_fini(void)
>  {
> +       if (IS_ENABLED(ARMV8_CE_DISABLED))
> +               return;
> +
>         crypto_unregister_shash(&alg);
>  }
>
> diff --git a/arch/arm/crypto/sha2-ce-core.S b/arch/arm/crypto/sha2-ce-core.S
> index 96af09fe957b..3db821c5f4cd 100644
> --- a/arch/arm/crypto/sha2-ce-core.S
> +++ b/arch/arm/crypto/sha2-ce-core.S
> @@ -9,11 +9,14 @@
>   * published by the Free Software Foundation.
>   */
>
> +#ifdef ARMV8_CE_DISABLED
> +#warning ARMv8 Crypto Extensions need binutils 2.23 or higher
> +#else
> +
>  #include <linux/linkage.h>
>  #include <asm/assembler.h>
>
>         .text
> -       .fpu            crypto-neon-fp-armv8
>
>         k0              .req    q7
>         k1              .req    q8
> @@ -132,3 +135,5 @@ ENTRY(sha2_ce_transform)
>         vst1.32         {dga-dgb}, [r2]
>         bx              lr
>  ENDPROC(sha2_ce_transform)
> +
> +#endif
> diff --git a/arch/arm/crypto/sha2-ce-glue.c b/arch/arm/crypto/sha2-ce-glue.c
> index 0449eca3aab3..3f8010837310 100644
> --- a/arch/arm/crypto/sha2-ce-glue.c
> +++ b/arch/arm/crypto/sha2-ce-glue.c
> @@ -189,13 +189,16 @@ static struct shash_alg algs[] = { {
>
>  static int __init sha2_ce_mod_init(void)
>  {
> -       if (!(elf_hwcap2 & HWCAP2_SHA2))
> +       if (IS_ENABLED(ARMV8_CE_DISABLED) || !(elf_hwcap2 & HWCAP2_AES))
>                 return -ENODEV;
>         return crypto_register_shashes(algs, ARRAY_SIZE(algs));
>  }
>
>  static void __exit sha2_ce_mod_fini(void)
>  {
> +       if (IS_ENABLED(ARMV8_CE_DISABLED))
> +               return;
> +
>         crypto_unregister_shashes(algs, ARRAY_SIZE(algs));
>  }
>
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] crypto: arm: workaround for building with old binutils
@ 2015-04-11  7:41   ` Ard Biesheuvel
  0 siblings, 0 replies; 22+ messages in thread
From: Ard Biesheuvel @ 2015-04-11  7:41 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Herbert Xu, linux-kernel, Russell King, linux-crypto,
	linux-arm-kernel, David S. Miller

On 10 April 2015 at 21:57, Arnd Bergmann <arnd@arndb.de> 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 <arnd@arndb.de>
> 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 <linux/linkage.h>
>  #include <asm/assembler.h>
>
>         .text
> -       .fpu            crypto-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 <linux/linkage.h>
>  #include <asm/assembler.h>
>
> @@ -33,8 +37,6 @@
>         XH_L            .req    d14
>
>         .text
> -       .fpu            crypto-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..ab0fe554a6cf 100644
> --- a/arch/arm/crypto/sha1-ce-core.S
> +++ b/arch/arm/crypto/sha1-ce-core.S
> @@ -9,11 +9,14 @@
>   * published by the Free Software Foundation.
>   */
>
> +#ifdef ARMV8_CE_DISABLED
> +#warning ARMv8 Crypto Extensions need binutils 2.23 or higher
> +#else
> +
>  #include <linux/linkage.h>
>  #include <asm/assembler.h>
>
>         .text
> -       .fpu            crypto-neon-fp-armv8
>
>         k0              .req    q0
>         k1              .req    q1
> @@ -132,3 +135,5 @@ ENTRY(sha1_ce_transform)
>         vstr            dgbs, [r2, #16]
>         bx              lr
>  ENDPROC(sha1_ce_transform)
> +
> +#endif
> diff --git a/arch/arm/crypto/sha1-ce-glue.c b/arch/arm/crypto/sha1-ce-glue.c
> index a9dd90df9fd7..045cabad9296 100644
> --- a/arch/arm/crypto/sha1-ce-glue.c
> +++ b/arch/arm/crypto/sha1-ce-glue.c
> @@ -136,13 +136,16 @@ static struct shash_alg alg = {
>
>  static int __init sha1_ce_mod_init(void)
>  {
> -       if (!(elf_hwcap2 & HWCAP2_SHA1))
> +       if (IS_ENABLED(ARMV8_CE_DISABLED) || !(elf_hwcap2 & HWCAP2_AES))
>                 return -ENODEV;
>         return crypto_register_shash(&alg);
>  }
>
>  static void __exit sha1_ce_mod_fini(void)
>  {
> +       if (IS_ENABLED(ARMV8_CE_DISABLED))
> +               return;
> +
>         crypto_unregister_shash(&alg);
>  }
>
> diff --git a/arch/arm/crypto/sha2-ce-core.S b/arch/arm/crypto/sha2-ce-core.S
> index 96af09fe957b..3db821c5f4cd 100644
> --- a/arch/arm/crypto/sha2-ce-core.S
> +++ b/arch/arm/crypto/sha2-ce-core.S
> @@ -9,11 +9,14 @@
>   * published by the Free Software Foundation.
>   */
>
> +#ifdef ARMV8_CE_DISABLED
> +#warning ARMv8 Crypto Extensions need binutils 2.23 or higher
> +#else
> +
>  #include <linux/linkage.h>
>  #include <asm/assembler.h>
>
>         .text
> -       .fpu            crypto-neon-fp-armv8
>
>         k0              .req    q7
>         k1              .req    q8
> @@ -132,3 +135,5 @@ ENTRY(sha2_ce_transform)
>         vst1.32         {dga-dgb}, [r2]
>         bx              lr
>  ENDPROC(sha2_ce_transform)
> +
> +#endif
> diff --git a/arch/arm/crypto/sha2-ce-glue.c b/arch/arm/crypto/sha2-ce-glue.c
> index 0449eca3aab3..3f8010837310 100644
> --- a/arch/arm/crypto/sha2-ce-glue.c
> +++ b/arch/arm/crypto/sha2-ce-glue.c
> @@ -189,13 +189,16 @@ static struct shash_alg algs[] = { {
>
>  static int __init sha2_ce_mod_init(void)
>  {
> -       if (!(elf_hwcap2 & HWCAP2_SHA2))
> +       if (IS_ENABLED(ARMV8_CE_DISABLED) || !(elf_hwcap2 & HWCAP2_AES))
>                 return -ENODEV;
>         return crypto_register_shashes(algs, ARRAY_SIZE(algs));
>  }
>
>  static void __exit sha2_ce_mod_fini(void)
>  {
> +       if (IS_ENABLED(ARMV8_CE_DISABLED))
> +               return;
> +
>         crypto_unregister_shashes(algs, ARRAY_SIZE(algs));
>  }
>
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH] crypto: arm: workaround for building with old binutils
@ 2015-04-11  7:41   ` Ard Biesheuvel
  0 siblings, 0 replies; 22+ messages in thread
From: Ard Biesheuvel @ 2015-04-11  7:41 UTC (permalink / raw)
  To: linux-arm-kernel

On 10 April 2015 at 21:57, Arnd Bergmann <arnd@arndb.de> 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 <arnd@arndb.de>
> 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 <linux/linkage.h>
>  #include <asm/assembler.h>
>
>         .text
> -       .fpu            crypto-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 <linux/linkage.h>
>  #include <asm/assembler.h>
>
> @@ -33,8 +37,6 @@
>         XH_L            .req    d14
>
>         .text
> -       .fpu            crypto-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..ab0fe554a6cf 100644
> --- a/arch/arm/crypto/sha1-ce-core.S
> +++ b/arch/arm/crypto/sha1-ce-core.S
> @@ -9,11 +9,14 @@
>   * published by the Free Software Foundation.
>   */
>
> +#ifdef ARMV8_CE_DISABLED
> +#warning ARMv8 Crypto Extensions need binutils 2.23 or higher
> +#else
> +
>  #include <linux/linkage.h>
>  #include <asm/assembler.h>
>
>         .text
> -       .fpu            crypto-neon-fp-armv8
>
>         k0              .req    q0
>         k1              .req    q1
> @@ -132,3 +135,5 @@ ENTRY(sha1_ce_transform)
>         vstr            dgbs, [r2, #16]
>         bx              lr
>  ENDPROC(sha1_ce_transform)
> +
> +#endif
> diff --git a/arch/arm/crypto/sha1-ce-glue.c b/arch/arm/crypto/sha1-ce-glue.c
> index a9dd90df9fd7..045cabad9296 100644
> --- a/arch/arm/crypto/sha1-ce-glue.c
> +++ b/arch/arm/crypto/sha1-ce-glue.c
> @@ -136,13 +136,16 @@ static struct shash_alg alg = {
>
>  static int __init sha1_ce_mod_init(void)
>  {
> -       if (!(elf_hwcap2 & HWCAP2_SHA1))
> +       if (IS_ENABLED(ARMV8_CE_DISABLED) || !(elf_hwcap2 & HWCAP2_AES))
>                 return -ENODEV;
>         return crypto_register_shash(&alg);
>  }
>
>  static void __exit sha1_ce_mod_fini(void)
>  {
> +       if (IS_ENABLED(ARMV8_CE_DISABLED))
> +               return;
> +
>         crypto_unregister_shash(&alg);
>  }
>
> diff --git a/arch/arm/crypto/sha2-ce-core.S b/arch/arm/crypto/sha2-ce-core.S
> index 96af09fe957b..3db821c5f4cd 100644
> --- a/arch/arm/crypto/sha2-ce-core.S
> +++ b/arch/arm/crypto/sha2-ce-core.S
> @@ -9,11 +9,14 @@
>   * published by the Free Software Foundation.
>   */
>
> +#ifdef ARMV8_CE_DISABLED
> +#warning ARMv8 Crypto Extensions need binutils 2.23 or higher
> +#else
> +
>  #include <linux/linkage.h>
>  #include <asm/assembler.h>
>
>         .text
> -       .fpu            crypto-neon-fp-armv8
>
>         k0              .req    q7
>         k1              .req    q8
> @@ -132,3 +135,5 @@ ENTRY(sha2_ce_transform)
>         vst1.32         {dga-dgb}, [r2]
>         bx              lr
>  ENDPROC(sha2_ce_transform)
> +
> +#endif
> diff --git a/arch/arm/crypto/sha2-ce-glue.c b/arch/arm/crypto/sha2-ce-glue.c
> index 0449eca3aab3..3f8010837310 100644
> --- a/arch/arm/crypto/sha2-ce-glue.c
> +++ b/arch/arm/crypto/sha2-ce-glue.c
> @@ -189,13 +189,16 @@ static struct shash_alg algs[] = { {
>
>  static int __init sha2_ce_mod_init(void)
>  {
> -       if (!(elf_hwcap2 & HWCAP2_SHA2))
> +       if (IS_ENABLED(ARMV8_CE_DISABLED) || !(elf_hwcap2 & HWCAP2_AES))
>                 return -ENODEV;
>         return crypto_register_shashes(algs, ARRAY_SIZE(algs));
>  }
>
>  static void __exit sha2_ce_mod_fini(void)
>  {
> +       if (IS_ENABLED(ARMV8_CE_DISABLED))
> +               return;
> +
>         crypto_unregister_shashes(algs, ARRAY_SIZE(algs));
>  }
>
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH] crypto: arm: workaround for building with old binutils
@ 2015-04-10 19:57 ` Arnd Bergmann
  0 siblings, 0 replies; 22+ messages in thread
From: Arnd Bergmann @ 2015-04-10 19:57 UTC (permalink / raw)
  To: Herbert Xu
  Cc: linux-crypto, David S. Miller, Russell King, linux-arm-kernel,
	linux-kernel

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 <arnd@arndb.de>
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 <linux/linkage.h>
 #include <asm/assembler.h>
 
 	.text
-	.fpu		crypto-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 <linux/linkage.h>
 #include <asm/assembler.h>
 
@@ -33,8 +37,6 @@
 	XH_L		.req	d14
 
 	.text
-	.fpu		crypto-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..ab0fe554a6cf 100644
--- a/arch/arm/crypto/sha1-ce-core.S
+++ b/arch/arm/crypto/sha1-ce-core.S
@@ -9,11 +9,14 @@
  * published by the Free Software Foundation.
  */
 
+#ifdef ARMV8_CE_DISABLED
+#warning ARMv8 Crypto Extensions need binutils 2.23 or higher
+#else
+
 #include <linux/linkage.h>
 #include <asm/assembler.h>
 
 	.text
-	.fpu		crypto-neon-fp-armv8
 
 	k0		.req	q0
 	k1		.req	q1
@@ -132,3 +135,5 @@ ENTRY(sha1_ce_transform)
 	vstr		dgbs, [r2, #16]
 	bx		lr
 ENDPROC(sha1_ce_transform)
+
+#endif
diff --git a/arch/arm/crypto/sha1-ce-glue.c b/arch/arm/crypto/sha1-ce-glue.c
index a9dd90df9fd7..045cabad9296 100644
--- a/arch/arm/crypto/sha1-ce-glue.c
+++ b/arch/arm/crypto/sha1-ce-glue.c
@@ -136,13 +136,16 @@ static struct shash_alg alg = {
 
 static int __init sha1_ce_mod_init(void)
 {
-	if (!(elf_hwcap2 & HWCAP2_SHA1))
+	if (IS_ENABLED(ARMV8_CE_DISABLED) || !(elf_hwcap2 & HWCAP2_AES))
 		return -ENODEV;
 	return crypto_register_shash(&alg);
 }
 
 static void __exit sha1_ce_mod_fini(void)
 {
+	if (IS_ENABLED(ARMV8_CE_DISABLED))
+		return;
+
 	crypto_unregister_shash(&alg);
 }
 
diff --git a/arch/arm/crypto/sha2-ce-core.S b/arch/arm/crypto/sha2-ce-core.S
index 96af09fe957b..3db821c5f4cd 100644
--- a/arch/arm/crypto/sha2-ce-core.S
+++ b/arch/arm/crypto/sha2-ce-core.S
@@ -9,11 +9,14 @@
  * published by the Free Software Foundation.
  */
 
+#ifdef ARMV8_CE_DISABLED
+#warning ARMv8 Crypto Extensions need binutils 2.23 or higher
+#else
+
 #include <linux/linkage.h>
 #include <asm/assembler.h>
 
 	.text
-	.fpu		crypto-neon-fp-armv8
 
 	k0		.req	q7
 	k1		.req	q8
@@ -132,3 +135,5 @@ ENTRY(sha2_ce_transform)
 	vst1.32		{dga-dgb}, [r2]
 	bx		lr
 ENDPROC(sha2_ce_transform)
+
+#endif
diff --git a/arch/arm/crypto/sha2-ce-glue.c b/arch/arm/crypto/sha2-ce-glue.c
index 0449eca3aab3..3f8010837310 100644
--- a/arch/arm/crypto/sha2-ce-glue.c
+++ b/arch/arm/crypto/sha2-ce-glue.c
@@ -189,13 +189,16 @@ static struct shash_alg algs[] = { {
 
 static int __init sha2_ce_mod_init(void)
 {
-	if (!(elf_hwcap2 & HWCAP2_SHA2))
+	if (IS_ENABLED(ARMV8_CE_DISABLED) || !(elf_hwcap2 & HWCAP2_AES))
 		return -ENODEV;
 	return crypto_register_shashes(algs, ARRAY_SIZE(algs));
 }
 
 static void __exit sha2_ce_mod_fini(void)
 {
+	if (IS_ENABLED(ARMV8_CE_DISABLED))
+		return;
+
 	crypto_unregister_shashes(algs, ARRAY_SIZE(algs));
 }
 

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH] crypto: arm: workaround for building with old binutils
@ 2015-04-10 19:57 ` Arnd Bergmann
  0 siblings, 0 replies; 22+ messages in thread
From: Arnd Bergmann @ 2015-04-10 19:57 UTC (permalink / raw)
  To: linux-arm-kernel

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 <arnd@arndb.de>
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 <linux/linkage.h>
 #include <asm/assembler.h>
 
 	.text
-	.fpu		crypto-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 <linux/linkage.h>
 #include <asm/assembler.h>
 
@@ -33,8 +37,6 @@
 	XH_L		.req	d14
 
 	.text
-	.fpu		crypto-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..ab0fe554a6cf 100644
--- a/arch/arm/crypto/sha1-ce-core.S
+++ b/arch/arm/crypto/sha1-ce-core.S
@@ -9,11 +9,14 @@
  * published by the Free Software Foundation.
  */
 
+#ifdef ARMV8_CE_DISABLED
+#warning ARMv8 Crypto Extensions need binutils 2.23 or higher
+#else
+
 #include <linux/linkage.h>
 #include <asm/assembler.h>
 
 	.text
-	.fpu		crypto-neon-fp-armv8
 
 	k0		.req	q0
 	k1		.req	q1
@@ -132,3 +135,5 @@ ENTRY(sha1_ce_transform)
 	vstr		dgbs, [r2, #16]
 	bx		lr
 ENDPROC(sha1_ce_transform)
+
+#endif
diff --git a/arch/arm/crypto/sha1-ce-glue.c b/arch/arm/crypto/sha1-ce-glue.c
index a9dd90df9fd7..045cabad9296 100644
--- a/arch/arm/crypto/sha1-ce-glue.c
+++ b/arch/arm/crypto/sha1-ce-glue.c
@@ -136,13 +136,16 @@ static struct shash_alg alg = {
 
 static int __init sha1_ce_mod_init(void)
 {
-	if (!(elf_hwcap2 & HWCAP2_SHA1))
+	if (IS_ENABLED(ARMV8_CE_DISABLED) || !(elf_hwcap2 & HWCAP2_AES))
 		return -ENODEV;
 	return crypto_register_shash(&alg);
 }
 
 static void __exit sha1_ce_mod_fini(void)
 {
+	if (IS_ENABLED(ARMV8_CE_DISABLED))
+		return;
+
 	crypto_unregister_shash(&alg);
 }
 
diff --git a/arch/arm/crypto/sha2-ce-core.S b/arch/arm/crypto/sha2-ce-core.S
index 96af09fe957b..3db821c5f4cd 100644
--- a/arch/arm/crypto/sha2-ce-core.S
+++ b/arch/arm/crypto/sha2-ce-core.S
@@ -9,11 +9,14 @@
  * published by the Free Software Foundation.
  */
 
+#ifdef ARMV8_CE_DISABLED
+#warning ARMv8 Crypto Extensions need binutils 2.23 or higher
+#else
+
 #include <linux/linkage.h>
 #include <asm/assembler.h>
 
 	.text
-	.fpu		crypto-neon-fp-armv8
 
 	k0		.req	q7
 	k1		.req	q8
@@ -132,3 +135,5 @@ ENTRY(sha2_ce_transform)
 	vst1.32		{dga-dgb}, [r2]
 	bx		lr
 ENDPROC(sha2_ce_transform)
+
+#endif
diff --git a/arch/arm/crypto/sha2-ce-glue.c b/arch/arm/crypto/sha2-ce-glue.c
index 0449eca3aab3..3f8010837310 100644
--- a/arch/arm/crypto/sha2-ce-glue.c
+++ b/arch/arm/crypto/sha2-ce-glue.c
@@ -189,13 +189,16 @@ static struct shash_alg algs[] = { {
 
 static int __init sha2_ce_mod_init(void)
 {
-	if (!(elf_hwcap2 & HWCAP2_SHA2))
+	if (IS_ENABLED(ARMV8_CE_DISABLED) || !(elf_hwcap2 & HWCAP2_AES))
 		return -ENODEV;
 	return crypto_register_shashes(algs, ARRAY_SIZE(algs));
 }
 
 static void __exit sha2_ce_mod_fini(void)
 {
+	if (IS_ENABLED(ARMV8_CE_DISABLED))
+		return;
+
 	crypto_unregister_shashes(algs, ARRAY_SIZE(algs));
 }
 

^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2015-04-13  4:12 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-11 13:32 [PATCH] crypto: arm: workaround for building with old binutils Ard Biesheuvel
2015-04-11 13:32 ` Ard Biesheuvel
2015-04-11 20:54 ` Arnd Bergmann
2015-04-11 20:54   ` Arnd Bergmann
2015-04-12  9:23   ` Ard Biesheuvel
2015-04-12  9:23     ` Ard Biesheuvel
2015-04-12  9:23     ` Ard Biesheuvel
2015-04-13  4:12 ` Herbert Xu
2015-04-13  4:12   ` Herbert Xu
  -- strict thread matches above, loose matches on Subject: below --
2015-04-10 19:57 Arnd Bergmann
2015-04-10 19:57 ` Arnd Bergmann
2015-04-11  7:41 ` Ard Biesheuvel
2015-04-11  7:41   ` Ard Biesheuvel
2015-04-11  7:41   ` Ard Biesheuvel
2015-04-11  8:55   ` Arnd Bergmann
2015-04-11  8:55     ` Arnd Bergmann
2015-04-11  8:55     ` Arnd Bergmann
2015-04-11 10:35     ` Ard Biesheuvel
2015-04-11 10:35       ` Ard Biesheuvel
2015-04-11 10:35       ` Ard Biesheuvel
2015-04-11 20:44       ` Arnd Bergmann
2015-04-11 20:44         ` Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.