MIPS: lose_fpu(): Disable FPU when MSA enabled
authorJames Hogan <james.hogan@imgtec.com>
Wed, 25 Feb 2015 13:08:05 +0000 (13:08 +0000)
committerSasha Levin <sasha.levin@oracle.com>
Sun, 17 May 2015 23:11:51 +0000 (19:11 -0400)
commit00f1187a9cb84924936a4b6310e36be2ad0e8a15
tree86305a043139ab2c5ecf4dc82e08cd0cdeb68936
parent707ff2258e57b45383f402e010dc3c5115e0a835
MIPS: lose_fpu(): Disable FPU when MSA enabled

[ Upstream commit f8483988cadd7dd22de928db29ed3bcbe02faf78 ]

The lose_fpu() function only disables the FPU in CP0_Status.CU1 if the
FPU is in use and MSA isn't enabled.

This isn't necessarily a problem because KSTK_STATUS(current), the
version of CP0_Status stored on the kernel stack on entry from user
mode, does always get updated and gets restored when returning to user
mode, but I don't think it was intended, and it is inconsistent with the
case of only the FPU being in use. Sometimes leaving the FPU enabled may
also mask kernel bugs where FPU operations are executed when the FPU
might not be enabled.

So lets disable the FPU in the MSA case too.

Fixes: 33c771ba5c5d ("MIPS: save/disable MSA in lose_fpu")
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/9323/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
arch/mips/include/asm/fpu.h