Skip to contentSkip to conversation

crypto: aesni - fix build on x86 (32bit)

PATCH In review Andy Shevchenko 5 participants 15 messages Dec 30, 2013 – Jan 15, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: aesni - fix build on x86 (32bit)

It seems commit d764593a "crypto: aesni - AVX and AVX2 version of AESNI-GCM encode and decode" breaks a build on x86_32 since it's designed only for x86_64. This patch makes a compilation unit conditional to CONFIG_64BIT and functions usage to CONFIG_X86_64.

---
 arch/x86/crypto/Makefile           | 3 ++-
 arch/x86/crypto/aesni-intel_glue.c | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)
arch/x86/crypto/Makefile +2 -1
index 84ee1e1..188b993 100644
@@ -75,7 +75,8 @@ ifeq ($(avx2_supported),yes)
 	serpent-avx2-y := serpent-avx2-asm_64.o serpent_avx2_glue.o
 endif
 
-aesni-intel-y := aesni-intel_asm.o aesni-intel_avx.o aesni-intel_glue.o fpu.o
+aesni-intel-y := aesni-intel_asm.o aesni-intel_glue.o fpu.o
+aesni-intel-$(CONFIG_64BIT) += aesni-intel_avx.o
 ghash-clmulni-intel-y := ghash-clmulni-intel_asm.o ghash-clmulni-intel_glue.o
 sha1-ssse3-y := sha1_ssse3_asm.o sha1_ssse3_glue.o
 crc32c-intel-y := crc32c-intel_glue.o
arch/x86/crypto/aesni-intel_glue.c +2 -0
index 3ae311d..948ad0e 100644
@@ -1473,6 +1473,7 @@ static int __init aesni_init(void)
 
 	if (!x86_match_cpu(aesni_cpu_id))
 		return -ENODEV;
+#ifdef CONFIG_X86_64
 #ifdef CONFIG_AS_AVX2
 	if (boot_cpu_has(X86_FEATURE_AVX2)) {
 		pr_info("AVX2 version of gcm_enc/dec engaged.\n");
@@ -1492,6 +1493,7 @@ static int __init aesni_init(void)
 		aesni_gcm_enc_tfm = aesni_gcm_enc;
 		aesni_gcm_dec_tfm = aesni_gcm_dec;
 	}
+#endif
 
 	err = crypto_fpu_init();
 	if (err)
Signature · 1 line
1.8.5.2
maintainer
#1 lore raw
Quoted 6 lines · Andy Shevchenko

It seems commit d764593a "crypto: aesni - AVX and AVX2 version of AESNI-GCM encode and decode" breaks a build on x86_32 since it's designed only for x86_64. This patch makes a compilation unit conditional to CONFIG_64BIT and functions usage to CONFIG_X86_64.

Patch applied. Thanks a lot!

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#2 lore raw
In reply to Andy Shevchenko
Quoted 4 lines · Andy Shevchenko

It seems commit d764593a "crypto: aesni - AVX and AVX2 version of AESNI-GCM encode and decode" breaks a build on x86_32 since it's designed only for x86_64. This patch makes a compilation unit conditional to CONFIG_64BIT and functions usage to CONFIG_X86_64.

Thanks for catching and fixing it.

Tim

Quoted 2 lines
#3 lore raw

Can the code be adjusted to compile for 32 bit x86 or is that pointless?

Quoted 16 lines · Tim Chen
Quoted 1 line · Andy Shevchenko

It seems commit d764593a "crypto: aesni - AVX and AVX2 version of

AESNI-GCM

Quoted 1 line

encode and decode" breaks a build on x86_32 since it's designed only

for

Quoted 1 line

x86_64. This patch makes a compilation unit conditional to

CONFIG_64BIT and

Quoted 1 line

functions usage to CONFIG_X86_64.

Thanks for catching and fixing it.

Tim

Quoted 2 lines
Signature · 1 line
Sent from my mobile phone.  Please pardon brevity and lack of formatting.
#4 lore raw
Quoted 2 lines · H. Peter Anvin

