aboutsummaryrefslogtreecommitdiffstats
path: root/module/icp/algs/modes/gcm.c
diff options
context:
space:
mode:
Diffstat (limited to 'module/icp/algs/modes/gcm.c')
-rw-r--r--module/icp/algs/modes/gcm.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/module/icp/algs/modes/gcm.c b/module/icp/algs/modes/gcm.c
index 80acb6636..c0a26f524 100644
--- a/module/icp/algs/modes/gcm.c
+++ b/module/icp/algs/modes/gcm.c
@@ -22,6 +22,17 @@
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
*/
+#if defined(_KERNEL) && defined(__amd64)
+#include <linux/simd_x86.h>
+
+#define KPREEMPT_DISABLE kfpu_begin()
+#define KPREEMPT_ENABLE kfpu_end()
+
+#else
+#define KPREEMPT_DISABLE
+#define KPREEMPT_ENABLE
+#endif /* _KERNEL */
+
#include <sys/zfs_context.h>
#include <modes/modes.h>
#include <sys/crypto/common.h>
@@ -30,16 +41,6 @@
#ifdef __amd64
-#ifdef _KERNEL
-/* Workaround for no XMM kernel thread save/restore */
-#define KPREEMPT_DISABLE kpreempt_disable()
-#define KPREEMPT_ENABLE kpreempt_enable()
-
-#else
-#define KPREEMPT_DISABLE
-#define KPREEMPT_ENABLE
-#endif /* _KERNEL */
-
extern void gcm_mul_pclmulqdq(uint64_t *x_in, uint64_t *y, uint64_t *res);
static int intel_pclmulqdq_instruction_present(void);
#endif /* __amd64 */