xref: /linux/arch/arm/include/asm/simd.h (revision 7fc2cd2e4b398c57c9cf961cfea05eadbf34c05c)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_SIMD_H
3 #define _ASM_SIMD_H
4 
5 #include <linux/cleanup.h>
6 #include <linux/compiler_attributes.h>
7 #include <linux/preempt.h>
8 #include <linux/types.h>
9 
10 #include <asm/neon.h>
11 
12 static __must_check inline bool may_use_simd(void)
13 {
14 	return IS_ENABLED(CONFIG_KERNEL_MODE_NEON) && !in_hardirq()
15 	       && !irqs_disabled();
16 }
17 
18 DEFINE_LOCK_GUARD_0(ksimd, kernel_neon_begin(), kernel_neon_end())
19 
20 #define scoped_ksimd()	scoped_guard(ksimd)
21 
22 #endif	/* _ASM_SIMD_H */
23