18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ci#include <linux/hardirq.h>
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci/*
68c2ecf20Sopenharmony_ci * may_use_simd - whether it is allowable at this time to issue SIMD
78c2ecf20Sopenharmony_ci *                instructions or access the SIMD register file
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * As architectures typically don't preserve the SIMD register file when
108c2ecf20Sopenharmony_ci * taking an interrupt, !in_interrupt() should be a reasonable default.
118c2ecf20Sopenharmony_ci */
128c2ecf20Sopenharmony_cistatic __must_check inline bool may_use_simd(void)
138c2ecf20Sopenharmony_ci{
148c2ecf20Sopenharmony_ci	return !in_interrupt();
158c2ecf20Sopenharmony_ci}
16