All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: linux-arm-kernel@lists.infradead.org
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	"samitolvanen@google.com" <samitolvanen@google.com>,
	"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
	"herbert@gondor.apana.org.au" <herbert@gondor.apana.org.au>
Subject: Re: [PATCH v2] crypto/arm: accelerated SHA-512 using ARM generic ASM and NEON
Date: Sat, 11 Apr 2015 10:48:44 +0200	[thread overview]
Message-ID: <2845656.4sNJ3XBxnz@wuerfel> (raw)
In-Reply-To: <CAKv+Gu-6mZwrVSCvS+ZWWwwM-294nWAqX4_J3r5Z8NM7KKC0=Q@mail.gmail.com>

On Saturday 11 April 2015 09:35:15 Ard Biesheuvel wrote:
> On 10 April 2015 at 22:23, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> >
> >> On 10 apr. 2015, at 22:08, Arnd Bergmann <arnd@arndb.de> wrote:
> >>
> >>> On Friday 10 April 2015 16:29:08 Ard Biesheuvel wrote:
> >>> +#if __ARM_MAX_ARCH__>=7
> >>> +.arch  armv7-a
> >>> +.fpu   neon
> >>> +
> >>
> >> This will cause a build failure on an ARMv7-M build, which is incompatible
> >> with .arch  armv7-a and .fpu   neon.
> >>
> >
> > The neon part depends on CONFIG_KERNEL_MODE_NEON, which would never be set for that platform, I suppose
> 
> On second thought, that is not entirely true, but I still don't think
> there is problem here:
> the .arch/.fpu declarations are understood perfectly fine by GAS when
> targeting ARMv7-M. Only, it will emit code that is incompatible with
> it. However, this code is invoked at runtime only if a NEON unit has
> been detected, so it will just be ignored on ARMv7-M

Sorry, I should have collected my findings better when replying to your
patch. What I remembered was that I saw a problem in this area in linux-next
with randconfig builds, but I did not notice that it was for a different
file, and I had not double-checked that patch yet in order to send it
out.

See below for the patch I'm currently using for my randconfig builder.
Before you apply this, please check again which files are affected, as
it's possible that there are other modules that suffer from the same
problem.

	Arnd

8<-----------
Subject: [PATCH] ARM: crypto: avoid sha256 code on ARMv7-M

The sha256 assembly implementation can deal with all architecture levels
from ARMv4 to ARMv7-A, but not with ARMv7-M. Enabling it in an
ARMv7-M kernel results in this build failure:

arm-linux-gnueabi-ld: error: arch/arm/crypto/sha256_glue.o: Conflicting architecture profiles M/A
arm-linux-gnueabi-ld: failed to merge target specific data of file arch/arm/crypto/sha256_glue.o

This adds a Kconfig dependency to prevent the code from being disabled
for ARMv7-M.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

diff --git a/arch/arm/crypto/Kconfig b/arch/arm/crypto/Kconfig
index 458729d2ce22..76463da22f81 100644
--- a/arch/arm/crypto/Kconfig
+++ b/arch/arm/crypto/Kconfig
@@ -49,6 +49,7 @@ config CRYPTO_SHA2_ARM_CE
 config CRYPTO_SHA256_ARM
 	tristate "SHA-224/256 digest algorithm (ARM-asm and NEON)"
 	select CRYPTO_HASH
+	depends on !CPU_V7M
 	help
 	  SHA-256 secure hash standard (DFIPS 180-2) implemented
 	  using optimized ARM assembler and NEON, when available.

WARNING: multiple messages have this Message-ID (diff)
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] crypto/arm: accelerated SHA-512 using ARM generic ASM and NEON
Date: Sat, 11 Apr 2015 10:48:44 +0200	[thread overview]
Message-ID: <2845656.4sNJ3XBxnz@wuerfel> (raw)
In-Reply-To: <CAKv+Gu-6mZwrVSCvS+ZWWwwM-294nWAqX4_J3r5Z8NM7KKC0=Q@mail.gmail.com>

