Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ARM/simd: Add scoped guard API for kernel mode SIMD

Implement the ksimd scoped guard API so that it can be used by code that
supports both ARM and arm64.

Reviewed-by: Kees Cook <kees@kernel.org>
Reviewed-by: Eric Biggers <ebiggers@kernel.org>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>

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