Can the code be adjusted to compile for 32 bit x86 or is that pointless?

Code was optimized for wide registers. So it is only meant for x86_64.

Tim

Quoted 18 lines
Quoted 16 lines · Tim Chen
Quoted 1 line · Andy Shevchenko

It seems commit d764593a "crypto: aesni - AVX and AVX2 version of

AESNI-GCM

Quoted 1 line

encode and decode" breaks a build on x86_32 since it's designed only

for

Quoted 1 line

x86_64. This patch makes a compilation unit conditional to

CONFIG_64BIT and

Quoted 1 line

functions usage to CONFIG_X86_64.

Thanks for catching and fixing it.

Tim

Quoted 2 lines
#5 lore raw
Quoted 6 lines · Tim Chen
Quoted 2 lines · H. Peter Anvin

Can the code be adjusted to compile for 32 bit x86 or is that pointless?

Code was optimized for wide registers. So it is only meant for x86_64.

Aren't the "wide registers" the vector registers? Or are you also relying on 64-bit integer registers (in which case we should just rename the file to make it clear it is x86-64 only.)

-hpa

#6 lore raw
Quoted 5 lines · H. Peter Anvin
Quoted 4 lines · Tim Chen
Quoted 2 lines · H. Peter Anvin

Can the code be adjusted to compile for 32 bit x86 or is that pointless?

Quoted 10 lines
Quoted 2 lines

Code was optimized for wide registers. So it is only meant for x86_64.

Aren't the "wide registers" the vector registers? Or are you also relying on 64-bit integer registers (in which case we should just rename the file to make it clear it is x86-64 only.)

-hpa

Yes, the code is in the file named aesni_intel_avx.S. So it should be clear that the code is meant for x86_64.

Tim

maintainer
#7 lore raw
Quoted 2 lines · Tim Chen

Yes, the code is in the file named aesni_intel_avx.S. So it should be clear that the code is meant for x86_64.

How do you deduce aesni_intel_avx.S is meant for x86_64 only from the name?

Shouldn't it be called aesni_intel_avx-x86_64.S, as is the naming convention in arch/x86/crypto/

?

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
#8 lore raw
Quoted 10 lines · Borislav Petkov
Quoted 2 lines · Tim Chen

Yes, the code is in the file named aesni_intel_avx.S. So it should be clear that the code is meant for x86_64.

How do you deduce aesni_intel_avx.S is meant for x86_64 only from the name?

Shouldn't it be called aesni_intel_avx-x86_64.S, as is the naming convention in arch/x86/crypto/

Quite.

-hpa

#9 lore raw
Quoted 8 lines · H. Peter Anvin
Quoted 7 lines · Borislav Petkov
Quoted 2 lines · Tim Chen

Yes, the code is in the file named aesni_intel_avx.S. So it should be clear that the code is meant for x86_64.

How do you deduce aesni_intel_avx.S is meant for x86_64 only from the name?

Quoted 9 lines
Quoted 3 lines

Shouldn't it be called aesni_intel_avx-x86_64.S, as is the naming convention in arch/x86/crypto/

Quite.

-hpa

Will renaming the file to aesni_intel_avx-x86_64.S make things clearer now?

Tim

---cut---here---

Quoted 1 line

From 41656afcbd63ccb92357d4937a75629499f4fd4f Mon Sep 17 00:00:00 2001

From: Tim Chen <[email protected]>
Date: Mon, 6 Jan 2014 07:23:52 -0800
Subject: [PATCH] crypto: Rename aesni-intel_avx.S to indicate it only
supports x86_64
To: Herbert Xu <[email protected]>, H. Peter Anvin <[email protected]>
Cc: Borislav Petkov <[email protected]>, Andy Shevchenko <[email protected]>, [email protected]

We rename aesni-intel_avx.S to aesni-intel_avx-x86_64.S to indicate that it is only used by x86_64 architecture.

