aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64/kernel/fpsimd.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm64/kernel/fpsimd.c')
-rw-r--r--arch/arm64/kernel/fpsimd.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c
index e8b8357aedb4..1f2e4d5a5c0f 100644
--- a/arch/arm64/kernel/fpsimd.c
+++ b/arch/arm64/kernel/fpsimd.c
@@ -21,6 +21,7 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/sched.h> 22#include <linux/sched.h>
23#include <linux/signal.h> 23#include <linux/signal.h>
24#include <linux/hardirq.h>
24 25
25#include <asm/fpsimd.h> 26#include <asm/fpsimd.h>
26#include <asm/cputype.h> 27#include <asm/cputype.h>
@@ -83,6 +84,33 @@ void fpsimd_flush_thread(void)
83 fpsimd_load_state(&current->thread.fpsimd_state); 84 fpsimd_load_state(&current->thread.fpsimd_state);
84} 85}
85 86
87#ifdef CONFIG_KERNEL_MODE_NEON
88
89/*
90 * Kernel-side NEON support functions
91 */
92void kernel_neon_begin(void)
93{
94 /* Avoid using the NEON in interrupt context */
95 BUG_ON(in_interrupt());
96 preempt_disable();
97
98 if (current->mm)
99 fpsimd_save_state(&current->thread.fpsimd_state);
100}
101EXPORT_SYMBOL(kernel_neon_begin);
102
103void kernel_neon_end(void)
104{
105 if (current->mm)
106 fpsimd_load_state(&current->thread.fpsimd_state);
107
108 preempt_enable();
109}
110EXPORT_SYMBOL(kernel_neon_end);
111
112#endif /* CONFIG_KERNEL_MODE_NEON */
113
86/* 114/*
87 * FP/SIMD support code initialisation. 115 * FP/SIMD support code initialisation.
88 */ 116 */