Commit 1b505def authored by James Hogan's avatar James Hogan Committed by Ralf Baechle

MIPS: Use EXCCODE_ constants with set_except_vector()

The first argument to set_except_vector is the ExcCode, which we now
have definitions for. Lets make use of them.
Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Gleb Natapov <gleb@kernel.org>
Cc: linux-mips@linux-mips.org
Cc: kvm@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/11894/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 044c9bb8
...@@ -190,7 +190,7 @@ static inline void check_daddi(void) ...@@ -190,7 +190,7 @@ static inline void check_daddi(void)
printk("Checking for the daddi bug... "); printk("Checking for the daddi bug... ");
local_irq_save(flags); local_irq_save(flags);
handler = set_except_vector(12, handle_daddi_ov); handler = set_except_vector(EXCCODE_OV, handle_daddi_ov);
/* /*
* The following code fails to trigger an overflow exception * The following code fails to trigger an overflow exception
* when executed on R4000 rev. 2.2 or 3.0 (PRId 00000422 or * when executed on R4000 rev. 2.2 or 3.0 (PRId 00000422 or
...@@ -214,7 +214,7 @@ static inline void check_daddi(void) ...@@ -214,7 +214,7 @@ static inline void check_daddi(void)
".set pop" ".set pop"
: "=r" (v), "=&r" (tmp) : "=r" (v), "=&r" (tmp)
: "I" (0xffffffffffffdb9aUL), "I" (0x1234)); : "I" (0xffffffffffffdb9aUL), "I" (0x1234));
set_except_vector(12, handler); set_except_vector(EXCCODE_OV, handler);
local_irq_restore(flags); local_irq_restore(flags);
if (daddi_ov) { if (daddi_ov) {
...@@ -225,14 +225,14 @@ static inline void check_daddi(void) ...@@ -225,14 +225,14 @@ static inline void check_daddi(void)
printk("yes, workaround... "); printk("yes, workaround... ");
local_irq_save(flags); local_irq_save(flags);
handler = set_except_vector(12, handle_daddi_ov); handler = set_except_vector(EXCCODE_OV, handle_daddi_ov);
asm volatile( asm volatile(
"addiu %1, $0, %2\n\t" "addiu %1, $0, %2\n\t"
"dsrl %1, %1, 1\n\t" "dsrl %1, %1, 1\n\t"
"daddi %0, %1, %3" "daddi %0, %1, %3"
: "=r" (v), "=&r" (tmp) : "=r" (v), "=&r" (tmp)
: "I" (0xffffffffffffdb9aUL), "I" (0x1234)); : "I" (0xffffffffffffdb9aUL), "I" (0x1234));
set_except_vector(12, handler); set_except_vector(EXCCODE_OV, handler);
local_irq_restore(flags); local_irq_restore(flags);
if (daddi_ov) { if (daddi_ov) {
......
...@@ -2250,7 +2250,7 @@ void __init trap_init(void) ...@@ -2250,7 +2250,7 @@ void __init trap_init(void)
* Only some CPUs have the watch exceptions. * Only some CPUs have the watch exceptions.
*/ */
if (cpu_has_watch) if (cpu_has_watch)
set_except_vector(23, handle_watch); set_except_vector(EXCCODE_WATCH, handle_watch);
/* /*
* Initialise interrupt handlers * Initialise interrupt handlers
...@@ -2277,27 +2277,27 @@ void __init trap_init(void) ...@@ -2277,27 +2277,27 @@ void __init trap_init(void)
if (board_be_init) if (board_be_init)
board_be_init(); board_be_init();
set_except_vector(0, using_rollback_handler() ? rollback_handle_int set_except_vector(EXCCODE_INT, using_rollback_handler() ?
: handle_int); rollback_handle_int : handle_int);
set_except_vector(1, handle_tlbm); set_except_vector(EXCCODE_MOD, handle_tlbm);
set_except_vector(2, handle_tlbl); set_except_vector(EXCCODE_TLBL, handle_tlbl);
set_except_vector(3, handle_tlbs); set_except_vector(EXCCODE_TLBS, handle_tlbs);
set_except_vector(4, handle_adel); set_except_vector(EXCCODE_ADEL, handle_adel);
set_except_vector(5, handle_ades); set_except_vector(EXCCODE_ADES, handle_ades);
set_except_vector(6, handle_ibe); set_except_vector(EXCCODE_IBE, handle_ibe);
set_except_vector(7, handle_dbe); set_except_vector(EXCCODE_DBE, handle_dbe);
set_except_vector(8, handle_sys); set_except_vector(EXCCODE_SYS, handle_sys);
set_except_vector(9, handle_bp); set_except_vector(EXCCODE_BP, handle_bp);
set_except_vector(10, rdhwr_noopt ? handle_ri : set_except_vector(EXCCODE_RI, rdhwr_noopt ? handle_ri :
(cpu_has_vtag_icache ? (cpu_has_vtag_icache ?
handle_ri_rdhwr_vivt : handle_ri_rdhwr)); handle_ri_rdhwr_vivt : handle_ri_rdhwr));
set_except_vector(11, handle_cpu); set_except_vector(EXCCODE_CPU, handle_cpu);
set_except_vector(12, handle_ov); set_except_vector(EXCCODE_OV, handle_ov);
set_except_vector(13, handle_tr); set_except_vector(EXCCODE_TR, handle_tr);
set_except_vector(14, handle_msa_fpe); set_except_vector(EXCCODE_MSAFPE, handle_msa_fpe);
if (current_cpu_type() == CPU_R6000 || if (current_cpu_type() == CPU_R6000 ||
current_cpu_type() == CPU_R6000A) { current_cpu_type() == CPU_R6000A) {
...@@ -2318,25 +2318,25 @@ void __init trap_init(void) ...@@ -2318,25 +2318,25 @@ void __init trap_init(void)
board_nmi_handler_setup(); board_nmi_handler_setup();
if (cpu_has_fpu && !cpu_has_nofpuex) if (cpu_has_fpu && !cpu_has_nofpuex)
set_except_vector(15, handle_fpe); set_except_vector(EXCCODE_FPE, handle_fpe);
set_except_vector(16, handle_ftlb); set_except_vector(MIPS_EXCCODE_TLBPAR, handle_ftlb);
if (cpu_has_rixiex) { if (cpu_has_rixiex) {
set_except_vector(19, tlb_do_page_fault_0); set_except_vector(EXCCODE_TLBRI, tlb_do_page_fault_0);
set_except_vector(20, tlb_do_page_fault_0); set_except_vector(EXCCODE_TLBXI, tlb_do_page_fault_0);
} }
set_except_vector(21, handle_msa); set_except_vector(EXCCODE_MSADIS, handle_msa);
set_except_vector(22, handle_mdmx); set_except_vector(EXCCODE_MDMX, handle_mdmx);
if (cpu_has_mcheck) if (cpu_has_mcheck)
set_except_vector(24, handle_mcheck); set_except_vector(EXCCODE_MCHECK, handle_mcheck);
if (cpu_has_mipsmt) if (cpu_has_mipsmt)
set_except_vector(25, handle_mt); set_except_vector(EXCCODE_THREAD, handle_mt);
set_except_vector(26, handle_dsp); set_except_vector(EXCCODE_DSPDIS, handle_dsp);
if (board_cache_error_setup) if (board_cache_error_setup)
board_cache_error_setup(); board_cache_error_setup();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment