From: Herbert Xu <herbert@gondor.apana.org.au>
To: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Linux Crypto List <linux-crypto@vger.kernel.org>,
Danny Tsen <dtsen@linux.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
PowerPC <linuxppc-dev@lists.ozlabs.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux Next Mailing List <linux-next@vger.kernel.org>
Subject: crypto: p10-aes-gcm - Add asm markings necessary for kernel code
Date: Tue, 17 Jan 2023 15:26:24 +0800 [thread overview]
Message-ID: <Y8ZNoBSX5P0ieJ3t@gondor.apana.org.au> (raw)
In-Reply-To: <20230117144747.37115c52@canb.auug.org.au>
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:
---8<---
_GLOBAL is needed instead of .global on Linux in assembly code.
The explicit abiversion setting is removed as the code should
with either ABI.
Mark local functions to avoid objdump warnings.
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Fixes: cc40379b6e19 ("crypto: p10-aes-gcm - Glue code for AES/GCM stitched implementation")
Fixes: 3b47eccaaff4 ("crypto: p10-aes-gcm - Supporting functions for AES")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
diff --git a/arch/powerpc/crypto/aesp8-ppc.pl b/arch/powerpc/crypto/aesp8-ppc.pl
index 50a0a18f35da..cdbcf6e13efc 100644
--- a/arch/powerpc/crypto/aesp8-ppc.pl
+++ b/arch/powerpc/crypto/aesp8-ppc.pl
@@ -121,6 +121,22 @@ my ($inp,$bits,$out,$ptr,$cnt,$rounds)=map("r$_",(3..8));
my ($zero,$in0,$in1,$key,$rcon,$mask,$tmp)=map("v$_",(0..6));
my ($stage,$outperm,$outmask,$outhead,$outtail)=map("v$_",(7..11));
+sub declare_function() {
+ my ($name) = @_;
+ if ($kernel) {
+ $code .= "SYM_FUNC_START_LOCAL($name)\n";
+ } else {
+ $code .= "L$name:\n";
+ }
+}
+
+sub end_function() {
+ my ($name) = @_;
+ if ($kernel) {
+ $code .= "SYM_FUNC_END($name)\n";
+ }
+}
+
$code.=<<___;
.machine "any"
@@ -132,13 +148,18 @@ rcon:
.long 0x1b000000, 0x1b000000, 0x1b000000, 0x1b000000 ?rev
.long 0x0d0e0f0c, 0x0d0e0f0c, 0x0d0e0f0c, 0x0d0e0f0c ?rev
.long 0,0,0,0 ?asis
-Lconsts:
+___
+&declare_function("consts");
+$code.=<<___;
mflr r0
bcl 20,31,\$+4
mflr $ptr #vvvvv "distance between . and rcon
addi $ptr,$ptr,-0x48
mtlr r0
blr
+___
+&end_function("consts");
+$code.=<<___;
.long 0
.byte 0,12,0x14,0,0,0,0,0
.asciz "AES for PowerISA 2.07, CRYPTOGAMS by <appro\@openssl.org>"
diff --git a/arch/powerpc/crypto/p10_aes_gcm.S b/arch/powerpc/crypto/p10_aes_gcm.S
index 2306ad7c5e36..153388733eae 100644
--- a/arch/powerpc/crypto/p10_aes_gcm.S
+++ b/arch/powerpc/crypto/p10_aes_gcm.S
@@ -38,8 +38,10 @@
# ===================================================================================
#
+#include <asm/ppc_asm.h>
+#include <linux/linkage.h>
+
.machine "any"
-.abiversion 1
.text
# 4x loops
@@ -569,9 +571,7 @@ ppc_aes_gcm_ghash:
# rounds is at offset 240 in rk
# Xi is at 0 in gcm_table (Xip).
#
-.global aes_p10_gcm_encrypt
-.align 5
-aes_p10_gcm_encrypt:
+_GLOBAL(aes_p10_gcm_encrypt)
SAVE_REGS
@@ -989,7 +989,7 @@ Normal_block:
# Handle multiple partial blocks for encrypt and decrypt
# operations.
#
-Do_partial_block:
+SYM_FUNC_START_LOCAL(Do_partial_block)
add 17, 15, 5
cmpdi 17, 16
bgt Big_block
@@ -1075,6 +1075,7 @@ Save_partial:
Partial_done:
blr
+SYM_FUNC_END(Do_partial_block)
#
# Write partial block
@@ -1082,7 +1083,7 @@ Partial_done:
# r12 - remaining bytes
# v15 - partial input data
#
-Write_partial_block:
+SYM_FUNC_START_LOCAL(Write_partial_block)
li 10, 192
stxvb16x 15+32, 10, 1 # last block
@@ -1097,6 +1098,7 @@ Write_last_byte:
stbu 14, 1(10)
bdnz Write_last_byte
blr
+SYM_FUNC_END(Write_partial_block)
aes_gcm_out:
# out = state
@@ -1109,9 +1111,7 @@ aes_gcm_out:
#
# 8x Decrypt
#
-.global aes_p10_gcm_decrypt
-.align 5
-aes_p10_gcm_decrypt:
+_GLOBAL(aes_p10_gcm_decrypt)
SAVE_REGS
diff --git a/arch/powerpc/crypto/ppc-xlate.pl b/arch/powerpc/crypto/ppc-xlate.pl
index 23cca703ce29..d1dcb914858c 100644
--- a/arch/powerpc/crypto/ppc-xlate.pl
+++ b/arch/powerpc/crypto/ppc-xlate.pl
@@ -198,6 +198,7 @@ my $mtsle = sub {
};
print "#include <asm/ppc_asm.h>\n" if $flavour =~ /linux/;
+print "#include <linux/linkage.h>\n" if $flavour =~ /linux/;
while($line=<>) {
--
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
next prev parent reply other threads:[~2023-01-17 7:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-17 3:47 linux-next: build failure after merge of the crypto tree Stephen Rothwell
2023-01-17 7:26 ` Herbert Xu [this message]
2023-01-18 3:04 ` crypto: p10-aes-gcm - Add asm markings necessary for kernel code Stephen Rothwell
2023-01-18 8:43 ` Sathvika Vasireddy
2023-01-18 9:24 ` Herbert Xu
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=Y8ZNoBSX5P0ieJ3t@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=dtsen@linux.ibm.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=sfr@canb.auug.org.au \
/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 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).