aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/.gitignore1
-rw-r--r--include/Makefile.am2
-rw-r--r--include/linux/Makefile.am29
-rw-r--r--include/os/Makefile.am3
-rw-r--r--include/os/linux/Makefile.am1
-rw-r--r--include/os/linux/kernel/Makefile.am1
-rw-r--r--include/os/linux/kernel/linux/Makefile.am29
-rw-r--r--include/os/linux/kernel/linux/blkdev_compat.h (renamed from include/linux/blkdev_compat.h)0
-rw-r--r--include/os/linux/kernel/linux/compiler_compat.h (renamed from include/linux/compiler_compat.h)0
-rw-r--r--include/os/linux/kernel/linux/dcache_compat.h (renamed from include/linux/dcache_compat.h)0
-rw-r--r--include/os/linux/kernel/linux/kmap_compat.h (renamed from include/linux/kmap_compat.h)0
-rw-r--r--include/os/linux/kernel/linux/mod_compat.h (renamed from include/linux/mod_compat.h)0
-rw-r--r--include/os/linux/kernel/linux/page_compat.h (renamed from include/linux/page_compat.h)0
-rw-r--r--include/os/linux/kernel/linux/simd.h (renamed from include/linux/simd.h)8
-rw-r--r--include/os/linux/kernel/linux/simd_aarch64.h (renamed from include/linux/simd_aarch64.h)18
-rw-r--r--include/os/linux/kernel/linux/simd_x86.h (renamed from include/linux/simd_x86.h)357
-rw-r--r--include/os/linux/kernel/linux/utsname_compat.h (renamed from include/linux/utsname_compat.h)0
-rw-r--r--include/os/linux/kernel/linux/vfs_compat.h (renamed from include/linux/vfs_compat.h)0
-rw-r--r--include/os/linux/kernel/linux/xattr_compat.h (renamed from include/linux/xattr_compat.h)0
-rw-r--r--include/os/linux/spl/Makefile.am (renamed from include/spl/Makefile.am)0
-rw-r--r--include/os/linux/spl/rpc/Makefile.am (renamed from include/spl/rpc/Makefile.am)2
-rw-r--r--include/os/linux/spl/rpc/xdr.h (renamed from include/spl/rpc/xdr.h)0
-rw-r--r--include/os/linux/spl/sys/Makefile.am62
-rw-r--r--include/os/linux/spl/sys/acl.h (renamed from include/spl/sys/acl.h)0
-rw-r--r--include/os/linux/spl/sys/atomic.h (renamed from include/spl/sys/atomic.h)0
-rw-r--r--include/os/linux/spl/sys/byteorder.h (renamed from include/spl/sys/byteorder.h)0
-rw-r--r--include/os/linux/spl/sys/callb.h (renamed from include/spl/sys/callb.h)0
-rw-r--r--include/os/linux/spl/sys/callo.h (renamed from include/spl/sys/callo.h)0
-rw-r--r--include/os/linux/spl/sys/cmn_err.h (renamed from include/spl/sys/cmn_err.h)0
-rw-r--r--include/os/linux/spl/sys/condvar.h (renamed from include/spl/sys/condvar.h)0
-rw-r--r--include/os/linux/spl/sys/console.h (renamed from include/spl/sys/console.h)0
-rw-r--r--include/os/linux/spl/sys/cred.h (renamed from include/spl/sys/cred.h)0
-rw-r--r--include/os/linux/spl/sys/ctype.h (renamed from include/spl/sys/ctype.h)0
-rw-r--r--include/os/linux/spl/sys/debug.h (renamed from include/spl/sys/debug.h)0
-rw-r--r--include/os/linux/spl/sys/disp.h (renamed from include/spl/sys/disp.h)0
-rw-r--r--include/os/linux/spl/sys/dkio.h (renamed from include/spl/sys/dkio.h)0
-rw-r--r--include/os/linux/spl/sys/errno.h (renamed from include/spl/sys/errno.h)0
-rw-r--r--include/os/linux/spl/sys/fcntl.h (renamed from include/spl/sys/fcntl.h)0
-rw-r--r--include/os/linux/spl/sys/file.h (renamed from include/spl/sys/file.h)0
-rw-r--r--include/os/linux/spl/sys/inttypes.h (renamed from include/spl/sys/inttypes.h)0
-rw-r--r--include/os/linux/spl/sys/isa_defs.h (renamed from include/spl/sys/isa_defs.h)0
-rw-r--r--include/os/linux/spl/sys/kmem.h (renamed from include/spl/sys/kmem.h)0
-rw-r--r--include/os/linux/spl/sys/kmem_cache.h (renamed from include/spl/sys/kmem_cache.h)0
-rw-r--r--include/os/linux/spl/sys/kobj.h (renamed from include/spl/sys/kobj.h)0
-rw-r--r--include/os/linux/spl/sys/kstat.h (renamed from include/spl/sys/kstat.h)0
-rw-r--r--include/os/linux/spl/sys/list.h (renamed from include/spl/sys/list.h)0
-rw-r--r--include/os/linux/spl/sys/mode.h (renamed from include/spl/sys/mode.h)0
-rw-r--r--include/os/linux/spl/sys/mutex.h (renamed from include/spl/sys/mutex.h)0
-rw-r--r--include/os/linux/spl/sys/param.h (renamed from include/spl/sys/param.h)0
-rw-r--r--include/os/linux/spl/sys/proc.h (renamed from include/spl/sys/proc.h)0
-rw-r--r--include/os/linux/spl/sys/processor.h (renamed from include/spl/sys/processor.h)0
-rw-r--r--include/os/linux/spl/sys/procfs_list.h (renamed from include/spl/sys/procfs_list.h)0
-rw-r--r--include/os/linux/spl/sys/random.h (renamed from include/spl/sys/random.h)0
-rw-r--r--include/os/linux/spl/sys/rwlock.h (renamed from include/spl/sys/rwlock.h)0
-rw-r--r--include/os/linux/spl/sys/shrinker.h (renamed from include/spl/sys/shrinker.h)0
-rw-r--r--include/os/linux/spl/sys/sid.h (renamed from include/spl/sys/sid.h)0
-rw-r--r--include/os/linux/spl/sys/signal.h (renamed from include/spl/sys/signal.h)0
-rw-r--r--include/os/linux/spl/sys/simd.h31
-rw-r--r--include/os/linux/spl/sys/stat.h (renamed from include/spl/sys/stat.h)0
-rw-r--r--include/os/linux/spl/sys/strings.h (renamed from include/spl/sys/strings.h)0
-rw-r--r--include/os/linux/spl/sys/sunddi.h (renamed from include/spl/sys/sunddi.h)0
-rw-r--r--include/os/linux/spl/sys/sysmacros.h (renamed from include/spl/sys/sysmacros.h)0
-rw-r--r--include/os/linux/spl/sys/systeminfo.h (renamed from include/spl/sys/systeminfo.h)0
-rw-r--r--include/os/linux/spl/sys/taskq.h (renamed from include/spl/sys/taskq.h)0
-rw-r--r--include/os/linux/spl/sys/thread.h (renamed from include/spl/sys/thread.h)0
-rw-r--r--include/os/linux/spl/sys/time.h (renamed from include/spl/sys/time.h)0
-rw-r--r--include/os/linux/spl/sys/timer.h (renamed from include/spl/sys/timer.h)0
-rw-r--r--include/os/linux/spl/sys/tsd.h (renamed from include/spl/sys/tsd.h)0
-rw-r--r--include/os/linux/spl/sys/types.h (renamed from include/spl/sys/types.h)0
-rw-r--r--include/os/linux/spl/sys/types32.h (renamed from include/spl/sys/types32.h)0
-rw-r--r--include/os/linux/spl/sys/uio.h (renamed from include/spl/sys/uio.h)0
-rw-r--r--include/os/linux/spl/sys/user.h (renamed from include/spl/sys/user.h)0
-rw-r--r--include/os/linux/spl/sys/vfs.h (renamed from include/spl/sys/vfs.h)0
-rw-r--r--include/os/linux/spl/sys/vmem.h (renamed from include/spl/sys/vmem.h)0
-rw-r--r--include/os/linux/spl/sys/vmsystm.h (renamed from include/spl/sys/vmsystm.h)0
-rw-r--r--include/os/linux/spl/sys/vnode.h (renamed from include/spl/sys/vnode.h)0
-rw-r--r--include/os/linux/spl/sys/wait.h (renamed from include/spl/sys/wait.h)0
-rw-r--r--include/os/linux/spl/sys/zmod.h (renamed from include/spl/sys/zmod.h)0
-rw-r--r--include/os/linux/spl/sys/zone.h (renamed from include/spl/sys/zone.h)0
-rw-r--r--include/os/linux/zfs/Makefile.am1
-rw-r--r--include/os/linux/zfs/sys/Makefile.am12
-rw-r--r--include/os/linux/zfs/sys/policy.h (renamed from include/sys/policy.h)0
-rw-r--r--include/os/linux/zfs/sys/zfs_ctldir.h (renamed from include/sys/zfs_ctldir.h)0
-rw-r--r--include/os/linux/zfs/sys/zfs_dir.h (renamed from include/sys/zfs_dir.h)0
-rw-r--r--include/os/linux/zfs/sys/zfs_vfsops.h (renamed from include/sys/zfs_vfsops.h)0
-rw-r--r--include/os/linux/zfs/sys/zfs_vnops.h (renamed from include/sys/zfs_vnops.h)0
-rw-r--r--include/os/linux/zfs/sys/zpl.h (renamed from include/sys/zpl.h)0
-rw-r--r--include/spl/sys/Makefile.am61
-rw-r--r--include/sys/Makefile.am6
89 files changed, 184 insertions, 440 deletions
diff --git a/include/.gitignore b/include/.gitignore
index e6eb2116f..416f36b9e 100644
--- a/include/.gitignore
+++ b/include/.gitignore
@@ -1 +1,2 @@
/zfs_gitrev.h
+/spl
diff --git a/include/Makefile.am b/include/Makefile.am
index bac47d98d..5b37dc765 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = linux spl sys
+SUBDIRS = sys os
COMMON_H = \
$(top_srcdir)/include/zfeature_common.h \
diff --git a/include/linux/Makefile.am b/include/linux/Makefile.am
deleted file mode 100644
index 2455759e8..000000000
--- a/include/linux/Makefile.am
+++ /dev/null
@@ -1,29 +0,0 @@
-COMMON_H =
-
-KERNEL_H = \
- $(top_srcdir)/include/linux/dcache_compat.h \
- $(top_srcdir)/include/linux/xattr_compat.h \
- $(top_srcdir)/include/linux/vfs_compat.h \
- $(top_srcdir)/include/linux/blkdev_compat.h \
- $(top_srcdir)/include/linux/utsname_compat.h \
- $(top_srcdir)/include/linux/kmap_compat.h \
- $(top_srcdir)/include/linux/simd.h \
- $(top_srcdir)/include/linux/simd_x86.h \
- $(top_srcdir)/include/linux/simd_aarch64.h \
- $(top_srcdir)/include/linux/mod_compat.h \
- $(top_srcdir)/include/linux/page_compat.h \
- $(top_srcdir)/include/linux/compiler_compat.h
-
-USER_H =
-
-EXTRA_DIST = $(COMMON_H) $(KERNEL_H) $(USER_H)
-
-if CONFIG_USER
-libzfsdir = $(includedir)/libzfs/linux
-libzfs_HEADERS = $(COMMON_H) $(USER_H)
-endif
-
-if CONFIG_KERNEL
-kerneldir = @prefix@/src/zfs-$(VERSION)/include/linux
-kernel_HEADERS = $(COMMON_H) $(KERNEL_H)
-endif
diff --git a/include/os/Makefile.am b/include/os/Makefile.am
new file mode 100644
index 000000000..09c0beec4
--- /dev/null
+++ b/include/os/Makefile.am
@@ -0,0 +1,3 @@
+if BUILD_LINUX
+SUBDIRS = linux
+endif
diff --git a/include/os/linux/Makefile.am b/include/os/linux/Makefile.am
new file mode 100644
index 000000000..605a1fcb7
--- /dev/null
+++ b/include/os/linux/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = kernel spl zfs
diff --git a/include/os/linux/kernel/Makefile.am b/include/os/linux/kernel/Makefile.am
new file mode 100644
index 000000000..08b2f5fc5
--- /dev/null
+++ b/include/os/linux/kernel/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = linux
diff --git a/include/os/linux/kernel/linux/Makefile.am b/include/os/linux/kernel/linux/Makefile.am
new file mode 100644
index 000000000..06ce7c7aa
--- /dev/null
+++ b/include/os/linux/kernel/linux/Makefile.am
@@ -0,0 +1,29 @@
+COMMON_H =
+
+KERNEL_H = \
+ $(top_srcdir)/include/os/linux/kernel/linux/dcache_compat.h \
+ $(top_srcdir)/include/os/linux/kernel/linux/xattr_compat.h \
+ $(top_srcdir)/include/os/linux/kernel/linux/vfs_compat.h \
+ $(top_srcdir)/include/os/linux/kernel/linux/blkdev_compat.h \
+ $(top_srcdir)/include/os/linux/kernel/linux/utsname_compat.h \
+ $(top_srcdir)/include/os/linux/kernel/linux/kmap_compat.h \
+ $(top_srcdir)/include/os/linux/kernel/linux/simd.h \
+ $(top_srcdir)/include/os/linux/kernel/linux/simd_x86.h \
+ $(top_srcdir)/include/os/linux/kernel/linux/simd_aarch64.h \
+ $(top_srcdir)/include/os/linux/kernel/linux/mod_compat.h \
+ $(top_srcdir)/include/os/linux/kernel/linux/page_compat.h \
+ $(top_srcdir)/include/os/linux/kernel/linux/compiler_compat.h
+
+USER_H =
+
+EXTRA_DIST = $(COMMON_H) $(KERNEL_H) $(USER_H)
+
+if CONFIG_USER
+libzfsdir = $(includedir)/libzfs/linux
+libzfs_HEADERS = $(COMMON_H) $(USER_H)
+endif
+
+if CONFIG_KERNEL
+kerneldir = @prefix@/src/zfs-$(VERSION)/include/linux
+kernel_HEADERS = $(COMMON_H) $(KERNEL_H)
+endif
diff --git a/include/linux/blkdev_compat.h b/include/os/linux/kernel/linux/blkdev_compat.h
index 084ea61cc..084ea61cc 100644
--- a/include/linux/blkdev_compat.h
+++ b/include/os/linux/kernel/linux/blkdev_compat.h
diff --git a/include/linux/compiler_compat.h b/include/os/linux/kernel/linux/compiler_compat.h
index 921d32f24..921d32f24 100644
--- a/include/linux/compiler_compat.h
+++ b/include/os/linux/kernel/linux/compiler_compat.h
diff --git a/include/linux/dcache_compat.h b/include/os/linux/kernel/linux/dcache_compat.h
index bdaa5db3e..bdaa5db3e 100644
--- a/include/linux/dcache_compat.h
+++ b/include/os/linux/kernel/linux/dcache_compat.h
diff --git a/include/linux/kmap_compat.h b/include/os/linux/kernel/linux/kmap_compat.h
index b9c7f5bcc..b9c7f5bcc 100644
--- a/include/linux/kmap_compat.h
+++ b/include/os/linux/kernel/linux/kmap_compat.h
diff --git a/include/linux/mod_compat.h b/include/os/linux/kernel/linux/mod_compat.h
index 32aea4471..32aea4471 100644
--- a/include/linux/mod_compat.h
+++ b/include/os/linux/kernel/linux/mod_compat.h
diff --git a/include/linux/page_compat.h b/include/os/linux/kernel/linux/page_compat.h
index 95acb7d53..95acb7d53 100644
--- a/include/linux/page_compat.h
+++ b/include/os/linux/kernel/linux/page_compat.h
diff --git a/include/linux/simd.h b/include/os/linux/kernel/linux/simd.h
index d2b60996a..1f6574a90 100644
--- a/include/linux/simd.h
+++ b/include/os/linux/kernel/linux/simd.h
@@ -22,8 +22,8 @@
* Copyright (C) 2019 Lawrence Livermore National Security, LLC.
*/
-#ifndef _SIMD_H
-#define _SIMD_H
+#ifndef _LINUX_SIMD_H
+#define _LINUX_SIMD_H
#if defined(__x86)
#include <linux/simd_x86.h>
@@ -32,10 +32,10 @@
#include <linux/simd_aarch64.h>
#else
-#define kfpu_allowed() 1
+#define kfpu_allowed() 0
#define kfpu_initialize(tsk) do {} while (0)
#define kfpu_begin() do {} while (0)
#define kfpu_end() do {} while (0)
#endif
-#endif /* _SIMD_H */
+#endif /* _LINUX_SIMD_H */
diff --git a/include/linux/simd_aarch64.h b/include/os/linux/kernel/linux/simd_aarch64.h
index b45d31c48..ac530d920 100644
--- a/include/linux/simd_aarch64.h
+++ b/include/os/linux/kernel/linux/simd_aarch64.h
@@ -32,31 +32,21 @@
* kfpu_end()
*/
-#ifndef _SIMD_AARCH64_H
-#define _SIMD_AARCH64_H
+#ifndef _LINUX_SIMD_AARCH64_H
+#define _LINUX_SIMD_AARCH64_H
#include <sys/isa_defs.h>
#if defined(__aarch64__)
#include <sys/types.h>
-
-#if defined(_KERNEL)
#include <asm/neon.h>
+
#define kfpu_allowed() 1
#define kfpu_initialize(tsk) do {} while (0)
#define kfpu_begin() kernel_neon_begin()
#define kfpu_end() kernel_neon_end()
-#else
-/*
- * fpu dummy methods for userspace
- */
-#define kfpu_allowed() 1
-#define kfpu_initialize(tsk) do {} while (0)
-#define kfpu_begin() do {} while (0)
-#define kfpu_end() do {} while (0)
-#endif /* defined(_KERNEL) */
#endif /* __aarch64__ */
-#endif /* _SIMD_AARCH64_H */
+#endif /* _LINUX_SIMD_AARCH64_H */
diff --git a/include/linux/simd_x86.h b/include/os/linux/kernel/linux/simd_x86.h
index edd456098..c59ba4174 100644
--- a/include/linux/simd_x86.h
+++ b/include/os/linux/kernel/linux/simd_x86.h
@@ -66,23 +66,14 @@
* also add zfs_avx512vl_available() to feature check.
*/
-#ifndef _SIMD_X86_H
-#define _SIMD_X86_H
-
-#include <sys/isa_defs.h>
+#ifndef _LINUX_SIMD_X86_H
+#define _LINUX_SIMD_X86_H
/* only for __x86 */
#if defined(__x86)
#include <sys/types.h>
-
-#if defined(_KERNEL)
#include <asm/cpufeature.h>
-#else
-#include <cpuid.h>
-#endif
-
-#if defined(_KERNEL)
/*
* Disable the WARN_ON_FPU() macro to prevent additional dependencies
@@ -222,185 +213,9 @@ kfpu_end(void)
}
#endif /* defined(HAVE_KERNEL_FPU) */
-#else /* defined(_KERNEL) */
-/*
- * FPU dummy methods for user space.
- */
-#define kfpu_allowed() 1
-#define kfpu_initialize(tsk) do {} while (0)
-#define kfpu_begin() do {} while (0)
-#define kfpu_end() do {} while (0)
-#endif /* defined(_KERNEL) */
-
-/*
- * CPUID feature tests for user-space. Linux kernel provides an interface for
- * CPU feature testing.
- */
-#if !defined(_KERNEL)
-
-/*
- * x86 registers used implicitly by CPUID
- */
-typedef enum cpuid_regs {
- EAX = 0,
- EBX,
- ECX,
- EDX,
- CPUID_REG_CNT = 4
-} cpuid_regs_t;
-
-/*
- * List of instruction sets identified by CPUID
- */
-typedef enum cpuid_inst_sets {
- SSE = 0,
- SSE2,
- SSE3,
- SSSE3,
- SSE4_1,
- SSE4_2,
- OSXSAVE,
- AVX,
- AVX2,
- BMI1,
- BMI2,
- AVX512F,
- AVX512CD,
- AVX512DQ,
- AVX512BW,
- AVX512IFMA,
- AVX512VBMI,
- AVX512PF,
- AVX512ER,
- AVX512VL,
- AES,
- PCLMULQDQ
-} cpuid_inst_sets_t;
-
-/*
- * Instruction set descriptor.
- */
-typedef struct cpuid_feature_desc {
- uint32_t leaf; /* CPUID leaf */
- uint32_t subleaf; /* CPUID sub-leaf */
- uint32_t flag; /* bit mask of the feature */
- cpuid_regs_t reg; /* which CPUID return register to test */
-} cpuid_feature_desc_t;
-
-#define _AVX512F_BIT (1U << 16)
-#define _AVX512CD_BIT (_AVX512F_BIT | (1U << 28))
-#define _AVX512DQ_BIT (_AVX512F_BIT | (1U << 17))
-#define _AVX512BW_BIT (_AVX512F_BIT | (1U << 30))
-#define _AVX512IFMA_BIT (_AVX512F_BIT | (1U << 21))
-#define _AVX512VBMI_BIT (1U << 1) /* AVX512F_BIT is on another leaf */
-#define _AVX512PF_BIT (_AVX512F_BIT | (1U << 26))
-#define _AVX512ER_BIT (_AVX512F_BIT | (1U << 27))
-#define _AVX512VL_BIT (1U << 31) /* if used also check other levels */
-#define _AES_BIT (1U << 25)
-#define _PCLMULQDQ_BIT (1U << 1)
-
-/*
- * Descriptions of supported instruction sets
- */
-static const cpuid_feature_desc_t cpuid_features[] = {
- [SSE] = {1U, 0U, 1U << 25, EDX },
- [SSE2] = {1U, 0U, 1U << 26, EDX },
- [SSE3] = {1U, 0U, 1U << 0, ECX },
- [SSSE3] = {1U, 0U, 1U << 9, ECX },
- [SSE4_1] = {1U, 0U, 1U << 19, ECX },
- [SSE4_2] = {1U, 0U, 1U << 20, ECX },
- [OSXSAVE] = {1U, 0U, 1U << 27, ECX },
- [AVX] = {1U, 0U, 1U << 28, ECX },
- [AVX2] = {7U, 0U, 1U << 5, EBX },
- [BMI1] = {7U, 0U, 1U << 3, EBX },
- [BMI2] = {7U, 0U, 1U << 8, EBX },
- [AVX512F] = {7U, 0U, _AVX512F_BIT, EBX },
- [AVX512CD] = {7U, 0U, _AVX512CD_BIT, EBX },
- [AVX512DQ] = {7U, 0U, _AVX512DQ_BIT, EBX },
- [AVX512BW] = {7U, 0U, _AVX512BW_BIT, EBX },
- [AVX512IFMA] = {7U, 0U, _AVX512IFMA_BIT, EBX },
- [AVX512VBMI] = {7U, 0U, _AVX512VBMI_BIT, ECX },
- [AVX512PF] = {7U, 0U, _AVX512PF_BIT, EBX },
- [AVX512ER] = {7U, 0U, _AVX512ER_BIT, EBX },
- [AVX512VL] = {7U, 0U, _AVX512ER_BIT, EBX },
- [AES] = {1U, 0U, _AES_BIT, ECX },
- [PCLMULQDQ] = {1U, 0U, _PCLMULQDQ_BIT, ECX },
-};
-
-/*
- * Check if OS supports AVX and AVX2 by checking XCR0
- * Only call this function if CPUID indicates that AVX feature is
- * supported by the CPU, otherwise it might be an illegal instruction.
- */
-static inline uint64_t
-xgetbv(uint32_t index)
-{
- uint32_t eax, edx;
- /* xgetbv - instruction byte code */
- __asm__ __volatile__(".byte 0x0f; .byte 0x01; .byte 0xd0"
- : "=a" (eax), "=d" (edx)
- : "c" (index));
-
- return ((((uint64_t)edx)<<32) | (uint64_t)eax);
-}
-
-/*
- * Check if CPU supports a feature
- */
-static inline boolean_t
-__cpuid_check_feature(const cpuid_feature_desc_t *desc)
-{
- uint32_t r[CPUID_REG_CNT];
-
- if (__get_cpuid_max(0, NULL) >= desc->leaf) {
- /*
- * __cpuid_count is needed to properly check
- * for AVX2. It is a macro, so return parameters
- * are passed by value.
- */
- __cpuid_count(desc->leaf, desc->subleaf,
- r[EAX], r[EBX], r[ECX], r[EDX]);
- return ((r[desc->reg] & desc->flag) == desc->flag);
- }
- return (B_FALSE);
-}
-
-#define CPUID_FEATURE_CHECK(name, id) \
-static inline boolean_t \
-__cpuid_has_ ## name(void) \
-{ \
- return (__cpuid_check_feature(&cpuid_features[id])); \
-}
-
/*
- * Define functions for user-space CPUID features testing
+ * Linux kernel provides an interface for CPU feature testing.
*/
-CPUID_FEATURE_CHECK(sse, SSE);
-CPUID_FEATURE_CHECK(sse2, SSE2);
-CPUID_FEATURE_CHECK(sse3, SSE3);
-CPUID_FEATURE_CHECK(ssse3, SSSE3);
-CPUID_FEATURE_CHECK(sse4_1, SSE4_1);
-CPUID_FEATURE_CHECK(sse4_2, SSE4_2);
-CPUID_FEATURE_CHECK(avx, AVX);
-CPUID_FEATURE_CHECK(avx2, AVX2);
-CPUID_FEATURE_CHECK(osxsave, OSXSAVE);
-CPUID_FEATURE_CHECK(bmi1, BMI1);
-CPUID_FEATURE_CHECK(bmi2, BMI2);
-CPUID_FEATURE_CHECK(avx512f, AVX512F);
-CPUID_FEATURE_CHECK(avx512cd, AVX512CD);
-CPUID_FEATURE_CHECK(avx512dq, AVX512DQ);
-CPUID_FEATURE_CHECK(avx512bw, AVX512BW);
-CPUID_FEATURE_CHECK(avx512ifma, AVX512IFMA);
-CPUID_FEATURE_CHECK(avx512vbmi, AVX512VBMI);
-CPUID_FEATURE_CHECK(avx512pf, AVX512PF);
-CPUID_FEATURE_CHECK(avx512er, AVX512ER);
-CPUID_FEATURE_CHECK(avx512vl, AVX512VL);
-CPUID_FEATURE_CHECK(aes, AES);
-CPUID_FEATURE_CHECK(pclmulqdq, PCLMULQDQ);
-
-#endif /* !defined(_KERNEL) */
-
-
/*
* Detect register set support
*/
@@ -410,16 +225,11 @@ __simd_state_enabled(const uint64_t state)
boolean_t has_osxsave;
uint64_t xcr0;
-#if defined(_KERNEL)
#if defined(X86_FEATURE_OSXSAVE)
has_osxsave = !!boot_cpu_has(X86_FEATURE_OSXSAVE);
#else
has_osxsave = B_FALSE;
#endif
-#elif !defined(_KERNEL)
- has_osxsave = __cpuid_has_osxsave();
-#endif
-
if (!has_osxsave)
return (B_FALSE);
@@ -433,18 +243,13 @@ __simd_state_enabled(const uint64_t state)
#define __ymm_enabled() __simd_state_enabled(_XSTATE_SSE_AVX)
#define __zmm_enabled() __simd_state_enabled(_XSTATE_AVX512)
-
/*
* Check if SSE instruction set is available
*/
static inline boolean_t
zfs_sse_available(void)
{
-#if defined(_KERNEL)
return (!!boot_cpu_has(X86_FEATURE_XMM));
-#elif !defined(_KERNEL)
- return (__cpuid_has_sse());
-#endif
}
/*
@@ -453,11 +258,7 @@ zfs_sse_available(void)
static inline boolean_t
zfs_sse2_available(void)
{
-#if defined(_KERNEL)
return (!!boot_cpu_has(X86_FEATURE_XMM2));
-#elif !defined(_KERNEL)
- return (__cpuid_has_sse2());
-#endif
}
/*
@@ -466,11 +267,7 @@ zfs_sse2_available(void)
static inline boolean_t
zfs_sse3_available(void)
{
-#if defined(_KERNEL)
return (!!boot_cpu_has(X86_FEATURE_XMM3));
-#elif !defined(_KERNEL)
- return (__cpuid_has_sse3());
-#endif
}
/*
@@ -479,11 +276,7 @@ zfs_sse3_available(void)
static inline boolean_t
zfs_ssse3_available(void)
{
-#if defined(_KERNEL)
return (!!boot_cpu_has(X86_FEATURE_SSSE3));
-#elif !defined(_KERNEL)
- return (__cpuid_has_ssse3());
-#endif
}
/*
@@ -492,11 +285,7 @@ zfs_ssse3_available(void)
static inline boolean_t
zfs_sse4_1_available(void)
{
-#if defined(_KERNEL)
return (!!boot_cpu_has(X86_FEATURE_XMM4_1));
-#elif !defined(_KERNEL)
- return (__cpuid_has_sse4_1());
-#endif
}
/*
@@ -505,11 +294,7 @@ zfs_sse4_1_available(void)
static inline boolean_t
zfs_sse4_2_available(void)
{
-#if defined(_KERNEL)
return (!!boot_cpu_has(X86_FEATURE_XMM4_2));
-#elif !defined(_KERNEL)
- return (__cpuid_has_sse4_2());
-#endif
}
/*
@@ -518,14 +303,7 @@ zfs_sse4_2_available(void)
static inline boolean_t
zfs_avx_available(void)
{
- boolean_t has_avx;
-#if defined(_KERNEL)
- has_avx = !!boot_cpu_has(X86_FEATURE_AVX);
-#elif !defined(_KERNEL)
- has_avx = __cpuid_has_avx();
-#endif
-
- return (has_avx && __ymm_enabled());
+ return (boot_cpu_has(X86_FEATURE_AVX) && __ymm_enabled());
}
/*
@@ -534,14 +312,7 @@ zfs_avx_available(void)
static inline boolean_t
zfs_avx2_available(void)
{
- boolean_t has_avx2;
-#if defined(_KERNEL)
- has_avx2 = !!boot_cpu_has(X86_FEATURE_AVX2);
-#elif !defined(_KERNEL)
- has_avx2 = __cpuid_has_avx2();
-#endif
-
- return (has_avx2 && __ymm_enabled());
+ return (boot_cpu_has(X86_FEATURE_AVX2) && __ymm_enabled());
}
/*
@@ -550,15 +321,11 @@ zfs_avx2_available(void)
static inline boolean_t
zfs_bmi1_available(void)
{
-#if defined(_KERNEL)
#if defined(X86_FEATURE_BMI1)
return (!!boot_cpu_has(X86_FEATURE_BMI1));
#else
return (B_FALSE);
#endif
-#elif !defined(_KERNEL)
- return (__cpuid_has_bmi1());
-#endif
}
/*
@@ -567,15 +334,11 @@ zfs_bmi1_available(void)
static inline boolean_t
zfs_bmi2_available(void)
{
-#if defined(_KERNEL)
#if defined(X86_FEATURE_BMI2)
return (!!boot_cpu_has(X86_FEATURE_BMI2));
#else
return (B_FALSE);
#endif
-#elif !defined(_KERNEL)
- return (__cpuid_has_bmi2());
-#endif
}
/*
@@ -584,15 +347,11 @@ zfs_bmi2_available(void)
static inline boolean_t
zfs_aes_available(void)
{
-#if defined(_KERNEL)
#if defined(X86_FEATURE_AES)
return (!!boot_cpu_has(X86_FEATURE_AES));
#else
return (B_FALSE);
#endif
-#elif !defined(_KERNEL)
- return (__cpuid_has_aes());
-#endif
}
/*
@@ -601,15 +360,11 @@ zfs_aes_available(void)
static inline boolean_t
zfs_pclmulqdq_available(void)
{
-#if defined(_KERNEL)
#if defined(X86_FEATURE_PCLMULQDQ)
return (!!boot_cpu_has(X86_FEATURE_PCLMULQDQ));
#else
return (B_FALSE);
#endif
-#elif !defined(_KERNEL)
- return (__cpuid_has_pclmulqdq());
-#endif
}
/*
@@ -628,187 +383,141 @@ zfs_pclmulqdq_available(void)
* AVX512VBMI Vector Byte Manipulation Instructions
*/
-
-/* Check if AVX512F instruction set is available */
+/*
+ * Check if AVX512F instruction set is available
+ */
static inline boolean_t
zfs_avx512f_available(void)
{
boolean_t has_avx512 = B_FALSE;
-#if defined(_KERNEL)
#if defined(X86_FEATURE_AVX512F)
has_avx512 = !!boot_cpu_has(X86_FEATURE_AVX512F);
-#else
- has_avx512 = B_FALSE;
#endif
-#elif !defined(_KERNEL)
- has_avx512 = __cpuid_has_avx512f();
-#endif
-
return (has_avx512 && __zmm_enabled());
}
-/* Check if AVX512CD instruction set is available */
+/*
+ * Check if AVX512CD instruction set is available
+ */
static inline boolean_t
zfs_avx512cd_available(void)
{
boolean_t has_avx512 = B_FALSE;
-#if defined(_KERNEL)
#if defined(X86_FEATURE_AVX512CD)
has_avx512 = boot_cpu_has(X86_FEATURE_AVX512F) &&
boot_cpu_has(X86_FEATURE_AVX512CD);
-#else
- has_avx512 = B_FALSE;
-#endif
-#elif !defined(_KERNEL)
- has_avx512 = __cpuid_has_avx512cd();
#endif
-
return (has_avx512 && __zmm_enabled());
}
-/* Check if AVX512ER instruction set is available */
+/*
+ * Check if AVX512ER instruction set is available
+ */
static inline boolean_t
zfs_avx512er_available(void)
{
boolean_t has_avx512 = B_FALSE;
-#if defined(_KERNEL)
#if defined(X86_FEATURE_AVX512ER)
has_avx512 = boot_cpu_has(X86_FEATURE_AVX512F) &&
boot_cpu_has(X86_FEATURE_AVX512ER);
-#else
- has_avx512 = B_FALSE;
-#endif
-#elif !defined(_KERNEL)
- has_avx512 = __cpuid_has_avx512er();
#endif
-
return (has_avx512 && __zmm_enabled());
}
-/* Check if AVX512PF instruction set is available */
+/*
+ * Check if AVX512PF instruction set is available
+ */
static inline boolean_t
zfs_avx512pf_available(void)
{
boolean_t has_avx512 = B_FALSE;
-#if defined(_KERNEL)
#if defined(X86_FEATURE_AVX512PF)
has_avx512 = boot_cpu_has(X86_FEATURE_AVX512F) &&
boot_cpu_has(X86_FEATURE_AVX512PF);
-#else
- has_avx512 = B_FALSE;
-#endif
-#elif !defined(_KERNEL)
- has_avx512 = __cpuid_has_avx512pf();
#endif
-
return (has_avx512 && __zmm_enabled());
}
-/* Check if AVX512BW instruction set is available */
+/*
+ * Check if AVX512BW instruction set is available
+ */
static inline boolean_t
zfs_avx512bw_available(void)
{
boolean_t has_avx512 = B_FALSE;
-#if defined(_KERNEL)
#if defined(X86_FEATURE_AVX512BW)
has_avx512 = boot_cpu_has(X86_FEATURE_AVX512F) &&
boot_cpu_has(X86_FEATURE_AVX512BW);
-#else
- has_avx512 = B_FALSE;
-#endif
-#elif !defined(_KERNEL)
- has_avx512 = __cpuid_has_avx512bw();
#endif
return (has_avx512 && __zmm_enabled());
}
-/* Check if AVX512DQ instruction set is available */
+/*
+ * Check if AVX512DQ instruction set is available
+ */
static inline boolean_t
zfs_avx512dq_available(void)
{
boolean_t has_avx512 = B_FALSE;
-#if defined(_KERNEL)
#if defined(X86_FEATURE_AVX512DQ)
has_avx512 = boot_cpu_has(X86_FEATURE_AVX512F) &&
boot_cpu_has(X86_FEATURE_AVX512DQ);
-#else
- has_avx512 = B_FALSE;
-#endif
-#elif !defined(_KERNEL)
- has_avx512 = __cpuid_has_avx512dq();
#endif
-
return (has_avx512 && __zmm_enabled());
}
-/* Check if AVX512VL instruction set is available */
+/*
+ * Check if AVX512VL instruction set is available
+ */
static inline boolean_t
zfs_avx512vl_available(void)
{
boolean_t has_avx512 = B_FALSE;
-#if defined(_KERNEL)
#if defined(X86_FEATURE_AVX512VL)
has_avx512 = boot_cpu_has(X86_FEATURE_AVX512F) &&
boot_cpu_has(X86_FEATURE_AVX512VL);
-#else
- has_avx512 = B_FALSE;
-#endif
-#elif !defined(_KERNEL)
- has_avx512 = __cpuid_has_avx512vl();
#endif
-
return (has_avx512 && __zmm_enabled());
}
-/* Check if AVX512IFMA instruction set is available */
+/*
+ * Check if AVX512IFMA instruction set is available
+ */
static inline boolean_t
zfs_avx512ifma_available(void)
{
boolean_t has_avx512 = B_FALSE;
-#if defined(_KERNEL)
#if defined(X86_FEATURE_AVX512IFMA)
has_avx512 = boot_cpu_has(X86_FEATURE_AVX512F) &&
boot_cpu_has(X86_FEATURE_AVX512IFMA);
-#else
- has_avx512 = B_FALSE;
-#endif
-#elif !defined(_KERNEL)
- has_avx512 = __cpuid_has_avx512ifma();
#endif
-
return (has_avx512 && __zmm_enabled());
}
-/* Check if AVX512VBMI instruction set is available */
+/*
+ * Check if AVX512VBMI instruction set is available
+ */
static inline boolean_t
zfs_avx512vbmi_available(void)
{
boolean_t has_avx512 = B_FALSE;
-#if defined(_KERNEL)
#if defined(X86_FEATURE_AVX512VBMI)
has_avx512 = boot_cpu_has(X86_FEATURE_AVX512F) &&
boot_cpu_has(X86_FEATURE_AVX512VBMI);
-#else
- has_avx512 = B_FALSE;
#endif
-#elif !defined(_KERNEL)
- has_avx512 = __cpuid_has_avx512f() &&
- __cpuid_has_avx512vbmi();
-#endif
-
return (has_avx512 && __zmm_enabled());
}
#endif /* defined(__x86) */
-#endif /* _SIMD_X86_H */
+#endif /* _LINUX_SIMD_X86_H */
diff --git a/include/linux/utsname_compat.h b/include/os/linux/kernel/linux/utsname_compat.h
index 88da45cf5..88da45cf5 100644
--- a/include/linux/utsname_compat.h
+++ b/include/os/linux/kernel/linux/utsname_compat.h
diff --git a/include/linux/vfs_compat.h b/include/os/linux/kernel/linux/vfs_compat.h
index 28b454133..28b454133 100644
--- a/include/linux/vfs_compat.h
+++ b/include/os/linux/kernel/linux/vfs_compat.h
diff --git a/include/linux/xattr_compat.h b/include/os/linux/kernel/linux/xattr_compat.h
index b1c429307..b1c429307 100644
--- a/include/linux/xattr_compat.h
+++ b/include/os/linux/kernel/linux/xattr_compat.h
diff --git a/include/spl/Makefile.am b/include/os/linux/spl/Makefile.am
index bd781c08f..bd781c08f 100644
--- a/include/spl/Makefile.am
+++ b/include/os/linux/spl/Makefile.am
diff --git a/include/spl/rpc/Makefile.am b/include/os/linux/spl/rpc/Makefile.am
index 5110cc0f0..9477dd59d 100644
--- a/include/spl/rpc/Makefile.am
+++ b/include/os/linux/spl/rpc/Makefile.am
@@ -1,5 +1,5 @@
KERNEL_H = \
- $(top_srcdir)/include/spl/rpc/xdr.h
+ $(top_srcdir)/include/os/linux/spl/rpc/xdr.h
if CONFIG_KERNEL
kerneldir = @prefix@/src/zfs-$(VERSION)/include/spl/rpc
diff --git a/include/spl/rpc/xdr.h b/include/os/linux/spl/rpc/xdr.h
index 0b39b46cf..0b39b46cf 100644
--- a/include/spl/rpc/xdr.h
+++ b/include/os/linux/spl/rpc/xdr.h
diff --git a/include/os/linux/spl/sys/Makefile.am b/include/os/linux/spl/sys/Makefile.am
new file mode 100644
index 000000000..de2f74d8c
--- /dev/null
+++ b/include/os/linux/spl/sys/Makefile.am
@@ -0,0 +1,62 @@
+KERNEL_H = \
+ $(top_srcdir)/include/os/linux/spl/sys/acl.h \
+ $(top_srcdir)/include/os/linux/spl/sys/atomic.h \
+ $(top_srcdir)/include/os/linux/spl/sys/byteorder.h \
+ $(top_srcdir)/include/os/linux/spl/sys/callb.h \
+ $(top_srcdir)/include/os/linux/spl/sys/callo.h \
+ $(top_srcdir)/include/os/linux/spl/sys/cmn_err.h \
+ $(top_srcdir)/include/os/linux/spl/sys/condvar.h \
+ $(top_srcdir)/include/os/linux/spl/sys/console.h \
+ $(top_srcdir)/include/os/linux/spl/sys/cred.h \
+ $(top_srcdir)/include/os/linux/spl/sys/ctype.h \
+ $(top_srcdir)/include/os/linux/spl/sys/debug.h \
+ $(top_srcdir)/include/os/linux/spl/sys/disp.h \
+ $(top_srcdir)/include/os/linux/spl/sys/dkio.h \
+ $(top_srcdir)/include/os/linux/spl/sys/errno.h \
+ $(top_srcdir)/include/os/linux/spl/sys/fcntl.h \
+ $(top_srcdir)/include/os/linux/spl/sys/file.h \
+ $(top_srcdir)/include/os/linux/spl/sys/inttypes.h \
+ $(top_srcdir)/include/os/linux/spl/sys/isa_defs.h \
+ $(top_srcdir)/include/os/linux/spl/sys/kmem_cache.h \
+ $(top_srcdir)/include/os/linux/spl/sys/kmem.h \
+ $(top_srcdir)/include/os/linux/spl/sys/kobj.h \
+ $(top_srcdir)/include/os/linux/spl/sys/kstat.h \
+ $(top_srcdir)/include/os/linux/spl/sys/list.h \
+ $(top_srcdir)/include/os/linux/spl/sys/mode.h \
+ $(top_srcdir)/include/os/linux/spl/sys/mutex.h \
+ $(top_srcdir)/include/os/linux/spl/sys/param.h \
+ $(top_srcdir)/include/os/linux/spl/sys/processor.h \
+ $(top_srcdir)/include/os/linux/spl/sys/proc.h \
+ $(top_srcdir)/include/os/linux/spl/sys/procfs_list.h \
+ $(top_srcdir)/include/os/linux/spl/sys/random.h \
+ $(top_srcdir)/include/os/linux/spl/sys/rwlock.h \
+ $(top_srcdir)/include/os/linux/spl/sys/shrinker.h \
+ $(top_srcdir)/include/os/linux/spl/sys/sid.h \
+ $(top_srcdir)/include/os/linux/spl/sys/signal.h \
+ $(top_srcdir)/include/os/linux/spl/sys/simd.h \
+ $(top_srcdir)/include/os/linux/spl/sys/stat.h \
+ $(top_srcdir)/include/os/linux/spl/sys/strings.h \
+ $(top_srcdir)/include/os/linux/spl/sys/sunddi.h \
+ $(top_srcdir)/include/os/linux/spl/sys/sysmacros.h \
+ $(top_srcdir)/include/os/linux/spl/sys/systeminfo.h \
+ $(top_srcdir)/include/os/linux/spl/sys/taskq.h \
+ $(top_srcdir)/include/os/linux/spl/sys/thread.h \
+ $(top_srcdir)/include/os/linux/spl/sys/time.h \
+ $(top_srcdir)/include/os/linux/spl/sys/timer.h \
+ $(top_srcdir)/include/os/linux/spl/sys/tsd.h \
+ $(top_srcdir)/include/os/linux/spl/sys/types32.h \
+ $(top_srcdir)/include/os/linux/spl/sys/types.h \
+ $(top_srcdir)/include/os/linux/spl/sys/uio.h \
+ $(top_srcdir)/include/os/linux/spl/sys/user.h \
+ $(top_srcdir)/include/os/linux/spl/sys/vfs.h \
+ $(top_srcdir)/include/os/linux/spl/sys/vmem.h \
+ $(top_srcdir)/include/os/linux/spl/sys/vmsystm.h \
+ $(top_srcdir)/include/os/linux/spl/sys/vnode.h \
+ $(top_srcdir)/include/os/linux/spl/sys/wait.h \
+ $(top_srcdir)/include/os/linux/spl/sys/zmod.h \
+ $(top_srcdir)/include/os/linux/spl/sys/zone.h
+
+if CONFIG_KERNEL
+kerneldir = @prefix@/src/zfs-$(VERSION)/include/spl/sys
+kernel_HEADERS = $(KERNEL_H)
+endif
diff --git a/include/spl/sys/acl.h b/include/os/linux/spl/sys/acl.h
index 9fc79c025..9fc79c025 100644
--- a/include/spl/sys/acl.h
+++ b/include/os/linux/spl/sys/acl.h
diff --git a/include/spl/sys/atomic.h b/include/os/linux/spl/sys/atomic.h
index 51b547923..51b547923 100644
--- a/include/spl/sys/atomic.h
+++ b/include/os/linux/spl/sys/atomic.h
diff --git a/include/spl/sys/byteorder.h b/include/os/linux/spl/sys/byteorder.h
index 477707996..477707996 100644
--- a/include/spl/sys/byteorder.h
+++ b/include/os/linux/spl/sys/byteorder.h
diff --git a/include/spl/sys/callb.h b/include/os/linux/spl/sys/callb.h
index f1826bfd3..f1826bfd3 100644
--- a/include/spl/sys/callb.h
+++ b/include/os/linux/spl/sys/callb.h
diff --git a/include/spl/sys/callo.h b/include/os/linux/spl/sys/callo.h
index c43ac92e7..c43ac92e7 100644
--- a/include/spl/sys/callo.h
+++ b/include/os/linux/spl/sys/callo.h
diff --git a/include/spl/sys/cmn_err.h b/include/os/linux/spl/sys/cmn_err.h
index be57358b0..be57358b0 100644
--- a/include/spl/sys/cmn_err.h
+++ b/include/os/linux/spl/sys/cmn_err.h
diff --git a/include/spl/sys/condvar.h b/include/os/linux/spl/sys/condvar.h
index f1438c4e2..f1438c4e2 100644
--- a/include/spl/sys/condvar.h
+++ b/include/os/linux/spl/sys/condvar.h
diff --git a/include/spl/sys/console.h b/include/os/linux/spl/sys/console.h
index 3469cb762..3469cb762 100644
--- a/include/spl/sys/console.h
+++ b/include/os/linux/spl/sys/console.h
diff --git a/include/spl/sys/cred.h b/include/os/linux/spl/sys/cred.h
index fd063399b..fd063399b 100644
--- a/include/spl/sys/cred.h
+++ b/include/os/linux/spl/sys/cred.h
diff --git a/include/spl/sys/ctype.h b/include/os/linux/spl/sys/ctype.h
index 18beb1daa..18beb1daa 100644
--- a/include/spl/sys/ctype.h
+++ b/include/os/linux/spl/sys/ctype.h
diff --git a/include/spl/sys/debug.h b/include/os/linux/spl/sys/debug.h
index ecda6bcb8..ecda6bcb8 100644
--- a/include/spl/sys/debug.h
+++ b/include/os/linux/spl/sys/debug.h
diff --git a/include/spl/sys/disp.h b/include/os/linux/spl/sys/disp.h
index 413b623c8..413b623c8 100644
--- a/include/spl/sys/disp.h
+++ b/include/os/linux/spl/sys/disp.h
diff --git a/include/spl/sys/dkio.h b/include/os/linux/spl/sys/dkio.h
index 49f166a9c..49f166a9c 100644
--- a/include/spl/sys/dkio.h
+++ b/include/os/linux/spl/sys/dkio.h
diff --git a/include/spl/sys/errno.h b/include/os/linux/spl/sys/errno.h
index 6015b1a3e..6015b1a3e 100644
--- a/include/spl/sys/errno.h
+++ b/include/os/linux/spl/sys/errno.h
diff --git a/include/spl/sys/fcntl.h b/include/os/linux/spl/sys/fcntl.h
index 3faa5dad7..3faa5dad7 100644
--- a/include/spl/sys/fcntl.h
+++ b/include/os/linux/spl/sys/fcntl.h
diff --git a/include/spl/sys/file.h b/include/os/linux/spl/sys/file.h
index 05dbc0814..05dbc0814 100644
--- a/include/spl/sys/file.h
+++ b/include/os/linux/spl/sys/file.h
diff --git a/include/spl/sys/inttypes.h b/include/os/linux/spl/sys/inttypes.h
index 92e76206b..92e76206b 100644
--- a/include/spl/sys/inttypes.h
+++ b/include/os/linux/spl/sys/inttypes.h
diff --git a/include/spl/sys/isa_defs.h b/include/os/linux/spl/sys/isa_defs.h
index 1eb400277..1eb400277 100644
--- a/include/spl/sys/isa_defs.h
+++ b/include/os/linux/spl/sys/isa_defs.h
diff --git a/include/spl/sys/kmem.h b/include/os/linux/spl/sys/kmem.h
index 72d3a7765..72d3a7765 100644
--- a/include/spl/sys/kmem.h
+++ b/include/os/linux/spl/sys/kmem.h
diff --git a/include/spl/sys/kmem_cache.h b/include/os/linux/spl/sys/kmem_cache.h
index 4ee7bcae0..4ee7bcae0 100644
--- a/include/spl/sys/kmem_cache.h
+++ b/include/os/linux/spl/sys/kmem_cache.h
diff --git a/include/spl/sys/kobj.h b/include/os/linux/spl/sys/kobj.h
index 558ec39a8..558ec39a8 100644
--- a/include/spl/sys/kobj.h
+++ b/include/os/linux/spl/sys/kobj.h
diff --git a/include/spl/sys/kstat.h b/include/os/linux/spl/sys/kstat.h
index 3ce474248..3ce474248 100644
--- a/include/spl/sys/kstat.h
+++ b/include/os/linux/spl/sys/kstat.h
diff --git a/include/spl/sys/list.h b/include/os/linux/spl/sys/list.h
index 74b784e93..74b784e93 100644
--- a/include/spl/sys/list.h
+++ b/include/os/linux/spl/sys/list.h
diff --git a/include/spl/sys/mode.h b/include/os/linux/spl/sys/mode.h
index 02802d0d4..02802d0d4 100644
--- a/include/spl/sys/mode.h
+++ b/include/os/linux/spl/sys/mode.h
diff --git a/include/spl/sys/mutex.h b/include/os/linux/spl/sys/mutex.h
index 73da23685..73da23685 100644
--- a/include/spl/sys/mutex.h
+++ b/include/os/linux/spl/sys/mutex.h
diff --git a/include/spl/sys/param.h b/include/os/linux/spl/sys/param.h
index 4ef929151..4ef929151 100644
--- a/include/spl/sys/param.h
+++ b/include/os/linux/spl/sys/param.h
diff --git a/include/spl/sys/proc.h b/include/os/linux/spl/sys/proc.h
index 05c44bca5..05c44bca5 100644
--- a/include/spl/sys/proc.h
+++ b/include/os/linux/spl/sys/proc.h
diff --git a/include/spl/sys/processor.h b/include/os/linux/spl/sys/processor.h
index a70101fa2..a70101fa2 100644
--- a/include/spl/sys/processor.h
+++ b/include/os/linux/spl/sys/processor.h
diff --git a/include/spl/sys/procfs_list.h b/include/os/linux/spl/sys/procfs_list.h
index eb1519c0a..eb1519c0a 100644
--- a/include/spl/sys/procfs_list.h
+++ b/include/os/linux/spl/sys/procfs_list.h
diff --git a/include/spl/sys/random.h b/include/os/linux/spl/sys/random.h
index 93e244f56..93e244f56 100644
--- a/include/spl/sys/random.h
+++ b/include/os/linux/spl/sys/random.h
diff --git a/include/spl/sys/rwlock.h b/include/os/linux/spl/sys/rwlock.h
index 60f5bfd98..60f5bfd98 100644
--- a/include/spl/sys/rwlock.h
+++ b/include/os/linux/spl/sys/rwlock.h
diff --git a/include/spl/sys/shrinker.h b/include/os/linux/spl/sys/shrinker.h
index 28c1fa78c..28c1fa78c 100644
--- a/include/spl/sys/shrinker.h
+++ b/include/os/linux/spl/sys/shrinker.h
diff --git a/include/spl/sys/sid.h b/include/os/linux/spl/sys/sid.h
index 731b62c47..731b62c47 100644
--- a/include/spl/sys/sid.h
+++ b/include/os/linux/spl/sys/sid.h
diff --git a/include/spl/sys/signal.h b/include/os/linux/spl/sys/signal.h
index 36b8b5d98..36b8b5d98 100644
--- a/include/spl/sys/signal.h
+++ b/include/os/linux/spl/sys/signal.h
diff --git a/include/os/linux/spl/sys/simd.h b/include/os/linux/spl/sys/simd.h
new file mode 100644
index 000000000..f2048d9e1
--- /dev/null
+++ b/include/os/linux/spl/sys/simd.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
+ * Copyright (C) 2007 The Regents of the University of California.
+ * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
+ * Written by Brian Behlendorf <[email protected]>.
+ * UCRL-CODE-235197
+ *
+ * This file is part of the SPL, Solaris Porting Layer.
+ * For details, see <http://zfsonlinux.org/>.
+ *
+ * The SPL is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * The SPL is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with the SPL. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _SPL_SYS_SIMD_H
+#define _SPL_SYS_SIMD_H
+
+#include <sys/isa_defs.h>
+#include <linux/simd.h>
+
+#endif /* _SPL_SYS_SIMD_H */
diff --git a/include/spl/sys/stat.h b/include/os/linux/spl/sys/stat.h
index 83018e894..83018e894 100644
--- a/include/spl/sys/stat.h
+++ b/include/os/linux/spl/sys/stat.h
diff --git a/include/spl/sys/strings.h b/include/os/linux/spl/sys/strings.h
index 8b810c9af..8b810c9af 100644
--- a/include/spl/sys/strings.h
+++ b/include/os/linux/spl/sys/strings.h
diff --git a/include/spl/sys/sunddi.h b/include/os/linux/spl/sys/sunddi.h
index 29a6fe00d..29a6fe00d 100644
--- a/include/spl/sys/sunddi.h
+++ b/include/os/linux/spl/sys/sunddi.h
diff --git a/include/spl/sys/sysmacros.h b/include/os/linux/spl/sys/sysmacros.h
index 0753864d1..0753864d1 100644
--- a/include/spl/sys/sysmacros.h
+++ b/include/os/linux/spl/sys/sysmacros.h
diff --git a/include/spl/sys/systeminfo.h b/include/os/linux/spl/sys/systeminfo.h
index 225569158..225569158 100644
--- a/include/spl/sys/systeminfo.h
+++ b/include/os/linux/spl/sys/systeminfo.h
diff --git a/include/spl/sys/taskq.h b/include/os/linux/spl/sys/taskq.h
index 7353367a2..7353367a2 100644
--- a/include/spl/sys/taskq.h
+++ b/include/os/linux/spl/sys/taskq.h
diff --git a/include/spl/sys/thread.h b/include/os/linux/spl/sys/thread.h
index 3762717da..3762717da 100644
--- a/include/spl/sys/thread.h
+++ b/include/os/linux/spl/sys/thread.h
diff --git a/include/spl/sys/time.h b/include/os/linux/spl/sys/time.h
index 312415b7b..312415b7b 100644
--- a/include/spl/sys/time.h
+++ b/include/os/linux/spl/sys/time.h
diff --git a/include/spl/sys/timer.h b/include/os/linux/spl/sys/timer.h
index 31d89d3b9..31d89d3b9 100644
--- a/include/spl/sys/timer.h
+++ b/include/os/linux/spl/sys/timer.h
diff --git a/include/spl/sys/tsd.h b/include/os/linux/spl/sys/tsd.h
index 39a291bf3..39a291bf3 100644
--- a/include/spl/sys/tsd.h
+++ b/include/os/linux/spl/sys/tsd.h
diff --git a/include/spl/sys/types.h b/include/os/linux/spl/sys/types.h
index 719a44646..719a44646 100644
--- a/include/spl/sys/types.h
+++ b/include/os/linux/spl/sys/types.h
diff --git a/include/spl/sys/types32.h b/include/os/linux/spl/sys/types32.h
index c60ba8c97..c60ba8c97 100644
--- a/include/spl/sys/types32.h
+++ b/include/os/linux/spl/sys/types32.h
diff --git a/include/spl/sys/uio.h b/include/os/linux/spl/sys/uio.h
index fac26079d..fac26079d 100644
--- a/include/spl/sys/uio.h
+++ b/include/os/linux/spl/sys/uio.h
diff --git a/include/spl/sys/user.h b/include/os/linux/spl/sys/user.h
index b12cb240e..b12cb240e 100644
--- a/include/spl/sys/user.h
+++ b/include/os/linux/spl/sys/user.h
diff --git a/include/spl/sys/vfs.h b/include/os/linux/spl/sys/vfs.h
index 0d5e1d51d..0d5e1d51d 100644
--- a/include/spl/sys/vfs.h
+++ b/include/os/linux/spl/sys/vfs.h
diff --git a/include/spl/sys/vmem.h b/include/os/linux/spl/sys/vmem.h
index a9b12eeb9..a9b12eeb9 100644
--- a/include/spl/sys/vmem.h
+++ b/include/os/linux/spl/sys/vmem.h
diff --git a/include/spl/sys/vmsystm.h b/include/os/linux/spl/sys/vmsystm.h
index 5807d960a..5807d960a 100644
--- a/include/spl/sys/vmsystm.h
+++ b/include/os/linux/spl/sys/vmsystm.h
diff --git a/include/spl/sys/vnode.h b/include/os/linux/spl/sys/vnode.h
index 7bd278e4e..7bd278e4e 100644
--- a/include/spl/sys/vnode.h
+++ b/include/os/linux/spl/sys/vnode.h
diff --git a/include/spl/sys/wait.h b/include/os/linux/spl/sys/wait.h
index 5311ff8b9..5311ff8b9 100644
--- a/include/spl/sys/wait.h
+++ b/include/os/linux/spl/sys/wait.h
diff --git a/include/spl/sys/zmod.h b/include/os/linux/spl/sys/zmod.h
index 95c1a3ed7..95c1a3ed7 100644
--- a/include/spl/sys/zmod.h
+++ b/include/os/linux/spl/sys/zmod.h
diff --git a/include/spl/sys/zone.h b/include/os/linux/spl/sys/zone.h
index b2efd13b8..b2efd13b8 100644
--- a/include/spl/sys/zone.h
+++ b/include/os/linux/spl/sys/zone.h
diff --git a/include/os/linux/zfs/Makefile.am b/include/os/linux/zfs/Makefile.am
new file mode 100644
index 000000000..081839c48
--- /dev/null
+++ b/include/os/linux/zfs/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = sys
diff --git a/include/os/linux/zfs/sys/Makefile.am b/include/os/linux/zfs/sys/Makefile.am
new file mode 100644
index 000000000..5aa87da37
--- /dev/null
+++ b/include/os/linux/zfs/sys/Makefile.am
@@ -0,0 +1,12 @@
+KERNEL_H = \
+ $(top_srcdir)/include/os/linux/zfs/sys/policy.h \
+ $(top_srcdir)/include/os/linux/zfs/sys/zfs_ctldir.h \
+ $(top_srcdir)/include/os/linux/zfs/sys/zfs_dir.h \
+ $(top_srcdir)/include/os/linux/zfs/sys/zfs_vfsops.h \
+ $(top_srcdir)/include/os/linux/zfs/sys/zfs_vnops.h \
+ $(top_srcdir)/include/os/linux/zfs/sys/zpl.h
+
+if CONFIG_KERNEL
+kerneldir = @prefix@/src/zfs-$(VERSION)/include/sys
+kernel_HEADERS = $(KERNEL_H)
+endif
diff --git a/include/sys/policy.h b/include/os/linux/zfs/sys/policy.h
index 23d7d4db7..23d7d4db7 100644
--- a/include/sys/policy.h
+++ b/include/os/linux/zfs/sys/policy.h
diff --git a/include/sys/zfs_ctldir.h b/include/os/linux/zfs/sys/zfs_ctldir.h
index 51933bc4f..51933bc4f 100644
--- a/include/sys/zfs_ctldir.h
+++ b/include/os/linux/zfs/sys/zfs_ctldir.h
diff --git a/include/sys/zfs_dir.h b/include/os/linux/zfs/sys/zfs_dir.h
index bcd4ec2c1..bcd4ec2c1 100644
--- a/include/sys/zfs_dir.h
+++ b/include/os/linux/zfs/sys/zfs_dir.h
diff --git a/include/sys/zfs_vfsops.h b/include/os/linux/zfs/sys/zfs_vfsops.h
index 2886d9e25..2886d9e25 100644
--- a/include/sys/zfs_vfsops.h
+++ b/include/os/linux/zfs/sys/zfs_vfsops.h
diff --git a/include/sys/zfs_vnops.h b/include/os/linux/zfs/sys/zfs_vnops.h
index 767cba10d..767cba10d 100644
--- a/include/sys/zfs_vnops.h
+++ b/include/os/linux/zfs/sys/zfs_vnops.h
diff --git a/include/sys/zpl.h b/include/os/linux/zfs/sys/zpl.h
index 2766269f3..2766269f3 100644
--- a/include/sys/zpl.h
+++ b/include/os/linux/zfs/sys/zpl.h
diff --git a/include/spl/sys/Makefile.am b/include/spl/sys/Makefile.am
deleted file mode 100644
index 3b5b2755a..000000000
--- a/include/spl/sys/Makefile.am
+++ /dev/null
@@ -1,61 +0,0 @@
-KERNEL_H = \
- $(top_srcdir)/include/spl/sys/acl.h \
- $(top_srcdir)/include/spl/sys/atomic.h \
- $(top_srcdir)/include/spl/sys/byteorder.h \
- $(top_srcdir)/include/spl/sys/callb.h \
- $(top_srcdir)/include/spl/sys/callo.h \
- $(top_srcdir)/include/spl/sys/cmn_err.h \
- $(top_srcdir)/include/spl/sys/condvar.h \
- $(top_srcdir)/include/spl/sys/console.h \
- $(top_srcdir)/include/spl/sys/cred.h \
- $(top_srcdir)/include/spl/sys/ctype.h \
- $(top_srcdir)/include/spl/sys/debug.h \
- $(top_srcdir)/include/spl/sys/disp.h \
- $(top_srcdir)/include/spl/sys/dkio.h \
- $(top_srcdir)/include/spl/sys/errno.h \
- $(top_srcdir)/include/spl/sys/fcntl.h \
- $(top_srcdir)/include/spl/sys/file.h \
- $(top_srcdir)/include/spl/sys/inttypes.h \
- $(top_srcdir)/include/spl/sys/isa_defs.h \
- $(top_srcdir)/include/spl/sys/kmem_cache.h \
- $(top_srcdir)/include/spl/sys/kmem.h \
- $(top_srcdir)/include/spl/sys/kobj.h \
- $(top_srcdir)/include/spl/sys/kstat.h \
- $(top_srcdir)/include/spl/sys/list.h \
- $(top_srcdir)/include/spl/sys/mode.h \
- $(top_srcdir)/include/spl/sys/mutex.h \
- $(top_srcdir)/include/spl/sys/param.h \
- $(top_srcdir)/include/spl/sys/processor.h \
- $(top_srcdir)/include/spl/sys/proc.h \
- $(top_srcdir)/include/spl/sys/procfs_list.h \
- $(top_srcdir)/include/spl/sys/random.h \
- $(top_srcdir)/include/spl/sys/rwlock.h \
- $(top_srcdir)/include/spl/sys/shrinker.h \
- $(top_srcdir)/include/spl/sys/sid.h \
- $(top_srcdir)/include/spl/sys/signal.h \
- $(top_srcdir)/include/spl/sys/stat.h \
- $(top_srcdir)/include/spl/sys/strings.h \
- $(top_srcdir)/include/spl/sys/sunddi.h \
- $(top_srcdir)/include/spl/sys/sysmacros.h \
- $(top_srcdir)/include/spl/sys/systeminfo.h \
- $(top_srcdir)/include/spl/sys/taskq.h \
- $(top_srcdir)/include/spl/sys/thread.h \
- $(top_srcdir)/include/spl/sys/time.h \
- $(top_srcdir)/include/spl/sys/timer.h \
- $(top_srcdir)/include/spl/sys/tsd.h \
- $(top_srcdir)/include/spl/sys/types32.h \
- $(top_srcdir)/include/spl/sys/types.h \
- $(top_srcdir)/include/spl/sys/uio.h \
- $(top_srcdir)/include/spl/sys/user.h \
- $(top_srcdir)/include/spl/sys/vfs.h \
- $(top_srcdir)/include/spl/sys/vmem.h \
- $(top_srcdir)/include/spl/sys/vmsystm.h \
- $(top_srcdir)/include/spl/sys/vnode.h \
- $(top_srcdir)/include/spl/sys/wait.h \
- $(top_srcdir)/include/spl/sys/zmod.h \
- $(top_srcdir)/include/spl/sys/zone.h
-
-if CONFIG_KERNEL
-kerneldir = @prefix@/src/zfs-$(VERSION)/include/spl/sys
-kernel_HEADERS = $(KERNEL_H)
-endif
diff --git a/include/sys/Makefile.am b/include/sys/Makefile.am
index c5d64f9fd..b3845cb95 100644
--- a/include/sys/Makefile.am
+++ b/include/sys/Makefile.am
@@ -52,7 +52,6 @@ COMMON_H = \
$(top_srcdir)/include/sys/nvpair_impl.h \
$(top_srcdir)/include/sys/objlist.h \
$(top_srcdir)/include/sys/pathname.h \
- $(top_srcdir)/include/sys/policy.h \
$(top_srcdir)/include/sys/range_tree.h \
$(top_srcdir)/include/sys/refcount.h \
$(top_srcdir)/include/sys/rrwlock.h \
@@ -116,10 +115,8 @@ COMMON_H = \
$(top_srcdir)/include/sys/zfeature.h \
$(top_srcdir)/include/sys/zfs_acl.h \
$(top_srcdir)/include/sys/zfs_context.h \
- $(top_srcdir)/include/sys/zfs_ctldir.h \
$(top_srcdir)/include/sys/zfs_debug.h \
$(top_srcdir)/include/sys/zfs_delay.h \
- $(top_srcdir)/include/sys/zfs_dir.h \
$(top_srcdir)/include/sys/zfs_fuid.h \
$(top_srcdir)/include/sys/zfs_project.h \
$(top_srcdir)/include/sys/zfs_ratelimit.h \
@@ -127,8 +124,6 @@ COMMON_H = \
$(top_srcdir)/include/sys/zfs_sa.h \
$(top_srcdir)/include/sys/zfs_stat.h \
$(top_srcdir)/include/sys/zfs_sysfs.h \
- $(top_srcdir)/include/sys/zfs_vfsops.h \
- $(top_srcdir)/include/sys/zfs_vnops.h \
$(top_srcdir)/include/sys/zfs_znode.h \
$(top_srcdir)/include/sys/zil.h \
$(top_srcdir)/include/sys/zil_impl.h \
@@ -144,7 +139,6 @@ COMMON_H = \
KERNEL_H = \
$(top_srcdir)/include/sys/zfs_ioctl.h \
$(top_srcdir)/include/sys/zfs_onexit.h \
- ${top_srcdir}/include/sys/zpl.h \
$(top_srcdir)/include/sys/zvol.h
USER_H =