summaryrefslogtreecommitdiff
path: root/arch/arm/include/asm/simd.h
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@kernel.org>2025-11-12 20:55:55 +0300
committerEric Biggers <ebiggers@kernel.org>2025-11-12 20:55:55 +0300
commit065f04001081fa48f24dd95f7095d06402756253 (patch)
tree8d6eca52ad3838ac751d1bcc677b29c934ca5752 /arch/arm/include/asm/simd.h
parent2dbb6f4a25d38fcf7d6c1c682e45a13e6bbe9562 (diff)
parentf53d18a4e67eacf665e9d60727d508387f84327b (diff)
downloadlinux-065f04001081fa48f24dd95f7095d06402756253.tar.xz
Merge tag 'scoped-ksimd-for-arm-arm64' into libcrypto-fpsimd-on-stack
Pull scoped ksimd API for ARM and arm64 from Ard Biesheuvel: "Introduce a more strict replacement API for kernel_neon_begin()/kernel_neon_end() on both ARM and arm64, and replace occurrences of the latter pair appearing in lib/crypto" Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Diffstat (limited to 'arch/arm/include/asm/simd.h')
-rw-r--r--arch/arm/include/asm/simd.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/arm/include/asm/simd.h b/arch/arm/include/asm/simd.h
index be08a8da046f..8549fa8b7253 100644
--- a/arch/arm/include/asm/simd.h
+++ b/arch/arm/include/asm/simd.h
@@ -2,14 +2,21 @@
#ifndef _ASM_SIMD_H
#define _ASM_SIMD_H
+#include <linux/cleanup.h>
#include <linux/compiler_attributes.h>
#include <linux/preempt.h>
#include <linux/types.h>
+#include <asm/neon.h>
+
static __must_check inline bool may_use_simd(void)
{
return IS_ENABLED(CONFIG_KERNEL_MODE_NEON) && !in_hardirq()
&& !irqs_disabled();
}
+DEFINE_LOCK_GUARD_0(ksimd, kernel_neon_begin(), kernel_neon_end())
+
+#define scoped_ksimd() scoped_guard(ksimd)
+
#endif /* _ASM_SIMD_H */