---
 arch/x86/crypto/Makefile                                        | 2 +-
 arch/x86/crypto/{aesni-intel_avx.S => aesni-intel_avx-x86_64.S} | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename arch/x86/crypto/{aesni-intel_avx.S => aesni-intel_avx-x86_64.S} (100%)
arch/x86/crypto/Makefile +1 -1
index 188b993..6ba54d6 100644
@@ -76,7 +76,7 @@ ifeq ($(avx2_supported),yes)
 endif
 
 aesni-intel-y := aesni-intel_asm.o aesni-intel_glue.o fpu.o
-aesni-intel-$(CONFIG_64BIT) += aesni-intel_avx.o
+aesni-intel-$(CONFIG_64BIT) += aesni-intel_avx-x86_64.o
 ghash-clmulni-intel-y := ghash-clmulni-intel_asm.o ghash-clmulni-intel_glue.o
 sha1-ssse3-y := sha1_ssse3_asm.o sha1_ssse3_glue.o
 crc32c-intel-y := crc32c-intel_glue.o
arch/x86/crypto/aesni-intel_avx-x86_64.S renamed from arch/x86/crypto/aesni-intel_avx.S +0 -0
similarity index 100%
rename from arch/x86/crypto/aesni-intel_avx.S
rename to arch/x86/crypto/aesni-intel_avx-x86_64.S
Signature · 1 line
1.7.11.7
maintainer
#11 lore raw
Quoted 5 lines · H. Peter Anvin
Quoted 4 lines · Tim Chen

Will renaming the file to aesni_intel_avx-x86_64.S make things clearer now?

Quoted 7 lines
Quoted 1 line

Tim

Yes.

Herbert, can you pick it up?

Sure I'll apply this patch.

Thanks!

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
maintainer
#12 lore raw
In reply to Tim Chen
Quoted 34 lines · Tim Chen
Quoted 8 lines · H. Peter Anvin
Quoted 7 lines · Borislav Petkov
Quoted 2 lines · Tim Chen

Yes, the code is in the file named aesni_intel_avx.S. So it should be clear that the code is meant for x86_64.

How do you deduce aesni_intel_avx.S is meant for x86_64 only from the name?

Quoted 9 lines
Quoted 3 lines

Shouldn't it be called aesni_intel_avx-x86_64.S, as is the naming convention in arch/x86/crypto/

Quite.

-hpa

Will renaming the file to aesni_intel_avx-x86_64.S make things clearer now?

Tim

---cut---here---

Quoted 1 line

From 41656afcbd63ccb92357d4937a75629499f4fd4f Mon Sep 17 00:00:00 2001

From: Tim Chen <[email protected]>
Date: Mon, 6 Jan 2014 07:23:52 -0800
Subject: [PATCH] crypto: Rename aesni-intel_avx.S to indicate it only
supports x86_64
To: Herbert Xu <[email protected]>, H. Peter Anvin <[email protected]>
Cc: Borislav Petkov <[email protected]>, Andy Shevchenko <[email protected]>, [email protected]

Quoted 2 lines

We rename aesni-intel_avx.S to aesni-intel_avx-x86_64.S to indicate that it is only used by x86_64 architecture.

Hmm, where is the signed-off-by line? Please resend. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#13 lore raw
Quoted 35 lines · Herbert Xu
Quoted 34 lines · Tim Chen
Quoted 8 lines · H. Peter Anvin
Quoted 7 lines · Borislav Petkov
Quoted 2 lines · Tim Chen

Yes, the code is in the file named aesni_intel_avx.S. So it should be clear that the code is meant for x86_64.

How do you deduce aesni_intel_avx.S is meant for x86_64 only from the name?

Quoted 9 lines
Quoted 3 lines

Shouldn't it be called aesni_intel_avx-x86_64.S, as is the naming convention in arch/x86/crypto/

Quite.

-hpa

Will renaming the file to aesni_intel_avx-x86_64.S make things clearer now?

Tim

---cut---here---

Quoted 1 line

