From f5b189f9379b092600293ac3e7a670bf2087d88c Mon Sep 17 00:00:00 2001 From: Matthew Macy Date: Sat, 25 Jul 2020 11:00:23 -0700 Subject: [PATCH] FreeBSD: Fixes required to build ZFS on PowerPC Reviewed-by: Brian Behlendorf Signed-off-by: Matt Macy Closes #10622 --- include/os/freebsd/spl/sys/isa_defs.h | 15 +++++++++++++++ lib/libspl/include/sys/simd.h | 4 ++-- module/zfs/vdev_raidz_math.c | 2 +- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/include/os/freebsd/spl/sys/isa_defs.h b/include/os/freebsd/spl/sys/isa_defs.h index a9d1a4e1fd..863c2447fe 100644 --- a/include/os/freebsd/spl/sys/isa_defs.h +++ b/include/os/freebsd/spl/sys/isa_defs.h @@ -542,6 +542,21 @@ extern "C" { #define _BIT_FIELDS_LTOH #endif +#if !defined(__powerpc) +#define __powerpc +#endif + +#if defined(__powerpc64__) +#define _LONG_LONG_ALIGNMENT 8 +#define _MULTI_DATAMODEL +#else +#define _LONG_LONG_ALIGNMENT 4 +#endif +#define _LONG_LONG_ALIGNMENT_32 4 +#define _ALIGNMENT_REQUIRED 1 + +#define _SUNOS_VTOC_16 1 + /* * The following set of definitions characterize the Solaris on SPARC systems. * diff --git a/lib/libspl/include/sys/simd.h b/lib/libspl/include/sys/simd.h index 844abe5c69..dceedb698f 100644 --- a/lib/libspl/include/sys/simd.h +++ b/lib/libspl/include/sys/simd.h @@ -464,7 +464,7 @@ zfs_avx512vbmi_available(void) #include #include -#ifdef __ALTIVEC__ +#if defined(__ALTIVEC__) && !defined(__FreeBSD__) static jmp_buf env; static void sigillhandler(int x) { @@ -476,7 +476,7 @@ static inline boolean_t zfs_altivec_available(void) { boolean_t has_altivec = B_FALSE; -#ifdef __ALTIVEC__ +#if defined(__ALTIVEC__) && !defined(__FreeBSD__) sighandler_t savesig; savesig = signal(SIGILL, sigillhandler); if (setjmp(env)) { diff --git a/module/zfs/vdev_raidz_math.c b/module/zfs/vdev_raidz_math.c index acaa32f6dd..aa92cb83d3 100644 --- a/module/zfs/vdev_raidz_math.c +++ b/module/zfs/vdev_raidz_math.c @@ -65,7 +65,7 @@ const raidz_impl_ops_t *raidz_all_maths[] = { &vdev_raidz_aarch64_neon_impl, &vdev_raidz_aarch64_neonx2_impl, #endif -#if defined(__powerpc__) +#if defined(__powerpc__) && defined(__altivec__) &vdev_raidz_powerpc_altivec_impl, #endif };