Skip to contentSkip to conversation

Patch "MIPS: lose_fpu(): Disable FPU when MSA enabled" has been added to the 4.0-stable tree

PATCH [email protected] 1 participant 1 message May 2, 2015

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

MIPS: lose_fpu(): Disable FPU when MSA enabled

to the 4.0-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
mips-lose_fpu-disable-fpu-when-msa-enabled.patch
and it can be found in the queue-4.0 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From acaf6a97d623af123314c2f8ce4cf7254f6b2fc1 Mon Sep 17 00:00:00 2001

From: James Hogan <[email protected]>
Date: Wed, 25 Feb 2015 13:08:05 +0000
Subject: MIPS: lose_fpu(): Disable FPU when MSA enabled

From: James Hogan <[email protected]>

commit acaf6a97d623af123314c2f8ce4cf7254f6b2fc1 upstream.

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")
Cc Ralf Baechle <[email protected]>
Cc Paul Burton <[email protected]>

Patchwork: https://patchwork.linux-mips.org/patch/9323/

---
 arch/mips/include/asm/fpu.h |    1 +
 1 file changed, 1 insertion(+)
arch/mips/include/asm/fpu.h +1 -0
@@ -170,6 +170,7 @@ static inline void lose_fpu(int save)
 		}
 		disable_msa();
 		clear_thread_flag(TIF_USEDMSA);
+		__disable_fpu();
 	} else if (is_fpu_owner()) {
 		if (save)
 			_save_fp(current);

Patches currently in stable-queue which might be from [email protected] are

queue-4.0/mips-lose_fpu-disable-fpu-when-msa-enabled.patch queue-4.0/mips-kvm-handle-msa-disabled-exceptions-from-guest.patch