diff options
author | Dave Martin <Dave.Martin@arm.com> | 2017-10-31 15:51:11 +0000 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2017-11-03 15:24:18 +0000 |
commit | 1bd3f93641ec710015fcb3badca07dacd58c91d3 (patch) | |
tree | a31ad7c9c719074a2e230a8cfdd694858aa7acf2 /arch/arm64/kernel/fpsimd.c | |
parent | 2e0f2478ea37eba945bee007884a2988b8f7d332 (diff) | |
download | linux-stable-1bd3f93641ec710015fcb3badca07dacd58c91d3.tar.gz linux-stable-1bd3f93641ec710015fcb3badca07dacd58c91d3.tar.bz2 linux-stable-1bd3f93641ec710015fcb3badca07dacd58c91d3.zip |
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: Dave Martin <Dave.Martin@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch/arm64/kernel/fpsimd.c')
-rw-r--r-- | arch/arm64/kernel/fpsimd.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index 715398e91d65..741fbbfa1265 100644 --- a/arch/arm64/kernel/fpsimd.c +++ b/arch/arm64/kernel/fpsimd.c @@ -886,8 +886,10 @@ void kernel_neon_begin(void) __this_cpu_write(kernel_neon_busy, true); /* Save unsaved task fpsimd state, if any: */ - if (current->mm && !test_and_set_thread_flag(TIF_FOREIGN_FPSTATE)) - fpsimd_save_state(¤t->thread.fpsimd_state); + if (current->mm) { + task_fpsimd_save(); + set_thread_flag(TIF_FOREIGN_FPSTATE); + } /* Invalidate any task state remaining in the fpsimd regs: */ __this_cpu_write(fpsimd_last_state, NULL); |