From 41656afcbd63ccb92357d4937a75629499f4fd4f Mon Sep 17 00:00:00 2001

From: Tim Chen <[email protected]>
Date: Mon, 6 Jan 2014 07:23:52 -0800
Subject: [PATCH] crypto: Rename aesni-intel_avx.S to indicate it only
supports x86_64
To: Herbert Xu <[email protected]>, H. Peter Anvin <[email protected]>
Cc: Borislav Petkov <[email protected]>, Andy Shevchenko <[email protected]>, [email protected]

Quoted 4 lines
Quoted 2 lines

We rename aesni-intel_avx.S to aesni-intel_avx-x86_64.S to indicate that it is only used by x86_64 architecture.

Hmm, where is the signed-off-by line? Please resend. Thanks.

Oops, here it is again.

Tim

---cut---here---

Quoted 1 line

From 41656afcbd63ccb92357d4937a75629499f4fd4f Mon Sep 17 00:00:00 2001

From: Tim Chen <[email protected]>
Date: Mon, 6 Jan 2014 07:23:52 -0800
Subject: [PATCH] crypto: Rename aesni-intel_avx.S to indicate it only
supports x86_64
To: Herbert Xu <[email protected]>, H. Peter Anvin <[email protected]>
Cc: Borislav Petkov <[email protected]>, Andy Shevchenko <[email protected]>, [email protected]

We rename aesni-intel_avx.S to aesni-intel_avx-x86_64.S to indicate that it is only used by x86_64 architecture.

---
 arch/x86/crypto/Makefile                                        | 2 +-
 arch/x86/crypto/{aesni-intel_avx.S => aesni-intel_avx-x86_64.S} | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename arch/x86/crypto/{aesni-intel_avx.S => aesni-intel_avx-x86_64.S} (100%)

---

arch/x86/crypto/Makefile +1 -1
index 188b993..6ba54d6 100644
@@ -76,7 +76,7 @@ ifeq ($(avx2_supported),yes)
 endif
 
 aesni-intel-y := aesni-intel_asm.o aesni-intel_glue.o fpu.o
-aesni-intel-$(CONFIG_64BIT) += aesni-intel_avx.o
+aesni-intel-$(CONFIG_64BIT) += aesni-intel_avx-x86_64.o
 ghash-clmulni-intel-y := ghash-clmulni-intel_asm.o ghash-clmulni-intel_glue.o
 sha1-ssse3-y := sha1_ssse3_asm.o sha1_ssse3_glue.o
 crc32c-intel-y := crc32c-intel_glue.o
arch/x86/crypto/aesni-intel_avx-x86_64.S renamed from arch/x86/crypto/aesni-intel_avx.S +0 -0
similarity index 100%
rename from arch/x86/crypto/aesni-intel_avx.S
rename to arch/x86/crypto/aesni-intel_avx-x86_64.S
Signature · 1 line
1.7.11.7
maintainer
#14 lore raw
Quoted 11 lines · Tim Chen
Quoted 2 lines

From 41656afcbd63ccb92357d4937a75629499f4fd4f Mon Sep 17 00:00:00 2001

From: Tim Chen <[email protected]>
Date: Mon, 6 Jan 2014 07:23:52 -0800
Subject: [PATCH] crypto: Rename aesni-intel_avx.S to indicate it only
supports x86_64
To: Herbert Xu <[email protected]>, H. Peter Anvin <[email protected]>
Cc: Borislav Petkov <[email protected]>, Andy Shevchenko <[email protected]>, [email protected]

We rename aesni-intel_avx.S to aesni-intel_avx-x86_64.S to indicate that it is only used by x86_64 architecture.

Quoted 7 lines
---
 arch/x86/crypto/Makefile                                        | 2 +-
 arch/x86/crypto/{aesni-intel_avx.S => aesni-intel_avx-x86_64.S} | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename arch/x86/crypto/{aesni-intel_avx.S => aesni-intel_avx-x86_64.S} (100%)

Patch applied.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt