提交 1bd3f936 编写于 作者: D Dave Martin 提交者: Will Deacon

arm64/sve: Preserve SVE registers around kernel-mode NEON use

Kernel-mode NEON will corrupt the SVE vector registers, due to the
way they alias the FPSIMD vector registers in the hardware.

This patch ensures that any live SVE register content for the task
is saved by kernel_neon_begin().  The data will be restored in the
usual way on return to userspace.
Signed-off-by: NDave Martin <Dave.Martin@arm.com>
Reviewed-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: NAlex Bennée <alex.bennee@linaro.org>
Reviewed-by: NCatalin Marinas <catalin.marinas@arm.com>
Signed-off-by: NWill Deacon <will.deacon@arm.com>
上级 2e0f2478
...@@ -886,8 +886,10 @@ void kernel_neon_begin(void) ...@@ -886,8 +886,10 @@ void kernel_neon_begin(void)
__this_cpu_write(kernel_neon_busy, true); __this_cpu_write(kernel_neon_busy, true);
/* Save unsaved task fpsimd state, if any: */ /* Save unsaved task fpsimd state, if any: */
if (current->mm && !test_and_set_thread_flag(TIF_FOREIGN_FPSTATE)) if (current->mm) {
fpsimd_save_state(&current->thread.fpsimd_state); task_fpsimd_save();
set_thread_flag(TIF_FOREIGN_FPSTATE);
}
/* Invalidate any task state remaining in the fpsimd regs: */ /* Invalidate any task state remaining in the fpsimd regs: */
__this_cpu_write(fpsimd_last_state, NULL); __this_cpu_write(fpsimd_last_state, NULL);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册