diff options
| author | Alexander Motin <mav@FreeBSD.org> | 2026-07-02 17:58:12 +0000 |
|---|---|---|
| committer | Alexander Motin <mav@FreeBSD.org> | 2026-07-02 17:58:12 +0000 |
| commit | cd61eb4f6681b13d98b6a7be252500ad30f05f74 (patch) | |
| tree | beb08190cf11d1a43f2128a6a0d3c3822328ab30 | |
| parent | a2545f68f64b4cfcc13ca2d372c8b9fef1c6331e (diff) | |
zfs: Wire sha512 offload to the build
FreeBSD main just got the CPUID_STDEXT4_SHA512 define.
OpenZFS PR #18732
| -rw-r--r-- | sys/conf/kern.pre.mk | 3 | ||||
| -rw-r--r-- | sys/contrib/openzfs/include/os/freebsd/spl/sys/simd_x86.h | 14 | ||||
| -rw-r--r-- | sys/contrib/openzfs/module/Makefile.bsd | 2 | ||||
| -rw-r--r-- | sys/modules/zfs/Makefile | 2 |
4 files changed, 17 insertions, 4 deletions
diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk index 19a7b45f4b6a..81108f29f0bb 100644 --- a/sys/conf/kern.pre.mk +++ b/sys/conf/kern.pre.mk @@ -212,8 +212,7 @@ ZFS_CFLAGS+= -I$S/contrib/openzfs/module/icp/include \ ZFS_CFLAGS+= -D__x86_64 -DHAVE_TOOLCHAIN_SSE2 -DHAVE_TOOLCHAIN_SSSE3 \ -DHAVE_TOOLCHAIN_SSE4_1 -DHAVE_TOOLCHAIN_AVX -DHAVE_TOOLCHAIN_AVX2 \ -DHAVE_TOOLCHAIN_AVX512F -DHAVE_TOOLCHAIN_AVX512VL \ - -DHAVE_TOOLCHAIN_AVX512BW \ - -DHAVE_TOOLCHAIN_VAES -DHAVE_TOOLCHAIN_VPCLMULQDQ + -DHAVE_TOOLCHAIN_AVX512BW -DHAVE_TOOLCHAIN_SHA512EXT .endif .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \ diff --git a/sys/contrib/openzfs/include/os/freebsd/spl/sys/simd_x86.h b/sys/contrib/openzfs/include/os/freebsd/spl/sys/simd_x86.h index c562fb0171d0..ced6ac1f9eab 100644 --- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/simd_x86.h +++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/simd_x86.h @@ -192,6 +192,20 @@ zfs_shani_available(void) } /* + * Check if SHA-512 extension is available + */ +static inline boolean_t +zfs_sha512ext_available(void) +{ +#if defined(CPUID_STDEXT4_SHA512) + return ((cpu_stdext_feature4 & CPUID_STDEXT4_SHA512) != 0 && + __ymm_enabled()); +#else + return (B_FALSE); +#endif +} + +/* * AVX-512 family of instruction sets: * * AVX512F Foundation diff --git a/sys/contrib/openzfs/module/Makefile.bsd b/sys/contrib/openzfs/module/Makefile.bsd index a0ddbeb9ae68..436b090d9a00 100644 --- a/sys/contrib/openzfs/module/Makefile.bsd +++ b/sys/contrib/openzfs/module/Makefile.bsd @@ -50,7 +50,7 @@ CFLAGS+= -D__KERNEL__ -DFREEBSD_NAMECACHE -DBUILDING_ZFS -D__BSD_VISIBLE=1 \ CFLAGS+= -D__x86_64 -DHAVE_TOOLCHAIN_SSE2 -DHAVE_TOOLCHAIN_SSSE3 \ -DHAVE_TOOLCHAIN_SSE4_1 -DHAVE_TOOLCHAIN_AVX -DHAVE_TOOLCHAIN_AVX2 \ -DHAVE_TOOLCHAIN_AVX512F -DHAVE_TOOLCHAIN_AVX512VL \ - -DHAVE_TOOLCHAIN_AVX512BW + -DHAVE_TOOLCHAIN_AVX512BW -DHAVE_TOOLCHAIN_SHA512EXT .endif .if defined(WITH_DEBUG) && ${WITH_DEBUG} == "true" diff --git a/sys/modules/zfs/Makefile b/sys/modules/zfs/Makefile index 44a63977f288..32231d10a99a 100644 --- a/sys/modules/zfs/Makefile +++ b/sys/modules/zfs/Makefile @@ -42,7 +42,7 @@ CFLAGS+= -D__KERNEL__ -DFREEBSD_NAMECACHE -DBUILDING_ZFS -D__BSD_VISIBLE=1 \ CFLAGS+= -D__x86_64 -DHAVE_TOOLCHAIN_SSE2 -DHAVE_TOOLCHAIN_SSSE3 \ -DHAVE_TOOLCHAIN_SSE4_1 -DHAVE_TOOLCHAIN_AVX -DHAVE_TOOLCHAIN_AVX2 \ -DHAVE_TOOLCHAIN_AVX512F -DHAVE_TOOLCHAIN_AVX512VL \ - -DHAVE_TOOLCHAIN_AVX512BW + -DHAVE_TOOLCHAIN_AVX512BW -DHAVE_TOOLCHAIN_SHA512EXT .endif .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \ |
