[Top] [All Lists]

[PATCH] MIPS: lose_fpu(): Disable FPU when MSA enabled

To: Ralf Baechle <>, <>
Subject: [PATCH] MIPS: lose_fpu(): Disable FPU when MSA enabled
From: James Hogan <>
Date: Wed, 25 Feb 2015 13:08:05 +0000
Cc: James Hogan <>, Paul Burton <>
List-archive: <>
List-help: <>
List-id: linux-mips <>
List-owner: <>
List-post: <>
List-software: Ecartis version 1.0.0
List-subscribe: <>
List-unsubscribe: <>
Original-recipient: rfc822;
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 <>
Cc: Ralf Baechle <>
Cc: Paul Burton <>
 arch/mips/include/asm/fpu.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/mips/include/asm/fpu.h b/arch/mips/include/asm/fpu.h
index dd083e999b08..9f26b079cc6a 100644
--- a/arch/mips/include/asm/fpu.h
+++ b/arch/mips/include/asm/fpu.h
@@ -170,6 +170,7 @@ static inline void lose_fpu(int save)
+               __disable_fpu();
        } else if (is_fpu_owner()) {
                if (save)

<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH] MIPS: lose_fpu(): Disable FPU when MSA enabled, James Hogan <=