Re: crypto: p10-aes-gcm - Add asm markings necessary for kernel code

2023-01-18 Thread Herbert Xu
On Wed, Jan 18, 2023 at 02:04:44PM +1100, Stephen Rothwell wrote:
>
> arch/powerpc/crypto/aesp8-ppc.o: warning: objtool: 
> aes_p8_set_encrypt_key+0x44: unannotated intra-function call
> 
> from the powerpc pseries_le_defconfig build (which is otherwise ok).

Thanks Stephen.  I've reverted these changes completely.

Thanks,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


Re: crypto: p10-aes-gcm - Add asm markings necessary for kernel code

2023-01-18 Thread Sathvika Vasireddy

Hi Stephen,

On 18/01/23 08:34, Stephen Rothwell wrote:

Hi Herbert,

On Tue, 17 Jan 2023 15:26:24 +0800 Herbert Xu  
wrote:

On Tue, Jan 17, 2023 at 02:47:47PM +1100, Stephen Rothwell wrote:

Hi all,

After merging the crypto tree, today's linux-next build (powerpc
pseries_le_defconfig) failed like this:

arch/powerpc/crypto/p10_aes_gcm.o: warning: objtool: .text+0x884: unannotated 
intra-function call
arch/powerpc/crypto/aesp8-ppc.o: warning: objtool: aes_p8_set_encrypt_key+0x44: 
unannotated intra-function call
ld: arch/powerpc/crypto/p10_aes_gcm.o: ABI version 1 is not compatible with ABI 
version 2 output
ld: failed to merge target specific data of file 
arch/powerpc/crypto/p10_aes_gcm.o

Caused by commit

   ca68a96c37eb ("crypto: p10-aes-gcm - An accelerated AES/GCM stitched 
implementation")

I have applied the following hack for today.

Thanks Stephen, I'm going to update the previous fix as follows:

I still get:

arch/powerpc/crypto/aesp8-ppc.o: warning: objtool: aes_p8_set_encrypt_key+0x44: 
unannotated intra-function call

from the powerpc pseries_le_defconfig build (which is otherwise ok).


Warnings [1], [2], and [3] are seen with pseries_le_defconfig.

[1] - arch/powerpc/crypto/aesp8-ppc.o: warning: objtool: 
aes_p8_set_encrypt_key+0x44: unannotated intra-function call
[2] - arch/powerpc/crypto/aesp8-ppc.o: warning: objtool: .text+0x2448: 
unannotated intra-function call
[3] - arch/powerpc/crypto/aesp8-ppc.o: warning: objtool: .text+0x2d68: 
unannotated intra-function call

Given that there are no calls to _mcount, one way to address this warning, is 
by skipping objtool from running on arch/powerpc/crypto/aesp8-ppc.o file.
The below diff works for me.

=
diff --git a/arch/powerpc/crypto/Makefile b/arch/powerpc/crypto/Makefile
index 5b8252013abd..d00664c8d761 100644
--- a/arch/powerpc/crypto/Makefile
+++ b/arch/powerpc/crypto/Makefile
@@ -31,3 +31,5 @@ targets += aesp8-ppc.S ghashp8-ppc.S
 
 $(obj)/aesp8-ppc.S $(obj)/ghashp8-ppc.S: $(obj)/%.S: $(src)/%.pl FORCE

$(call if_changed,perl)
+
+OBJECT_FILES_NON_STANDARD_aesp8-ppc.o := y
=


The other way to fix these warnings is by using ANNOTATE_INTRA_FUNCTION_CALL 
macro to indicate that the branch target is valid. And, by annotating symbols 
with SYM_FUNC_START_LOCAL and SYM_FUNC_END macros.
The below diff works for me:

=
diff --git a/arch/powerpc/crypto/aesp8-ppc.pl b/arch/powerpc/crypto/aesp8-ppc.pl
index cdbcf6e13efc..355e0036869a 100644
--- a/arch/powerpc/crypto/aesp8-ppc.pl
+++ b/arch/powerpc/crypto/aesp8-ppc.pl
@@ -80,6 +80,9 @@
 # POWER8[le]   3.96/0.72   0.741.1
 # POWER8[be]   3.75/0.65   0.661.0
 
+print "#include \n";

+print "#include \n";
+
 $flavour = shift;
 
 if ($flavour =~ /64/) {

@@ -185,7 +188,8 @@ Lset_encrypt_key:
lis r0,0xfff0
mfspr   $vrsave,256
mtspr   256,r0
-
+
+   ANNOTATE_INTRA_FUNCTION_CALL
bl  Lconsts
mtlrr11
 
@@ -3039,7 +3043,7 @@ Lxts_enc6x_ret:

.long   0
 
 .align 5

-_aesp8_xts_enc5x:
+SYM_FUNC_START_LOCAL(_aesp8_xts_enc5x)
vcipher $out0,$out0,v24
vcipher $out1,$out1,v24
vcipher $out2,$out2,v24
@@ -3121,6 +3125,7 @@ _aesp8_xts_enc5x:
blr
 .long  0
 .byte  0,12,0x14,0,0,0,0,0
+SYM_FUNC_END(_aesp8_xts_enc5x)
 
 .align 5

 _aesp8_xts_decrypt6x:
@@ -3727,7 +3732,7 @@ Lxts_dec6x_ret:
.long   0
 
 .align 5

-_aesp8_xts_dec5x:
+SYM_FUNC_START_LOCAL(_aesp8_xts_dec5x)
vncipher$out0,$out0,v24
vncipher$out1,$out1,v24
vncipher$out2,$out2,v24
@@ -3809,6 +3814,7 @@ _aesp8_xts_dec5x:
blr
 .long  0
 .byte  0,12,0x14,0,0,0,0,0
+SYM_FUNC_END(_aesp8_xts_dec5x)
 ___
 }} }}}

