git: 5b02365ac656 - main - zfs: enable FPU on powerpc*
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 28 Mar 2025 16:19:59 UTC
The branch main has been updated by pkubaj: URL: https://cgit.FreeBSD.org/src/commit/?id=5b02365ac656e1cccf293ec1c57a8eb6c5cd51e2 commit 5b02365ac656e1cccf293ec1c57a8eb6c5cd51e2 Author: Piotr Kubaj <pkubaj@FreeBSD.org> AuthorDate: 2025-03-27 16:32:59 +0000 Commit: Piotr Kubaj <pkubaj@FreeBSD.org> CommitDate: 2025-03-28 16:19:29 +0000 zfs: enable FPU on powerpc* Summary: MFC after: 1 week Test Plan: make kernel and boot with ZFS on / Reviewers: #powerpc Subscribers: imp, delphij Differential Revision: https://reviews.freebsd.org/D49538 --- sys/conf/files.powerpc | 13 +++++++++++-- .../openzfs/include/os/freebsd/spl/sys/simd_powerpc.h | 15 ++++++++++++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/sys/conf/files.powerpc b/sys/conf/files.powerpc index 314931ed0939..d2c3aa260cd9 100644 --- a/sys/conf/files.powerpc +++ b/sys/conf/files.powerpc @@ -17,8 +17,17 @@ contrib/openzfs/module/icp/asm-ppc64/blake3/b3_ppc64le_sse41.S optional zfs comp # zfs sha2 hash support contrib/openzfs/module/icp/asm-ppc64/sha2/sha256-p8.S optional zfs compile-with "${ZFS_S}" contrib/openzfs/module/icp/asm-ppc64/sha2/sha512-p8.S optional zfs compile-with "${ZFS_S}" -contrib/openzfs/module/icp/asm-ppc64/sha2/sha256-ppc.S optional zfs compile-with "${ZFS_S}" -contrib/openzfs/module/icp/asm-ppc64/sha2/sha512-ppc.S optional zfs compile-with "${ZFS_S}" +zfs-sha256-ppc.o optional zfs \ + dependency "$S/contrib/openzfs/module/icp/asm-ppc64/sha2/sha256-ppc.S" \ + compile-with "${CC} -c ${ZFS_ASM_CFLAGS} -o ${.TARGET} ${WERROR} $S/contrib/openzfs/module/icp/asm-ppc64/sha2/sha256-ppc.S" \ + no-implicit-rule \ + clean "zfs-sha256-ppc.o" + +zfs-sha512-ppc.o optional zfs \ + dependency "$S/contrib/openzfs/module/icp/asm-ppc64/sha2/sha512-ppc.S" \ + compile-with "${CC} -c ${ZFS_ASM_CFLAGS} -o ${.TARGET} ${WERROR} $S/contrib/openzfs/module/icp/asm-ppc64/sha2/sha512-ppc.S" \ + no-implicit-rule \ + clean "zfs-sha512-ppc.o" # openssl ppc common files crypto/openssl/ossl_ppc.c optional ossl powerpc64 | ossl powerpc64le diff --git a/sys/contrib/openzfs/include/os/freebsd/spl/sys/simd_powerpc.h b/sys/contrib/openzfs/include/os/freebsd/spl/sys/simd_powerpc.h index 7e7abd992ee3..48b90ecc9cc2 100644 --- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/simd_powerpc.h +++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/simd_powerpc.h @@ -44,16 +44,25 @@ #ifndef _FREEBSD_SIMD_POWERPC_H #define _FREEBSD_SIMD_POWERPC_H +#include <machine/pcpu.h> + #include <sys/types.h> #include <sys/cdefs.h> #include <machine/pcb.h> #include <machine/cpu.h> +#include <machine/fpu.h> -#define kfpu_allowed() 0 +#define kfpu_allowed() 1 #define kfpu_initialize(tsk) do {} while (0) -#define kfpu_begin() do {} while (0) -#define kfpu_end() do {} while (0) +#define kfpu_begin() { \ + if (__predict_false(!is_fpu_kern_thread(0))) \ + fpu_kern_enter(PCPU_GET(curthread), NULL, FPU_KERN_NOCTX);\ +} +#define kfpu_end() { \ + if (__predict_false(PCPU_GET(curpcb)->pcb_flags & PCB_KERN_FPU_NOSAVE))\ + fpu_kern_leave(PCPU_GET(curthread), NULL); \ +} #define kfpu_init() (0) #define kfpu_fini() do {} while (0)