Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: kernel: cpu-probe: Detect unique RI/XI exceptions

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>

authored by

Leonid Yegoshin and committed by
Ralf Baechle
6575b1d4 5890f70f

+10
+1
arch/mips/include/asm/mipsregs.h
··· 265 265 #define PG_XIE (_ULCAST_(1) << 30) 266 266 #define PG_ELPA (_ULCAST_(1) << 29) 267 267 #define PG_ESP (_ULCAST_(1) << 28) 268 + #define PG_IEC (_ULCAST_(1) << 27) 268 269 269 270 /* 270 271 * R4x00 interrupt enable / cause bits
+9
arch/mips/kernel/cpu-probe.c
··· 438 438 439 439 mips_probe_watch_registers(c); 440 440 441 + if (cpu_has_rixi) { 442 + /* Enable the RIXI exceptions */ 443 + write_c0_pagegrain(read_c0_pagegrain() | PG_IEC); 444 + back_to_back_c0_hazard(); 445 + /* Verify the IEC bit is set */ 446 + if (read_c0_pagegrain() & PG_IEC) 447 + c->options |= MIPS_CPU_RIXIEX; 448 + } 449 + 441 450 #ifndef CONFIG_MIPS_CPS 442 451 if (cpu_has_mips_r2) { 443 452 c->core = get_ebase_cpunum();