=


Thanks,
Sathvika



Re: crypto: p10-aes-gcm - Add asm markings necessary for kernel code

2023-01-17 Thread Stephen Rothwell
Hi Herbert,

On Tue, 17 Jan 2023 15:26:24 +0800 Herbert Xu  
wrote:
>
> On Tue, Jan 17, 2023 at 02:47:47PM +1100, Stephen Rothwell wrote:
> > Hi all,
> > 
> > After merging the crypto tree, today's linux-next build (powerpc
> > pseries_le_defconfig) failed like this:
> > 
> > arch/powerpc/crypto/p10_aes_gcm.o: warning: objtool: .text+0x884: 
> > unannotated intra-function call
> > arch/powerpc/crypto/aesp8-ppc.o: warning: objtool: 
> > aes_p8_set_encrypt_key+0x44: unannotated intra-function call
> > ld: arch/powerpc/crypto/p10_aes_gcm.o: ABI version 1 is not compatible with 
> > ABI version 2 output
> > ld: failed to merge target specific data of file 
> > arch/powerpc/crypto/p10_aes_gcm.o
> > 
> > Caused by commit
> > 
> >   ca68a96c37eb ("crypto: p10-aes-gcm - An accelerated AES/GCM stitched 
> > implementation")
> > 
> > I have applied the following hack for today.  
> 
> Thanks Stephen, I'm going to update the previous fix as follows:

I still get:

arch/powerpc/crypto/aesp8-ppc.o: warning: objtool: aes_p8_set_encrypt_key+0x44: 
unannotated intra-function call

from the powerpc pseries_le_defconfig build (which is otherwise ok).

Now I also get (from a powerpc allyesconfig build):

tmp/cc8g6b4E.s: Assembler messages:
tmp/cc8g6b4E.s: Error: .size expression for gcm_init_p8 does not evaluate to a 
constant
tmp/cc8g6b4E.s: Error: .size expression for .gcm_init_p8 does not evaluate to a 
constant
tmp/cc8g6b4E.s: Error: .size expression for gcm_init_htable does not evaluate 
to a constant
tmp/cc8g6b4E.s: Error: .size expression for .gcm_init_htable does not evaluate 
to a constant
tmp/cc8g6b4E.s: Error: .size expression for gcm_gmult_p8 does not evaluate to a 
constant
tmp/cc8g6b4E.s: Error: .size expression for .gcm_gmult_p8 does not evaluate to 
a constant
tmp/cc8g6b4E.s: Error: .size expression for gcm_ghash_p8 does not evaluate to a 
constant
tmp/cc8g6b4E.s: Error: .size expression for .gcm_ghash_p8 does not evaluate to 
a constant
make[4]: *** [next/scripts/Makefile.build:374: 
arch/powerpc/crypto/ghashp8-ppc.o] Error 1
tmp/ccNrBtc1.s: Assembler messages:
tmp/ccNrBtc1.s: Error: .size expression for aes_p8_set_encrypt_key does not 
evaluate to a constant
tmp/ccNrBtc1.s: Error: .size expression for .aes_p8_set_encrypt_key does not 
evaluate to a constant
tmp/ccNrBtc1.s: Error: .size expression for aes_p8_set_decrypt_key does not 
evaluate to a constant
tmp/ccNrBtc1.s: Error: .size expression for .aes_p8_set_decrypt_key does not 
evaluate to a constant
tmp/ccNrBtc1.s: Error: .size expression for aes_p8_encrypt does not evaluate to 
a constant
tmp/ccNrBtc1.s: Error: .size expression for .aes_p8_encrypt does not evaluate 
to a constant
tmp/ccNrBtc1.s: Error: .size expression for aes_p8_decrypt does not evaluate to 
a constant
tmp/ccNrBtc1.s: Error: .size expression for .aes_p8_decrypt does not evaluate 
to a constant
tmp/ccNrBtc1.s: Error: .size expression for aes_p8_cbc_encrypt does not 
evaluate to a constant
tmp/ccNrBtc1.s: Error: .size expression for .aes_p8_cbc_encrypt does not 
evaluate to a constant
tmp/ccNrBtc1.s: Error: .size expression for aes_p8_ctr32_encrypt_blocks does 
not evaluate to a constant
tmp/ccNrBtc1.s: Error: .size expression for .aes_p8_ctr32_encrypt_blocks does 
not evaluate to a constant
tmp/ccNrBtc1.s: Error: .size expression for aes_p8_xts_encrypt does not 
evaluate to a constant
tmp/ccNrBtc1.s: Error: .size expression for .aes_p8_xts_encrypt does not 
evaluate to a constant
tmp/ccNrBtc1.s: Error: .size expression for aes_p8_xts_decrypt does not 
evaluate to a constant
tmp/ccNrBtc1.s: Error: .size expression for .aes_p8_xts_decrypt does not 
evaluate to a constant
make[4]: *** [next/scripts/Makefile.build:374: arch/powerpc/crypto/aesp8-ppc.o] 
Error 1
make[4]: Target 'arch/powerpc/crypto/' not remade because of errors.

$ grep gcm_init_p8 arch/powerpc/crypto/ghashp8-ppc.s
.align 2 ; .type gcm_init_p8,@function; .globl gcm_init_p8; gcm_init_p8:
.size gcm_init_p8,.-.gcm_init_p8
.size .gcm_init_p8,.-.gcm_init_p8

I have just marked CRYPTO_P10_AES_GCM as BROKEN for today.

-- 
Cheers,
Stephen Rothwell


pgp6zTiBfGOeP.pgp
Description: OpenPGP digital signature