qmi_wwan: apply SET_DTR quirk to the SIMCOM shared device ID
[linux-stable.git] / arch / arm64 / include / asm / simd.h
blob6495cc51246fc873bef97f99a2b0139f806516c1
1 /*
2 * Copyright (C) 2017 Linaro Ltd. <ard.biesheuvel@linaro.org>
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 as published
6 * by the Free Software Foundation.
7 */
9 #ifndef __ASM_SIMD_H
10 #define __ASM_SIMD_H
12 #include <linux/compiler.h>
13 #include <linux/irqflags.h>
14 #include <linux/percpu.h>
15 #include <linux/preempt.h>
16 #include <linux/types.h>
18 #ifdef CONFIG_KERNEL_MODE_NEON
20 DECLARE_PER_CPU(bool, kernel_neon_busy);
23 * may_use_simd - whether it is allowable at this time to issue SIMD
24 * instructions or access the SIMD register file
26 * Callers must not assume that the result remains true beyond the next
27 * preempt_enable() or return from softirq context.
29 static __must_check inline bool may_use_simd(void)
32 * kernel_neon_busy is only set while preemption is disabled,
33 * and is clear whenever preemption is enabled. Since
34 * this_cpu_read() is atomic w.r.t. preemption, kernel_neon_busy
35 * cannot change under our feet -- if it's set we cannot be
36 * migrated, and if it's clear we cannot be migrated to a CPU
37 * where it is set.
39 return !in_irq() && !irqs_disabled() && !in_nmi() &&
40 !this_cpu_read(kernel_neon_busy);
43 #else /* ! CONFIG_KERNEL_MODE_NEON */
45 static __must_check inline bool may_use_simd(void) {
46 return false;
49 #endif /* ! CONFIG_KERNEL_MODE_NEON */
51 #endif