Skip to content

Commit f848398

Browse files
James Hoganralfbaechle
authored andcommitted
MIPS: lose_fpu(): Disable FPU when MSA enabled
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: 33c771b ("MIPS: save/disable MSA in lose_fpu") Signed-off-by: James Hogan <[email protected]> Cc: Ralf Baechle <[email protected]> Cc: Paul Burton <[email protected]> Cc: [email protected] Patchwork: https://patchwork.linux-mips.org/patch/9323/ Signed-off-by: Ralf Baechle <[email protected]>
1 parent a7b7aad commit f848398

File tree

1 file changed

+1
-0
lines changed
  • arch/mips/include/asm

1 file changed

+1
-0
lines changed

arch/mips/include/asm/fpu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ static inline void lose_fpu(int save)
170170
}
171171
disable_msa();
172172
clear_thread_flag(TIF_USEDMSA);
173+
__disable_fpu();
173174
} else if (is_fpu_owner()) {
174175
if (save)
175176
_save_fp(current);

0 commit comments

Comments
 (0)