aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@linux-mips.org>2015-04-03 18:27:26 -0400
committerRalf Baechle <ralf@linux-mips.org>2015-04-07 19:10:25 -0400
commitf684362689ddc4a4e055be438d6416cc280a1372 (patch)
treeb361a8218e4e52f4ffeb243fc8e34d4b2b8555e1 /arch/mips/kernel
parent9cb60e202631d71b7b8d38fa84ae7663805244b6 (diff)
MIPS: math-emu: Set FIR feature flags for full emulation
Implement FIR feature flags in the FPU emulator according to features supported and architecture level requirements. The W, L and F64 bits have only been added at level #2 even though the features they refer to were also included with the MIPS64r1 ISA and the W fixed-point format also with the MIPS32r1 ISA. This is only relevant for the full emulation mode and the emulated CFC1 instruction as well as ptrace(2) accesses. Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/9707/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel')
-rw-r--r--arch/mips/kernel/cpu-probe.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index f8481ce7bbb1..ca9b9c62c6ea 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -20,6 +20,7 @@
20 20
21#include <asm/bugs.h> 21#include <asm/bugs.h>
22#include <asm/cpu.h> 22#include <asm/cpu.h>
23#include <asm/cpu-features.h>
23#include <asm/cpu-type.h> 24#include <asm/cpu-type.h>
24#include <asm/fpu.h> 25#include <asm/fpu.h>
25#include <asm/mipsregs.h> 26#include <asm/mipsregs.h>
@@ -31,11 +32,30 @@
31#include <asm/spram.h> 32#include <asm/spram.h>
32#include <asm/uaccess.h> 33#include <asm/uaccess.h>
33 34
35/*
36 * Set the FIR feature flags for the FPU emulator.
37 */
38static void cpu_set_nofpu_id(struct cpuinfo_mips *c)
39{
40 u32 value;
41
42 value = 0;
43 if (c->isa_level & (MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M64R1 |
44 MIPS_CPU_ISA_M32R2 | MIPS_CPU_ISA_M64R2 |
45 MIPS_CPU_ISA_M32R6 | MIPS_CPU_ISA_M64R6))
46 value |= MIPS_FPIR_D | MIPS_FPIR_S;
47 if (c->isa_level & (MIPS_CPU_ISA_M32R2 | MIPS_CPU_ISA_M64R2 |
48 MIPS_CPU_ISA_M32R6 | MIPS_CPU_ISA_M64R6))
49 value |= MIPS_FPIR_F64 | MIPS_FPIR_L | MIPS_FPIR_W;
50 c->fpu_id = value;
51}
52
34static int mips_fpu_disabled; 53static int mips_fpu_disabled;
35 54
36static int __init fpu_disable(char *s) 55static int __init fpu_disable(char *s)
37{ 56{
38 cpu_data[0].options &= ~MIPS_CPU_FPU; 57 boot_cpu_data.options &= ~MIPS_CPU_FPU;
58 cpu_set_nofpu_id(&boot_cpu_data);
39 mips_fpu_disabled = 1; 59 mips_fpu_disabled = 1;
40 60
41 return 1; 61 return 1;
@@ -1382,7 +1402,8 @@ void cpu_probe(void)
1382 if (c->fpu_id & MIPS_FPIR_FREP) 1402 if (c->fpu_id & MIPS_FPIR_FREP)
1383 c->options |= MIPS_CPU_FRE; 1403 c->options |= MIPS_CPU_FRE;
1384 } 1404 }
1385 } 1405 } else
1406 cpu_set_nofpu_id(c);
1386 1407
1387 if (cpu_has_mips_r2_r6) { 1408 if (cpu_has_mips_r2_r6) {
1388 c->srsets = ((read_c0_srsctl() >> 26) & 0x0f) + 1; 1409 c->srsets = ((read_c0_srsctl() >> 26) & 0x0f) + 1;