linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: linux-next: Tree for Mar 11 (powerpc build failure due to vmx crypto code)
       [not found] ` <20150311154717.GA22169@roeck-us.net>
@ 2015-03-12  1:23   ` Herbert Xu
  2015-03-12  2:43     ` Guenter Roeck
  0 siblings, 1 reply; 6+ messages in thread
From: Herbert Xu @ 2015-03-12  1:23 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Stephen Rothwell, linux-next, linux-kernel, Leonidas S. Barbosa,
	Linux Crypto Mailing List

On Wed, Mar 11, 2015 at 08:47:17AM -0700, Guenter Roeck wrote:
>
> Building powerpc:allmodconfig:
> 
> ERROR: ".aes_p8_cbc_encrypt" [drivers/crypto/vmx/vmx-crypto.ko] undefined!
> ERROR: ".aes_p8_set_encrypt_key" [drivers/crypto/vmx/vmx-crypto.ko] undefined!
> ERROR: ".aes_p8_set_decrypt_key" [drivers/crypto/vmx/vmx-crypto.ko] undefined!
> ERROR: ".gcm_init_p8" [drivers/crypto/vmx/vmx-crypto.ko] undefined!
> ERROR: ".aes_p8_decrypt" [drivers/crypto/vmx/vmx-crypto.ko] undefined!
> ERROR: ".aes_p8_encrypt" [drivers/crypto/vmx/vmx-crypto.ko] undefined!
> ERROR: ".gcm_ghash_p8" [drivers/crypto/vmx/vmx-crypto.ko] undefined!
> ERROR: ".aes_p8_ctr32_encrypt_blocks" [drivers/crypto/vmx/vmx-crypto.ko] undefined!
> 
> Those functions are called but don't seem to be defined anywhere.

They are meant to be generated by the perl scripts in that directory.
Can you take a look at why those perl scripts didn't run or didn't
function correctly?

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

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

* Re: linux-next: Tree for Mar 11 (powerpc build failure due to vmx crypto code)
  2015-03-12  1:23   ` linux-next: Tree for Mar 11 (powerpc build failure due to vmx crypto code) Herbert Xu
@ 2015-03-12  2:43     ` Guenter Roeck
  2015-03-12  3:28       ` Herbert Xu
  0 siblings, 1 reply; 6+ messages in thread
From: Guenter Roeck @ 2015-03-12  2:43 UTC (permalink / raw)
  To: Herbert Xu
  Cc: Stephen Rothwell, linux-next, linux-kernel, Leonidas S. Barbosa,
	Linux Crypto Mailing List

On 03/11/2015 06:23 PM, Herbert Xu wrote:
> On Wed, Mar 11, 2015 at 08:47:17AM -0700, Guenter Roeck wrote:
>>
>> Building powerpc:allmodconfig:
>>
>> ERROR: ".aes_p8_cbc_encrypt" [drivers/crypto/vmx/vmx-crypto.ko] undefined!
>> ERROR: ".aes_p8_set_encrypt_key" [drivers/crypto/vmx/vmx-crypto.ko] undefined!
>> ERROR: ".aes_p8_set_decrypt_key" [drivers/crypto/vmx/vmx-crypto.ko] undefined!
>> ERROR: ".gcm_init_p8" [drivers/crypto/vmx/vmx-crypto.ko] undefined!
>> ERROR: ".aes_p8_decrypt" [drivers/crypto/vmx/vmx-crypto.ko] undefined!
>> ERROR: ".aes_p8_encrypt" [drivers/crypto/vmx/vmx-crypto.ko] undefined!
>> ERROR: ".gcm_ghash_p8" [drivers/crypto/vmx/vmx-crypto.ko] undefined!
>> ERROR: ".aes_p8_ctr32_encrypt_blocks" [drivers/crypto/vmx/vmx-crypto.ko] undefined!
>>
>> Those functions are called but don't seem to be defined anywhere.
>
> They are meant to be generated by the perl scripts in that directory.
> Can you take a look at why those perl scripts didn't run or didn't
> function correctly?
>

It looks like the perl scripts do run - I see the .S files, and I do see .o files created.
But I still get the error.

Looking into the object files, I see

$ nm vmx-crypto.o | grep aes_p8_cbc_encrypt
0000000000000680 t .aes_p8_cbc_encrypt
                  U .aes_p8_cbc_encrypt
00000000000000a8 D aes_p8_cbc_encrypt

$ nm aesp8-ppc.o | grep aes_p8_cbc_encrypt
0000000000000680 t .aes_p8_cbc_encrypt
0000000000000060 D aes_p8_cbc_encrypt

