]> git.proxmox.com Git - mirror_zfs.git/commitdiff
powerpc64: Support ELFv2 asm on Big Endian
authorJustin Hibbits <chmeeedalf@users.noreply.github.com>
Thu, 27 Apr 2023 19:49:21 +0000 (15:49 -0400)
committerGitHub <noreply@github.com>
Thu, 27 Apr 2023 19:49:21 +0000 (12:49 -0700)
FreeBSD/powerpc64 is all ELFv2 since FreeBSD 13, even big endian.  The
existing sha256 and sha512 asm code assumes that BE is all ELFv1, and LE
is ELFv2.  Minor changes to add ELFv2 in the BE side gets this working
correctly on FreeBSD with latest OpenZFS import.

Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Justin Hibbits <chmeeedalf@gmail.com>
Closes #14779

include/os/freebsd/spl/sys/simd_powerpc.h
lib/libspl/include/sys/simd.h
module/icp/asm-ppc64/sha2/sha256-p8.S
module/icp/asm-ppc64/sha2/sha256-ppc.S
module/icp/asm-ppc64/sha2/sha512-p8.S
module/icp/asm-ppc64/sha2/sha512-ppc.S

index edaab81d15fca84fc7533f2ba4e112743c5b0bb8..cf3c712c6af26248f82af3093b84e6df579da8eb 100644 (file)
@@ -49,7 +49,7 @@
 #include <machine/pcb.h>
 #include <machine/cpu.h>
 
-#define        kfpu_allowed()          1
+#define        kfpu_allowed()          0
 #define        kfpu_initialize(tsk)    do {} while (0)
 #define        kfpu_begin()            do {} while (0)
 #define        kfpu_end()              do {} while (0)
index a106967d0725c0819b2af7d54dc40e7beaea0e67..41f9df506468c9a41557016947e07e96982df120 100644 (file)
@@ -551,7 +551,7 @@ zfs_sha512_available(void)
 
 #elif defined(__powerpc__)
 
-#define        kfpu_allowed()          1
+#define        kfpu_allowed()          0
 #define        kfpu_initialize(tsk)    do {} while (0)
 #define        kfpu_begin()            do {} while (0)
 #define        kfpu_end()              do {} while (0)
index 6bbfe23b6e15032f93fabc451fc5abbd76d26a7e..dc3c4cea669cd5ad833dc343e3e976ad68376f45 100644 (file)
@@ -21,6 +21,7 @@
 
 #if (defined(__PPC64__) && defined(__BIG_ENDIAN__))
 
+#if (!defined(_CALL_ELF) || _CALL_ELF == 1)
 .text
 
 .globl zfs_sha256_power8
@@ -33,6 +34,16 @@ zfs_sha256_power8:
 .previous
 .align 6
 .zfs_sha256_power8:
+#else
+.abiversion    2
+.text
+
+.globl zfs_sha256_power8
+.type  zfs_sha256_power8,@function
+.align 6
+zfs_sha256_power8:
+.localentry    zfs_sha256_power8,0
+#endif
        stdu    1,-384(1)
        mflr    8
        li      10,207
@@ -677,8 +688,12 @@ zfs_sha256_power8:
 .long  0
 .byte  0,12,4,1,0x80,6,3,0
 .long  0
+#if (!defined(_CALL_ELF) || _CALL_ELF == 1)
 .size  .zfs_sha256_power8,.-.zfs_sha256_power8
 .size  zfs_sha256_power8,.-.zfs_sha256_power8
+#else
+.size  zfs_sha256_power8,.-zfs_sha256_power8
+#endif
 .align 6
 .LPICmeup:
        mflr    0
index 2219e313c9c6f4cfe7a60daab096d3765440e79c..d039bc36ee11cdda4fb8a3ae6876df45a0be0c4b 100644 (file)
@@ -21,6 +21,7 @@
 
 #if (defined(__PPC64__) && defined(__BIG_ENDIAN__))
 
