When user thread calls system call to kernel and kernel has overwritten the FPSIMD registers,
these registers should be restored for user when kernel completes its job.
Change-Id: Ieca1f7baa8a1b245d172bfc750517c70b999ccfa
Signed-off-by: Sanghoon Lee <shoon114.lee@samsung.com>
BUG_ON(atomic_dec_return(
¤t->thread.fpsimd_kernel_state.depth) < 0);
+
+ preempt_disable();
+ if (current->mm && test_thread_flag(TIF_FOREIGN_FPSTATE)
+ && atomic_read(¤t->thread.fpsimd_kernel_state.depth) == 0) {
+ fpsimd_load_state(¤t->thread.fpsimd_state);
+ this_cpu_write(fpsimd_last_state, ¤t->thread.fpsimd_state);
+ current->thread.fpsimd_state.cpu = smp_processor_id();
+ clear_thread_flag(TIF_FOREIGN_FPSTATE);
+ }
+ preempt_enable();
}
#ifdef CONFIG_KERNEL_MODE_NEON