mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 03:08:51 +03:00
Add PPC cpu feature tests for FreeBSD and Linux
Add needed cpu feature tests for powerpc architecture. Overview: zfs_altivec_available() - needed by RAID-Z zfs_vsx_available() - needed by BLAKE3 zfs_isa207_available() - needed by SHA2 Part 1 - Userspace - use getauxval() for Linux and elf_aux_info() for FreeBSD - direct including <sys/auxv.h> fails with double definitions - so we self define the needed functions and definitions Part 2 - Kernel space FreeBSD - use exported cpu_features of <powerpc/cpu.h> Part 3 - Kernel space Linux - use cpu_has_feature() function of <asm/cpufeature.h> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de> Closes #13725
This commit is contained in:
committed by
Brian Behlendorf
parent
eeca9d27d7
commit
48cf170d5a
@@ -77,7 +77,7 @@ __simd_state_enabled(const uint64_t state)
|
||||
boolean_t has_osxsave;
|
||||
uint64_t xcr0;
|
||||
|
||||
has_osxsave = !!(cpu_feature2 & CPUID2_OSXSAVE);
|
||||
has_osxsave = (cpu_feature2 & CPUID2_OSXSAVE) != 0;
|
||||
|
||||
if (!has_osxsave)
|
||||
return (B_FALSE);
|
||||
@@ -99,7 +99,7 @@ __simd_state_enabled(const uint64_t state)
|
||||
static inline boolean_t
|
||||
zfs_sse_available(void)
|
||||
{
|
||||
return (!!(cpu_feature & CPUID_SSE));
|
||||
return ((cpu_feature & CPUID_SSE) != 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -108,7 +108,7 @@ zfs_sse_available(void)
|
||||
static inline boolean_t
|
||||
zfs_sse2_available(void)
|
||||
{
|
||||
return (!!(cpu_feature & CPUID_SSE2));
|
||||
return ((cpu_feature & CPUID_SSE2) != 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -117,7 +117,7 @@ zfs_sse2_available(void)
|
||||
static inline boolean_t
|
||||
zfs_sse3_available(void)
|
||||
{
|
||||
return (!!(cpu_feature2 & CPUID2_SSE3));
|
||||
return ((cpu_feature2 & CPUID2_SSE3) != 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -126,7 +126,7 @@ zfs_sse3_available(void)
|
||||
static inline boolean_t
|
||||
zfs_ssse3_available(void)
|
||||
{
|
||||
return (!!(cpu_feature2 & CPUID2_SSSE3));
|
||||
return ((cpu_feature2 & CPUID2_SSSE3) != 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -135,7 +135,7 @@ zfs_ssse3_available(void)
|
||||
static inline boolean_t
|
||||
zfs_sse4_1_available(void)
|
||||
{
|
||||
return (!!(cpu_feature2 & CPUID2_SSE41));
|
||||
return ((cpu_feature2 & CPUID2_SSE41) != 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -144,7 +144,7 @@ zfs_sse4_1_available(void)
|
||||
static inline boolean_t
|
||||
zfs_sse4_2_available(void)
|
||||
{
|
||||
return (!!(cpu_feature2 & CPUID2_SSE42));
|
||||
return ((cpu_feature2 & CPUID2_SSE42) != 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -155,7 +155,7 @@ zfs_avx_available(void)
|
||||
{
|
||||
boolean_t has_avx;
|
||||
|
||||
has_avx = !!(cpu_feature2 & CPUID2_AVX);
|
||||
has_avx = (cpu_feature2 & CPUID2_AVX) != 0;
|
||||
|
||||
return (has_avx && __ymm_enabled());
|
||||
}
|
||||
@@ -168,7 +168,7 @@ zfs_avx2_available(void)
|
||||
{
|
||||
boolean_t has_avx2;
|
||||
|
||||
has_avx2 = !!(cpu_stdext_feature & CPUID_STDEXT_AVX2);
|
||||
has_avx2 = (cpu_stdext_feature & CPUID_STDEXT_AVX2) != 0;
|
||||
|
||||
return (has_avx2 && __ymm_enabled());
|
||||
}
|
||||
@@ -196,7 +196,7 @@ zfs_avx512f_available(void)
|
||||
{
|
||||
boolean_t has_avx512;
|
||||
|
||||
has_avx512 = !!(cpu_stdext_feature & CPUID_STDEXT_AVX512F);
|
||||
has_avx512 = (cpu_stdext_feature & CPUID_STDEXT_AVX512F) != 0;
|
||||
|
||||
return (has_avx512 && __zmm_enabled());
|
||||
}
|
||||
@@ -207,8 +207,8 @@ zfs_avx512cd_available(void)
|
||||
{
|
||||
boolean_t has_avx512;
|
||||
|
||||
has_avx512 = !!(cpu_stdext_feature & CPUID_STDEXT_AVX512F) &&
|
||||
!!(cpu_stdext_feature & CPUID_STDEXT_AVX512CD);
|
||||
has_avx512 = (cpu_stdext_feature & CPUID_STDEXT_AVX512F) != 0 &&
|
||||
(cpu_stdext_feature & CPUID_STDEXT_AVX512CD) != 0;
|
||||
|
||||
return (has_avx512 && __zmm_enabled());
|
||||
}
|
||||
@@ -219,8 +219,8 @@ zfs_avx512er_available(void)
|
||||
{
|
||||
boolean_t has_avx512;
|
||||
|
||||
has_avx512 = !!(cpu_stdext_feature & CPUID_STDEXT_AVX512F) &&
|
||||
!!(cpu_stdext_feature & CPUID_STDEXT_AVX512CD);
|
||||
has_avx512 = (cpu_stdext_feature & CPUID_STDEXT_AVX512F) != 0 &&
|
||||
(cpu_stdext_feature & CPUID_STDEXT_AVX512CD) != 0;
|
||||
|
||||
return (has_avx512 && __zmm_enabled());
|
||||
}
|
||||
@@ -231,8 +231,8 @@ zfs_avx512pf_available(void)
|
||||
{
|
||||
boolean_t has_avx512;
|
||||
|
||||
has_avx512 = !!(cpu_stdext_feature & CPUID_STDEXT_AVX512F) &&
|
||||
!!(cpu_stdext_feature & CPUID_STDEXT_AVX512PF);
|
||||
has_avx512 = (cpu_stdext_feature & CPUID_STDEXT_AVX512F) != 0 &&
|
||||
(cpu_stdext_feature & CPUID_STDEXT_AVX512PF) != 0;
|
||||
|
||||
return (has_avx512 && __zmm_enabled());
|
||||
}
|
||||
@@ -243,7 +243,7 @@ zfs_avx512bw_available(void)
|
||||
{
|
||||
boolean_t has_avx512 = B_FALSE;
|
||||
|
||||
has_avx512 = !!(cpu_stdext_feature & CPUID_STDEXT_AVX512BW);
|
||||
has_avx512 = (cpu_stdext_feature & CPUID_STDEXT_AVX512BW) != 0;
|
||||
|
||||
return (has_avx512 && __zmm_enabled());
|
||||
}
|
||||
@@ -254,8 +254,8 @@ zfs_avx512dq_available(void)
|
||||
{
|
||||
boolean_t has_avx512;
|
||||
|
||||
has_avx512 = !!(cpu_stdext_feature & CPUID_STDEXT_AVX512F) &&
|
||||
!!(cpu_stdext_feature & CPUID_STDEXT_AVX512DQ);
|
||||
has_avx512 = (cpu_stdext_feature & CPUID_STDEXT_AVX512F) != 0 &&
|
||||
(cpu_stdext_feature & CPUID_STDEXT_AVX512DQ) != 0;
|
||||
|
||||
return (has_avx512 && __zmm_enabled());
|
||||
}
|
||||
@@ -266,8 +266,8 @@ zfs_avx512vl_available(void)
|
||||
{
|
||||
boolean_t has_avx512;
|
||||
|
||||
has_avx512 = !!(cpu_stdext_feature & CPUID_STDEXT_AVX512F) &&
|
||||
!!(cpu_stdext_feature & CPUID_STDEXT_AVX512VL);
|
||||
has_avx512 = (cpu_stdext_feature & CPUID_STDEXT_AVX512F) != 0 &&
|
||||
(cpu_stdext_feature & CPUID_STDEXT_AVX512VL) != 0;
|
||||
|
||||
return (has_avx512 && __zmm_enabled());
|
||||
}
|
||||
@@ -278,8 +278,8 @@ zfs_avx512ifma_available(void)
|
||||
{
|
||||
boolean_t has_avx512;
|
||||
|
||||
has_avx512 = !!(cpu_stdext_feature & CPUID_STDEXT_AVX512F) &&
|
||||
!!(cpu_stdext_feature & CPUID_STDEXT_AVX512IFMA);
|
||||
has_avx512 = (cpu_stdext_feature & CPUID_STDEXT_AVX512F) != 0 &&
|
||||
(cpu_stdext_feature & CPUID_STDEXT_AVX512IFMA) != 0;
|
||||
|
||||
return (has_avx512 && __zmm_enabled());
|
||||
}
|
||||
@@ -290,8 +290,8 @@ zfs_avx512vbmi_available(void)
|
||||
{
|
||||
boolean_t has_avx512;
|
||||
|
||||
has_avx512 = !!(cpu_stdext_feature & CPUID_STDEXT_AVX512F) &&
|
||||
!!(cpu_stdext_feature & CPUID_STDEXT_BMI1);
|
||||
has_avx512 = (cpu_stdext_feature & CPUID_STDEXT_AVX512F) != 0 &&
|
||||
(cpu_stdext_feature & CPUID_STDEXT_BMI1) != 0;
|
||||
|
||||
return (has_avx512 && __zmm_enabled());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user