On Saturday 11 April 2015 09:35:15 Ard Biesheuvel wrote:
> On 10 April 2015 at 22:23, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> >
> >> On 10 apr. 2015, at 22:08, Arnd Bergmann <arnd@arndb.de> wrote:
> >>
> >>> On Friday 10 April 2015 16:29:08 Ard Biesheuvel wrote:
> >>> +#if __ARM_MAX_ARCH__>=7
> >>> +.arch  armv7-a
> >>> +.fpu   neon
> >>> +
> >>
> >> This will cause a build failure on an ARMv7-M build, which is incompatible
> >> with .arch  armv7-a and .fpu   neon.
> >>
> >
> > The neon part depends on CONFIG_KERNEL_MODE_NEON, which would never be set for that platform, I suppose
> 
> On second thought, that is not entirely true, but I still don't think
> there is problem here:
> the .arch/.fpu declarations are understood perfectly fine by GAS when
> targeting ARMv7-M. Only, it will emit code that is incompatible with
> it. However, this code is invoked at runtime only if a NEON unit has
> been detected, so it will just be ignored on ARMv7-M

Sorry, I should have collected my findings better when replying to your
patch. What I remembered was that I saw a problem in this area in linux-next
with randconfig builds, but I did not notice that it was for a different
file, and I had not double-checked that patch yet in order to send it
out.

See below for the patch I'm currently using for my randconfig builder.
Before you apply this, please check again which files are affected, as
it's possible that there are other modules that suffer from the same
problem.

	Arnd

8<-----------
Subject: [PATCH] ARM: crypto: avoid sha256 code on ARMv7-M

The sha256 assembly implementation can deal with all architecture levels
from ARMv4 to ARMv7-A, but not with ARMv7-M. Enabling it in an
ARMv7-M kernel results in this build failure:

arm-linux-gnueabi-ld: error: arch/arm/crypto/sha256_glue.o: Conflicting architecture profiles M/A
arm-linux-gnueabi-ld: failed to merge target specific data of file arch/arm/crypto/sha256_glue.o

This adds a Kconfig dependency to prevent the code from being disabled
for ARMv7-M.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

diff --git a/arch/arm/crypto/Kconfig b/arch/arm/crypto/Kconfig
index 458729d2ce22..76463da22f81 100644
--- a/arch/arm/crypto/Kconfig
+++ b/arch/arm/crypto/Kconfig
@@ -49,6 +49,7 @@ config CRYPTO_SHA2_ARM_CE
 config CRYPTO_SHA256_ARM
 	tristate "SHA-224/256 digest algorithm (ARM-asm and NEON)"
 	select CRYPTO_HASH
+	depends on !CPU_V7M
 	help
 	  SHA-256 secure hash standard (DFIPS 180-2) implemented
 	  using optimized ARM assembler and NEON, when available.

  reply	other threads:[~2015-04-11  8:48 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-10 14:29 [PATCH v2] crypto/arm: accelerated SHA-512 using ARM generic ASM and NEON Ard Biesheuvel
2015-04-10 14:29 ` Ard Biesheuvel
2015-04-10 20:08 ` Arnd Bergmann
2015-04-10 20:08   ` Arnd Bergmann
2015-04-10 20:23   ` Ard Biesheuvel
2015-04-10 20:23     ` Ard Biesheuvel
2015-04-11  7:35     ` Ard Biesheuvel
2015-04-11  7:35       ` Ard Biesheuvel
2015-04-11  8:48       ` Arnd Bergmann [this message]
2015-04-11  8:48         ` Arnd Bergmann
2015-04-11 10:27         ` Ard Biesheuvel
2015-04-11 10:27           ` Ard Biesheuvel
2015-04-11 20:43           ` Arnd Bergmann
2015-04-11 20:43             ` Arnd Bergmann
2015-04-11 19:15         ` Ard Biesheuvel
2015-04-11 19:15           ` Ard Biesheuvel
2015-04-13  4:13           ` Herbert Xu
2015-04-13  4:13             ` Herbert Xu
2015-04-13  9:34             ` Ard Biesheuvel
2015-04-13  9:34               ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2845656.4sNJ3XBxnz@wuerfel \
    --to=arnd@arndb.de \
    --cc=ard.biesheuvel@linaro.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=samitolvanen@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.