MIPS: kernel: cpu-probe: Detect unique RI/XI exceptions
authorLeonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Tue, 15 Jul 2014 13:09:57 +0000 (14:09 +0100)
committerRalf Baechle <ralf@linux-mips.org>
Fri, 1 Aug 2014 22:06:40 +0000 (00:06 +0200)
Detect if the core supports unique exception codes for the
Read-Inhibit and Execute-Inhibit exceptions and set the
option accordingly. The RI/XI exception support is detected
by setting the 27th bit (IEC) of the PageGrain C0 register
and reading back the value of that register to verify the
bit is enabled.

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/7340/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/include/asm/mipsregs.h
arch/mips/kernel/cpu-probe.c

index 417125548bde992fe7f5b7314a654177ca7b8666..9775c1aba4d305ba70e81186e2843d0e64879e7e 100644 (file)
 #define PG_XIE         (_ULCAST_(1) <<  30)
 #define PG_ELPA                (_ULCAST_(1) <<  29)
 #define PG_ESP         (_ULCAST_(1) <<  28)
+#define PG_IEC         (_ULCAST_(1) <<  27)
 
 /*
  * R4x00 interrupt enable / cause bits
index 0d30433db54bab2376a61e517f5ad3d8bb173381..cd252fd684b7ea9d8bba1406497c121bdd3813a8 100644 (file)
@@ -438,6 +438,15 @@ static void decode_configs(struct cpuinfo_mips *c)
 
        mips_probe_watch_registers(c);
 
+       if (cpu_has_rixi) {
+               /* Enable the RIXI exceptions */
+               write_c0_pagegrain(read_c0_pagegrain() | PG_IEC);
+               back_to_back_c0_hazard();
+               /* Verify the IEC bit is set */
+               if (read_c0_pagegrain() & PG_IEC)
+                       c->options |= MIPS_CPU_RIXIEX;
+       }
+
 #ifndef CONFIG_MIPS_CPS
        if (cpu_has_mips_r2) {
                c->core = get_ebase_cpunum();