In the assembler source, I see

.globl  aes_p8_cbc_encrypt

but no .globl for .aes_p8_cbc_encrypt.

Does that tell you anything ?

I also notice is that the .S files are not removed with "make mrproper"
but left behind. Seems to me that those files should be removed.

Guenter

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

* Re: linux-next: Tree for Mar 11 (powerpc build failure due to vmx crypto code)
  2015-03-12  2:43     ` Guenter Roeck
@ 2015-03-12  3:28       ` Herbert Xu
  2015-03-12  3:51         ` Guenter Roeck
  0 siblings, 1 reply; 6+ messages in thread
From: Herbert Xu @ 2015-03-12  3:28 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Stephen Rothwell, linux-next, linux-kernel, Leonidas S. Barbosa,
	Linux Crypto Mailing List

On Wed, Mar 11, 2015 at 07:43:22PM -0700, Guenter Roeck wrote:
>
> It looks like the perl scripts do run - I see the .S files, and I do see .o files created.
> But I still get the error.
> 
> Looking into the object files, I see
> 
> $ nm vmx-crypto.o | grep aes_p8_cbc_encrypt
> 0000000000000680 t .aes_p8_cbc_encrypt
>                  U .aes_p8_cbc_encrypt
> 00000000000000a8 D aes_p8_cbc_encrypt

Ugh, does this patch help?

Thanks,

--8<--
crypto: vmx - Fix assembler perl to use _GLOBAL

Rather than doing things by hand for global symbols to deal with
different calling conventions we already have a macro _GLOBAL in
Linux to handle this.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

diff --git a/drivers/crypto/vmx/aesp8-ppc.pl b/drivers/crypto/vmx/aesp8-ppc.pl
old mode 100755
new mode 100644
index 3ee8979..6c5c20c
--- a/drivers/crypto/vmx/aesp8-ppc.pl
+++ b/drivers/crypto/vmx/aesp8-ppc.pl
@@ -85,8 +85,6 @@ Lconsts:
 .asciz	"AES for PowerISA 2.07, CRYPTOGAMS by <appro\@openssl.org>"
 
 .globl	.${prefix}_set_encrypt_key
-.align	5
-.${prefix}_set_encrypt_key:
 Lset_encrypt_key:
 	mflr		r11
 	$PUSH		r11,$LRSAVE($sp)
@@ -348,8 +346,6 @@ Lenc_key_abort:
 .size	.${prefix}_set_encrypt_key,.-.${prefix}_set_encrypt_key
 
 .globl	.${prefix}_set_decrypt_key
-.align	5
-.${prefix}_set_decrypt_key:
 	$STU		$sp,-$FRAME($sp)
 	mflr		r10
 	$PUSH		r10,$FRAME+$LRSAVE($sp)
@@ -405,8 +401,6 @@ my ($inp,$out,$key,$rounds,$idx)=map("r$_",(3..7));
 
 $code.=<<___;
 .globl	.${prefix}_${dir}crypt
-.align	5
-.${prefix}_${dir}crypt:
 	lwz		$rounds,240($key)
 	lis		r0,0xfc00
 	mfspr		$vrsave,256
@@ -484,8 +478,6 @@ my ($ivec,$inptail,$inpperm,$outhead,$outperm,$outmask,$keyperm)=
 						map("v$_",(4..10));
 $code.=<<___;
 .globl	.${prefix}_cbc_encrypt
-.align	5
-.${prefix}_cbc_encrypt:
 	${UCMP}i	$len,16
 	bltlr-
 
@@ -1243,8 +1235,6 @@ my $dat=$tmp;
 
 $code.=<<___;
 .globl	.${prefix}_ctr32_encrypt_blocks
-.align	5
-.${prefix}_ctr32_encrypt_blocks:
 	${UCMP}i	$len,1
 	bltlr-
 
diff --git a/drivers/crypto/vmx/ghashp8-ppc.pl b/drivers/crypto/vmx/ghashp8-ppc.pl
old mode 100755
new mode 100644
index e76a58c..0a6f899
--- a/drivers/crypto/vmx/ghashp8-ppc.pl
+++ b/drivers/crypto/vmx/ghashp8-ppc.pl
@@ -54,8 +54,6 @@ $code=<<___;
 .text
 
 .globl	.gcm_init_p8
-.align	5
-.gcm_init_p8:
 	lis		r0,0xfff0
 	li		r8,0x10
 	mfspr		$vrsave,256
@@ -98,8 +96,6 @@ $code=<<___;
 .size	.gcm_init_p8,.-.gcm_init_p8
 
 .globl	.gcm_gmult_p8
-.align	5
-.gcm_gmult_p8:
 	lis		r0,0xfff8
 	li		r8,0x10
 	mfspr		$vrsave,256
@@ -148,8 +144,6 @@ $code=<<___;
 .size	.gcm_gmult_p8,.-.gcm_gmult_p8
 
 .globl	.gcm_ghash_p8
-.align	5
-.gcm_ghash_p8:
 	lis		r0,0xfff8
 	li		r8,0x10
 	mfspr		$vrsave,256
diff --git a/drivers/crypto/vmx/ppc-xlate.pl b/drivers/crypto/vmx/ppc-xlate.pl
old mode 100755
new mode 100644
index f89e814..a591884
--- a/drivers/crypto/vmx/ppc-xlate.pl
+++ b/drivers/crypto/vmx/ppc-xlate.pl
@@ -27,25 +27,13 @@ my $globl = sub {
 	/osx/		&& do { $name = "_$name";
 				last;
 			      };
-	/linux.*(32|64le)/
-			&& do {	$ret .= ".globl	$name\n";
-				$ret .= ".type	$name,\@function";
-				last;
-			      };
-	/linux.*64/	&& do {	$ret .= ".globl	$name\n";
-				$ret .= ".type	$name,\@function\n";
-				$ret .= ".section	\".opd\",\"aw\"\n";
-				$ret .= ".align	3\n";
-				$ret .= "$name:\n";
-				$ret .= ".quad	.$name,.TOC.\@tocbase,0\n";
-				$ret .= ".previous\n";
-
-				$name = ".$name";
+	/linux/
+			&& do {	$ret = "_GLOBAL($name)";
 				last;
 			      };
     }
 
-    $ret = ".globl	$name" if (!$ret);
+    $ret = ".globl	$name\nalign 5\n$name:" if (!$ret);
     $$global = $name;
     $ret;
 };
@@ -187,6 +175,8 @@ my $mtsle	= sub {
     "	.long	".sprintf "0x%X",(31<<26)|($arg<<21)|(147*2);
 };
 
+print "#include <asm/ppc_asm.h>\n" if $flavour =~ /linux/;
+
 while($line=<>) {
 
     $line =~ s|[#!;].*$||;	# get rid of asm-style comments...
@@ -200,15 +190,6 @@ while($line=<>) {
     }
 
     {
-	$line =~ s|(^[\.\w]+)\:\s*||;
-	my $label = $1;
-	if ($label) {
-	    printf "%s:",($GLOBALS{$label} or $label);
-	    printf "\n.localentry\t$GLOBALS{$label},0"	if ($GLOBALS{$label} && $flavour =~ /linux.*64le/);
-	}
-    }
-
-    {
 	$line =~ s|^\s*(\.?)(\w+)([\.\+\-]?)\s*||;
 	my $c = $1; $c = "\t" if ($c eq "");
 	my $mnemonic = $2;

-- 
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 related	[flat|nested] 6+ messages in thread

* Re: linux-next: Tree for Mar 11 (powerpc build failure due to vmx crypto code)
  2015-03-12  3:28       ` Herbert Xu
