summaryrefslogtreecommitdiffstats
path: root/arch/mips/include
diff options
context:
space:
mode:
authorPaul Burton <paul.burton@imgtec.com>2014-07-11 16:44:30 +0100
committerBen Hutchings <ben@decadent.org.uk>2017-04-04 22:21:53 +0100
commit13acbb17b0de3d32d232d512162c9f7a76136234 (patch)
treec718cd5569d043e8fc473748e1519e6fdf4a38f3 /arch/mips/include
parent5ff2ed33048d3d45cce81b05f96f80afdae1abc3 (diff)
downloadlinux-stable-13acbb17b0de3d32d232d512162c9f7a76136234.tar.gz
linux-stable-13acbb17b0de3d32d232d512162c9f7a76136234.tar.bz2
linux-stable-13acbb17b0de3d32d232d512162c9f7a76136234.zip
MIPS: save/disable MSA in lose_fpu
commit 33c771ba5c5d067f85a5a6c4b11047219b5b8f4e upstream. The kernel depends upon MSA never being enabled when the FPU is not, a condition which is currently violated in a few places (whilst saving sigcontext, following mips_cpu_save). Catch all the problem cases by disabling MSA in lose_fpu, after saving context if necessary. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/7302/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Ben Hutchings <ben@decadent.org.uk> Cc: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/mips/include')
-rw-r--r--arch/mips/include/asm/fpu.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/arch/mips/include/asm/fpu.h b/arch/mips/include/asm/fpu.h
index a939574f8293..71d97ebd9090 100644
--- a/arch/mips/include/asm/fpu.h
+++ b/arch/mips/include/asm/fpu.h
@@ -21,6 +21,7 @@
#include <asm/hazards.h>
#include <asm/processor.h>
#include <asm/current.h>
+#include <asm/msa.h>
#ifdef CONFIG_MIPS_MT_FPAFF
#include <asm/mips_mt.h>
@@ -141,13 +142,21 @@ static inline int own_fpu(int restore)
static inline void lose_fpu(int save)
{
preempt_disable();
- if (is_fpu_owner()) {
+ if (is_msa_enabled()) {
+ if (save) {
+ save_msa(current);
+ asm volatile("cfc1 %0, $31"
+ : "=r"(current->thread.fpu.fcr31));
+ }
+ disable_msa();
+ clear_thread_flag(TIF_USEDMSA);
+ } else if (is_fpu_owner()) {
if (save)
_save_fp(current);
- KSTK_STATUS(current) &= ~ST0_CU1;
- clear_thread_flag(TIF_USEDFPU);
__disable_fpu();
}
+ KSTK_STATUS(current) &= ~ST0_CU1;
+ clear_thread_flag(TIF_USEDFPU);
preempt_enable();
}