git: 1962f9631187 - stable/14 - zfs: enable FPU on powerpc*
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 04 Apr 2025 20:58:56 UTC
The branch stable/14 has been updated by pkubaj: URL: https://cgit.FreeBSD.org/src/commit/?id=1962f96311878e5413f6e70e0925f08c1d2f9db8 commit 1962f96311878e5413f6e70e0925f08c1d2f9db8 Author: Piotr Kubaj <pkubaj@FreeBSD.org> AuthorDate: 2025-03-27 16:32:59 +0000 Commit: Piotr Kubaj <pkubaj@FreeBSD.org> CommitDate: 2025-04-04 20:57:57 +0000 zfs: enable FPU on powerpc* Differential Revision: https://reviews.freebsd.org/D49538 (cherry picked from commit 5b02365ac656e1cccf293ec1c57a8eb6c5cd51e2) --- sys/conf/files.powerpc | 13 +++++++++++-- .../openzfs/include/os/freebsd/spl/sys/simd_powerpc.h | 17 ++++++++++++----- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/sys/conf/files.powerpc b/sys/conf/files.powerpc index 6d44d9114e25..ddce4b917890 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" cddl/compat/opensolaris/kern/opensolaris_atomic.c optional zfs powerpc | dtrace powerpc | zfs powerpcspe | dtrace powerpcspe compile-with "${ZFS_C}" cddl/dev/dtrace/powerpc/dtrace_asm.S optional dtrace compile-with "${DTRACE_S}" 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 2fd806e1a0b5..6d8503196050 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 @@ -43,18 +43,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> -/* FreeBSD doesn't support floating point on powerpc kernel yet */ -#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)