@ 2015-03-12  3:51         ` Guenter Roeck
  2015-03-12  3:53           ` Herbert Xu
  0 siblings, 1 reply; 6+ messages in thread
From: Guenter Roeck @ 2015-03-12  3:51 UTC (permalink / raw)
  To: Herbert Xu
  Cc: Stephen Rothwell, linux-next, linux-kernel, Leonidas S. Barbosa,
	Linux Crypto Mailing List

On 03/11/2015 08:28 PM, Herbert Xu wrote:
> On Wed, Mar 11, 2015 at 07:43:22PM -0700, Guenter Roeck wrote:
>>
>> It looks like the perl scripts do run - I see the .S files, and I do see .o files created.
>> But I still get the error.
>>
>> Looking into the object files, I see
>>
>> $ nm vmx-crypto.o | grep aes_p8_cbc_encrypt
>> 0000000000000680 t .aes_p8_cbc_encrypt
>>                   U .aes_p8_cbc_encrypt
>> 00000000000000a8 D aes_p8_cbc_encrypt
>
> Ugh, does this patch help?
>
> Thanks,
>
> --8<--
> crypto: vmx - Fix assembler perl to use _GLOBAL
>
> Rather than doing things by hand for global symbols to deal with
> different calling conventions we already have a macro _GLOBAL in
> Linux to handle this.
>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
>
Yes, this helps.

