diff --git a/sys/conf/files.powerpc b/sys/conf/files.powerpc --- a/sys/conf/files.powerpc +++ b/sys/conf/files.powerpc @@ -17,8 +17,17 @@ # 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-sha256-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 --- 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 + #include #include #include #include +#include -#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(curthread)->td_pcb->pcb_flags & PCB_KERN_FPU_NOSAVE))\ + fpu_kern_leave(PCPU_GET(curthread), NULL); \ +} #define kfpu_init() (0) #define kfpu_fini() do {} while (0)