summaryrefslogtreecommitdiffstats
path: root/module/icp/algs
diff options
context:
space:
mode:
authorGvozden Neskovic <[email protected]>2017-03-07 21:59:31 +0100
committerBrian Behlendorf <[email protected]>2017-03-07 12:59:31 -0800
commit650383f2838d5864f127e9d8595b97ad024c9648 (patch)
tree95c42019afea06be3e8c0158edc0d0b4860419ca /module/icp/algs
parent5fc73c46f9f94d2697b77a830dd9fb8a85368d23 (diff)
[icp] fpu and asm cleanup for linux
Properly annotate functions and data section so that objtool does not complain when CONFIG_STACK_VALIDATION and CONFIG_FRAME_POINTER are enabled. Pass KERNELCPPFLAGS to assembler. Use kfpu_begin()/kfpu_end() to protect SIMD regions in Linux kernel. Reviewed-by: Tom Caputi <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Gvozden Neskovic <[email protected]> Closes #5872 Closes #5041
Diffstat (limited to 'module/icp/algs')
-rw-r--r--module/icp/algs/aes/aes_impl.c21
-rw-r--r--module/icp/algs/modes/gcm.c21
2 files changed, 21 insertions, 21 deletions
diff --git a/module/icp/algs/aes/aes_impl.c b/module/icp/algs/aes/aes_impl.c
index 8592386dd..4c17e2a30 100644
--- a/module/icp/algs/aes/aes_impl.c
+++ b/module/icp/algs/aes/aes_impl.c
@@ -22,23 +22,22 @@
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
*/
-#include <sys/zfs_context.h>
-#include <sys/crypto/spi.h>
-#include <modes/modes.h>
-#include <aes/aes_impl.h>
-
-#ifdef __amd64
+#if defined(_KERNEL) && defined(__amd64)
+#include <linux/simd_x86.h>
-#ifdef _KERNEL
-/* Workaround for no XMM kernel thread save/restore */
-#define KPREEMPT_DISABLE kpreempt_disable()
-#define KPREEMPT_ENABLE kpreempt_enable()
+#define KPREEMPT_DISABLE kfpu_begin()
+#define KPREEMPT_ENABLE kfpu_end()
#else
#define KPREEMPT_DISABLE
#define KPREEMPT_ENABLE
#endif /* _KERNEL */
-#endif /* __amd64 */
+
+#include <sys/zfs_context.h>
+#include <sys/crypto/spi.h>
+#include <modes/modes.h>
+#include <aes/aes_impl.h>
+
/*
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 */