xref: /openbmc/linux/include/asm-generic/simd.h (revision 498495dba268b20e8eadd7fe93c140c68b6cc9d2)
1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2a62b01cdSArd Biesheuvel 
3a62b01cdSArd Biesheuvel #include <linux/hardirq.h>
4a62b01cdSArd Biesheuvel 
5a62b01cdSArd Biesheuvel /*
6a62b01cdSArd Biesheuvel  * may_use_simd - whether it is allowable at this time to issue SIMD
7a62b01cdSArd Biesheuvel  *                instructions or access the SIMD register file
8a62b01cdSArd Biesheuvel  *
9a62b01cdSArd Biesheuvel  * As architectures typically don't preserve the SIMD register file when
10a62b01cdSArd Biesheuvel  * taking an interrupt, !in_interrupt() should be a reasonable default.
11a62b01cdSArd Biesheuvel  */
may_use_simd(void)12a62b01cdSArd Biesheuvel static __must_check inline bool may_use_simd(void)
13a62b01cdSArd Biesheuvel {
14a62b01cdSArd Biesheuvel 	return !in_interrupt();
15a62b01cdSArd Biesheuvel }
16