+#if (!defined(_CALL_ELF) || _CALL_ELF == 1)
 .text
 
 .globl zfs_sha256_ppc
@@ -33,6 +34,16 @@ zfs_sha256_ppc:
 .previous
 .align 6
 .zfs_sha256_ppc:
+#else
+.abiversion    2
+.text
+
+.globl zfs_sha256_ppc
+.type  zfs_sha256_ppc,@function
+.align 6
+zfs_sha256_ppc:
+.localentry    zfs_sha256_ppc,0
+#endif
        stdu    1,-320(1)
        mflr    0
        sldi    5,5,6
@@ -1312,8 +1323,12 @@ zfs_sha256_ppc:
        blr     
 .long  0
 .byte  0,12,0x14,0,0,0,0,0
+#if (!defined(_CALL_ELF) || _CALL_ELF == 1)
 .size  .zfs_sha256_ppc,.-.zfs_sha256_ppc
 .size  zfs_sha256_ppc,.-.zfs_sha256_ppc
+#else
+.size  zfs_sha256_ppc,.-zfs_sha256_ppc
+#endif
 .align 6
 .LPICmeup:
        mflr    0
index 39a90ede3dc5b048976955cca9c10bf459bd2781..2409c53385d63184086c203b234027e1eb7a7a0e 100644 (file)
@@ -21,6 +21,7 @@
 
 #if (defined(__PPC64__) && defined(__BIG_ENDIAN__))
 
+#if (!defined(_CALL_ELF) || _CALL_ELF == 1)
 .text
 
 .globl zfs_sha512_power8
@@ -33,6 +34,17 @@ zfs_sha512_power8:
 .previous
 .align 6
 .zfs_sha512_power8:
+#else
+.abiversion    2
+.text
+
+.globl zfs_sha512_power8
+.type  zfs_sha512_power8,@function
+.align 6
+zfs_sha512_power8:
+.localentry    zfs_sha512_power8,0
+#endif
+
        stdu    1,-384(1)
        mflr    8
        li      10,207
@@ -679,8 +691,12 @@ zfs_sha512_power8:
 .long  0
 .byte  0,12,4,1,0x80,6,3,0
 .long  0
+#if (!defined(_CALL_ELF) || _CALL_ELF == 1)
 .size  .zfs_sha512_power8,.-.zfs_sha512_power8
 .size  zfs_sha512_power8,.-.zfs_sha512_power8
+#else
+.size  zfs_sha512_power8,.-zfs_sha512_power8
+#endif
 .align 6
 .LPICmeup:
        mflr    0
index 37070115c3ff317fb1093bbaa43c08ea72121860..57213f68abc57b8d7c46dacf2df3f40d561792cb 100644 (file)
@@ -21,6 +21,7 @@
 
 #if (defined(__PPC64__) && defined(__BIG_ENDIAN__))
 
+#if (!defined(_CALL_ELF) || _CALL_ELF == 1)
 .text
 
 .globl zfs_sha512_ppc
@@ -33,6 +34,16 @@ zfs_sha512_ppc:
 .previous
 .align 6
 .zfs_sha512_ppc:
+#else
+.abiversion    2
+.text
+
+.globl zfs_sha512_ppc
+.type  zfs_sha512_ppc,@function
+.align 6
+zfs_sha512_ppc:
+.localentry    zfs_sha512_ppc,0
+#endif
        stdu    1,-384(1)
        mflr    0
        sldi    5,5,7
@@ -1350,8 +1361,12 @@ zfs_sha512_ppc:
        blr     
 .long  0
 .byte  0,12,0x14,0,0,0,0,0
+#if (!defined(_CALL_ELF) || _CALL_ELF == 1)
 .size  .zfs_sha512_ppc,.-.zfs_sha512_ppc
 .size  zfs_sha512_ppc,.-.zfs_sha512_ppc
+#else
+.size  zfs_sha512_ppc,.-zfs_sha512_ppc
+#endif
 .align 6
 .LPICmeup:
        mflr    0