Commit 505ea330 authored by Nicholas Piggin's avatar Nicholas Piggin Committed by Michael Ellerman
Browse files

powerpc/64: Add big-endian ELFv2 flavour to crypto VMX asm generation



This allows asm generation for big-endian ELFv2 builds.

Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
Reviewed-by: default avatarJoel Stanley <joel@jms.id.au>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20221128041539.1742489-4-npiggin@gmail.com
parent de3d098d
Loading
Loading
Loading
Loading
+11 −1
Original line number Original line Diff line number Diff line
@@ -2,8 +2,18 @@
obj-$(CONFIG_CRYPTO_DEV_VMX_ENCRYPT) += vmx-crypto.o
obj-$(CONFIG_CRYPTO_DEV_VMX_ENCRYPT) += vmx-crypto.o
vmx-crypto-objs := vmx.o aesp8-ppc.o ghashp8-ppc.o aes.o aes_cbc.o aes_ctr.o aes_xts.o ghash.o
vmx-crypto-objs := vmx.o aesp8-ppc.o ghashp8-ppc.o aes.o aes_cbc.o aes_ctr.o aes_xts.o ghash.o


ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y)
override flavour := linux-ppc64le
else
ifdef CONFIG_PPC64_ELF_ABI_V2
override flavour := linux-ppc64-elfv2
else
override flavour := linux-ppc64
endif
endif

quiet_cmd_perl = PERL    $@
quiet_cmd_perl = PERL    $@
      cmd_perl = $(PERL) $< $(if $(CONFIG_CPU_LITTLE_ENDIAN), linux-ppc64le, linux-ppc64) > $@
      cmd_perl = $(PERL) $< $(flavour) > $@


targets += aesp8-ppc.S ghashp8-ppc.S
targets += aesp8-ppc.S ghashp8-ppc.S


+6 −4
Original line number Original line Diff line number Diff line
@@ -9,6 +9,8 @@ open STDOUT,">$output" || die "can't open $output: $!";


my %GLOBALS;
my %GLOBALS;
my $dotinlocallabels=($flavour=~/linux/)?1:0;
my $dotinlocallabels=($flavour=~/linux/)?1:0;
my $elfv2abi=(($flavour =~ /linux-ppc64le/) or ($flavour =~ /linux-ppc64-elfv2/))?1:0;
my $dotfunctions=($elfv2abi=~1)?0:1;


################################################################
################################################################
# directives which need special treatment on different platforms
# directives which need special treatment on different platforms
@@ -40,7 +42,7 @@ my $globl = sub {
};
};
my $text = sub {
my $text = sub {
    my $ret = ($flavour =~ /aix/) ? ".csect\t.text[PR],7" : ".text";
    my $ret = ($flavour =~ /aix/) ? ".csect\t.text[PR],7" : ".text";
    $ret = ".abiversion	2\n".$ret	if ($flavour =~ /linux.*64le/);
    $ret = ".abiversion	2\n".$ret	if ($elfv2abi);
    $ret;
    $ret;
};
};
my $machine = sub {
my $machine = sub {
@@ -56,8 +58,8 @@ my $size = sub {
    if ($flavour =~ /linux/)
    if ($flavour =~ /linux/)
    {	shift;
    {	shift;
	my $name = shift; $name =~ s|^[\.\_]||;
	my $name = shift; $name =~ s|^[\.\_]||;
	my $ret  = ".size	$name,.-".($flavour=~/64$/?".":"").$name;
	my $ret  = ".size	$name,.-".($dotfunctions?".":"").$name;
	$ret .= "\n.size	.$name,.-.$name" if ($flavour=~/64$/);
	$ret .= "\n.size	.$name,.-.$name" if ($dotfunctions);
	$ret;
	$ret;
    }
    }
    else
    else
@@ -142,7 +144,7 @@ my $vmr = sub {


# Some ABIs specify vrsave, special-purpose register #256, as reserved
# Some ABIs specify vrsave, special-purpose register #256, as reserved
# for system use.
# for system use.
my $no_vrsave = ($flavour =~ /linux-ppc64le/);
my $no_vrsave = ($elfv2abi);
my $mtspr = sub {
my $mtspr = sub {
    my ($f,$idx,$ra) = @_;
    my ($f,$idx,$ra) = @_;
    if ($idx == 256 && $no_vrsave) {
    if ($idx == 256 && $no_vrsave) {