Feel free to add

Tested-by: Guenter Roeck <linux@roeck-us.net>

Thanks,
Guenter

> diff --git a/drivers/crypto/vmx/aesp8-ppc.pl b/drivers/crypto/vmx/aesp8-ppc.pl
> old mode 100755
> new mode 100644
> index 3ee8979..6c5c20c
> --- a/drivers/crypto/vmx/aesp8-ppc.pl
> +++ b/drivers/crypto/vmx/aesp8-ppc.pl
> @@ -85,8 +85,6 @@ Lconsts:
>   .asciz	"AES for PowerISA 2.07, CRYPTOGAMS by <appro\@openssl.org>"
>
>   .globl	.${prefix}_set_encrypt_key
> -.align	5
> -.${prefix}_set_encrypt_key:
>   Lset_encrypt_key:
>   	mflr		r11
>   	$PUSH		r11,$LRSAVE($sp)
> @@ -348,8 +346,6 @@ Lenc_key_abort:
>   .size	.${prefix}_set_encrypt_key,.-.${prefix}_set_encrypt_key
>
>   .globl	.${prefix}_set_decrypt_key
> -.align	5
> -.${prefix}_set_decrypt_key:
>   	$STU		$sp,-$FRAME($sp)
>   	mflr		r10
>   	$PUSH		r10,$FRAME+$LRSAVE($sp)
> @@ -405,8 +401,6 @@ my ($inp,$out,$key,$rounds,$idx)=map("r$_",(3..7));
>
>   $code.=<<___;
>   .globl	.${prefix}_${dir}crypt
> -.align	5
> -.${prefix}_${dir}crypt:
>   	lwz		$rounds,240($key)
>   	lis		r0,0xfc00
>   	mfspr		$vrsave,256
> @@ -484,8 +478,6 @@ my ($ivec,$inptail,$inpperm,$outhead,$outperm,$outmask,$keyperm)=
>   						map("v$_",(4..10));
>   $code.=<<___;
>   .globl	.${prefix}_cbc_encrypt
> -.align	5
> -.${prefix}_cbc_encrypt:
>   	${UCMP}i	$len,16
>   	bltlr-
>
> @@ -1243,8 +1235,6 @@ my $dat=$tmp;
>
>   $code.=<<___;
>   .globl	.${prefix}_ctr32_encrypt_blocks
> -.align	5
> -.${prefix}_ctr32_encrypt_blocks:
>   	${UCMP}i	$len,1
>   	bltlr-
>
> diff --git a/drivers/crypto/vmx/ghashp8-ppc.pl b/drivers/crypto/vmx/ghashp8-ppc.pl
> old mode 100755
> new mode 100644
> index e76a58c..0a6f899
> --- a/drivers/crypto/vmx/ghashp8-ppc.pl
> +++ b/drivers/crypto/vmx/ghashp8-ppc.pl
> @@ -54,8 +54,6 @@ $code=<<___;
>   .text
>
>   .globl	.gcm_init_p8
> -.align	5
> -.gcm_init_p8:
>   	lis		r0,0xfff0
>   	li		r8,0x10
>   	mfspr		$vrsave,256
> @@ -98,8 +96,6 @@ $code=<<___;
>   .size	.gcm_init_p8,.-.gcm_init_p8
>
>   .globl	.gcm_gmult_p8
> -.align	5
> -.gcm_gmult_p8:
>   	lis		r0,0xfff8
>   	li		r8,0x10
>   	mfspr		$vrsave,256
> @@ -148,8 +144,6 @@ $code=<<___;
>   .size	.gcm_gmult_p8,.-.gcm_gmult_p8
>
>   .globl	.gcm_ghash_p8
> -.align	5
> -.gcm_ghash_p8:
>   	lis		r0,0xfff8
>   	li		r8,0x10
>   	mfspr		$vrsave,256
> diff --git a/drivers/crypto/vmx/ppc-xlate.pl b/drivers/crypto/vmx/ppc-xlate.pl
> old mode 100755
> new mode 100644
> index f89e814..a591884
> --- a/drivers/crypto/vmx/ppc-xlate.pl
> +++ b/drivers/crypto/vmx/ppc-xlate.pl
> @@ -27,25 +27,13 @@ my $globl = sub {
>   	/osx/		&& do { $name = "_$name";
>   				last;
>   			      };
> -	/linux.*(32|64le)/
> -			&& do {	$ret .= ".globl	$name\n";
> -				$ret .= ".type	$name,\@function";
> -				last;
> -			      };
> -	/linux.*64/	&& do {	$ret .= ".globl	$name\n";
> -				$ret .= ".type	$name,\@function\n";
> -				$ret .= ".section	\".opd\",\"aw\"\n";
> -				$ret .= ".align	3\n";
> -				$ret .= "$name:\n";
> -				$ret .= ".quad	.$name,.TOC.\@tocbase,0\n";
> -				$ret .= ".previous\n";
> -
> -				$name = ".$name";
> +	/linux/
> +			&& do {	$ret = "_GLOBAL($name)";
>   				last;
>   			      };
>       }
>
> -    $ret = ".globl	$name" if (!$ret);
> +    $ret = ".globl	$name\nalign 5\n$name:" if (!$ret);
>       $$global = $name;
>       $ret;
>   };
> @@ -187,6 +175,8 @@ my $mtsle	= sub {
>       "	.long	".sprintf "0x%X",(31<<26)|($arg<<21)|(147*2);
>   };
>
> +print "#include <asm/ppc_asm.h>\n" if $flavour =~ /linux/;
> +
>   while($line=<>) {
>
>       $line =~ s|[#!;].*$||;	# get rid of asm-style comments...
> @@ -200,15 +190,6 @@ while($line=<>) {
>       }
>
>       {
> -	$line =~ s|(^[\.\w]+)\:\s*||;
> -	my $label = $1;
> -	if ($label) {
> -	    printf "%s:",($GLOBALS{$label} or $label);
> -	    printf "\n.localentry\t$GLOBALS{$label},0"	if ($GLOBALS{$label} && $flavour =~ /linux.*64le/);
> -	}
> -    }
> -
> -    {
>   	$line =~ s|^\s*(\.?)(\w+)([\.\+\-]?)\s*||;
>   	my $c = $1; $c = "\t" if ($c eq "");
>   	my $mnemonic = $2;
>

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

* Re: linux-next: Tree for Mar 11 (powerpc build failure due to vmx crypto code)
  2015-03-12  3:51         ` Guenter Roeck
@ 2015-03-12  3:53           ` Herbert Xu
  2015-03-12 15:27             ` Leonidas S. Barbosa
  0 siblings, 1 reply; 6+ messages in thread
From: Herbert Xu @ 2015-03-12  3:53 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Stephen Rothwell, linux-next, linux-kernel, Leonidas S. Barbosa,
	Linux Crypto Mailing List

On Wed, Mar 11, 2015 at 08:51:32PM -0700, Guenter Roeck wrote:
>
> Yes, this helps.
> 
> Feel free to add
> 
> Tested-by: Guenter Roeck <linux@roeck-us.net>

Thanks for testing and the quick feedback.
-- 
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] 6+ messages in thread

* Re: linux-next: Tree for Mar 11 (powerpc build failure due to vmx crypto code)
  2015-03-12  3:53           ` Herbert Xu
@ 2015-03-12 15:27             ` Leonidas S. Barbosa
  0 siblings, 0 replies; 6+ messages in thread
From: Leonidas S. Barbosa @ 2015-03-12 15:27 UTC (permalink / raw)
  To: Herbert Xu
  Cc: Guenter Roeck, Stephen Rothwell, linux-next, linux-kernel,
	Linux Crypto Mailing List


A little bit later, but thank you guys for fix it.

The issue seems happens just in BE machines, and  using _GLOBAL instead
.globl seems fix it so build the correct vmx-crypto.ko. On LE it does
not happens.




On Thu, Mar 12, 2015 at 02:53:27PM +1100, Herbert Xu wrote:
> On Wed, Mar 11, 2015 at 08:51:32PM -0700, Guenter Roeck wrote:
> >
> > Yes, this helps.
> > 
> > Feel free to add
> > 
> > Tested-by: Guenter Roeck <linux@roeck-us.net>
> 
> Thanks for testing and the quick feedback.
> -- 
> 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] 6+ messages in thread

end of thread, other threads:[~2015-03-12 15:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20150311163558.6a09cfcc@canb.auug.org.au>
     [not found] ` <20150311154717.GA22169@roeck-us.net>
2015-03-12  1:23   ` linux-next: Tree for Mar 11 (powerpc build failure due to vmx crypto code) Herbert Xu
2015-03-12  2:43     ` Guenter Roeck
2015-03-12  3:28       ` Herbert Xu
2015-03-12  3:51         ` Guenter Roeck
2015-03-12  3:53           ` Herbert Xu
2015-03-12 15:27             ` Leonidas S. Barbosa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).