diff mbox series

[2/2] crypto: arm - add build time test for CRC instruction support

Message ID 1488292617-27317-2-git-send-email-ard.biesheuvel@linaro.org
State Accepted
Commit efa7cebdbfde8506b54acd8947822394768cd476
Headers show
Series [1/2] crypto: arm/crc32 - fix build error with outdated binutils | expand

Commit Message

Ard Biesheuvel Feb. 28, 2017, 2:36 p.m. UTC
The accelerated CRC32 module for ARM may use either the scalar CRC32
instructions, the NEON 64x64 to 128 bit polynomial multiplication
(vmull.p64) instruction, or both, depending on what the current CPU
supports.

However, this also requires support in binutils, and as it turns out,
versions of binutils exist that support the vmull.p64 instruction but
not the crc32 instructions.

So refactor the Makefile logic so that this module only gets built if
binutils has support for both.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

---
 arch/arm/crypto/Makefile | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

-- 
2.7.4

Comments

Jon Hunter Feb. 28, 2017, 3:54 p.m. UTC | #1
On 28/02/17 14:36, Ard Biesheuvel wrote:
> The accelerated CRC32 module for ARM may use either the scalar CRC32

> instructions, the NEON 64x64 to 128 bit polynomial multiplication

> (vmull.p64) instruction, or both, depending on what the current CPU

> supports.

> 

> However, this also requires support in binutils, and as it turns out,

> versions of binutils exist that support the vmull.p64 instruction but

> not the crc32 instructions.

> 

> So refactor the Makefile logic so that this module only gets built if

> binutils has support for both.

> 

> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>


Thanks!

Acked-by: Jon Hunter <jonathanh@nvidia.com>

Tested-by: Jon Hunter <jonathanh@nvidia.com>


Cheers
Jon

-- 
nvpublic
Herbert Xu March 1, 2017, 11:52 a.m. UTC | #2
On Tue, Feb 28, 2017 at 02:36:57PM +0000, Ard Biesheuvel wrote:
> The accelerated CRC32 module for ARM may use either the scalar CRC32

> instructions, the NEON 64x64 to 128 bit polynomial multiplication

> (vmull.p64) instruction, or both, depending on what the current CPU

> supports.

> 

> However, this also requires support in binutils, and as it turns out,

> versions of binutils exist that support the vmull.p64 instruction but

> not the crc32 instructions.

> 

> So refactor the Makefile logic so that this module only gets built if

> binutils has support for both.

> 

> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>


Patch applied.  Thanks.
-- 
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
diff mbox series

Patch

diff --git a/arch/arm/crypto/Makefile b/arch/arm/crypto/Makefile
index 1822c4697278..f2215fbeed13 100644
--- a/arch/arm/crypto/Makefile
+++ b/arch/arm/crypto/Makefile
@@ -15,7 +15,17 @@  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
 ce-obj-$(CONFIG_CRYPTO_CRCT10DIF_ARM_CE) += crct10dif-arm-ce.o
-ce-obj-$(CONFIG_CRYPTO_CRC32_ARM_CE) += crc32-arm-ce.o
+crc-obj-$(CONFIG_CRYPTO_CRC32_ARM_CE) += crc32-arm-ce.o
+
+ifneq ($(crc-obj-y)$(crc-obj-m),)
+ifeq ($(call as-instr,.arch armv8-a\n.arch_extension crc,y,n),y)
+ce-obj-y += $(crc-obj-y)
+ce-obj-m += $(crc-obj-m)
+else
+$(warning These CRC Extensions modules need binutils 2.23 or higher)
+$(warning $(crc-obj-y) $(crc-obj-m))
+endif
+endif
 
 ifneq ($(ce-obj-y)$(ce-obj-m),)
 ifeq ($(call as-instr,.fpu crypto-neon-fp-armv8,y,n),y)