aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@linux-mips.org>2015-06-02 12:50:59 -0400
committerRalf Baechle <ralf@linux-mips.org>2015-06-03 03:50:29 -0400
commit90b712ddabb40c49ca4f68bab07e27aa34c8d2a3 (patch)
tree41550c30a72b279e9c51cebe5a92c16f08302bbe /arch/mips
parenta26484bb7e77d474ecef1ef01ce37fb16fb84f60 (diff)
MIPS: Avoid an FPE exception in FCSR mask probing
Use the default FCSR value in mask probing, avoiding an FPE exception where reset has left any exception enable and their corresponding cause bits set and the register is then rewritten with these bits active. Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org> Cc: Joshua Kinard <kumba@gentoo.org> Cc: linux-mips@linux-mips.org Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/kernel/cpu-probe.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index e36515dcd3b2..209e5b76c1bc 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -74,13 +74,12 @@ static inline void cpu_set_fpu_fcsr_mask(struct cpuinfo_mips *c)
74{ 74{
75 unsigned long sr, mask, fcsr, fcsr0, fcsr1; 75 unsigned long sr, mask, fcsr, fcsr0, fcsr1;
76 76
77 fcsr = c->fpu_csr31;
77 mask = FPU_CSR_ALL_X | FPU_CSR_ALL_E | FPU_CSR_ALL_S | FPU_CSR_RM; 78 mask = FPU_CSR_ALL_X | FPU_CSR_ALL_E | FPU_CSR_ALL_S | FPU_CSR_RM;
78 79
79 sr = read_c0_status(); 80 sr = read_c0_status();
80 __enable_fpu(FPU_AS_IS); 81 __enable_fpu(FPU_AS_IS);
81 82
82 fcsr = read_32bit_cp1_register(CP1_STATUS);
83
84 fcsr0 = fcsr & mask; 83 fcsr0 = fcsr & mask;
85 write_32bit_cp1_register(CP1_STATUS, fcsr0); 84 write_32bit_cp1_register(CP1_STATUS, fcsr0);
86 fcsr0 = read_32bit_cp1_register(CP1_STATUS); 85 fcsr0 = read_32bit_cp1_register(CP1_STATUS);