From: Ralf Baechle <ralf@linux-mips.org>
Date: Sat, 1 Apr 2006 20:17:45 +0000 (+0100)
Subject: [MIPS] Rewrite spurious_interrupt from assembler to C.
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=93373ed4d87fb02554ce020d929388ac16913664;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git

[MIPS] Rewrite spurious_interrupt from assembler to C.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
---

diff --git a/arch/mips/au1000/common/int-handler.S b/arch/mips/au1000/common/int-handler.S
index 1c4ca883321e..65baa8a8c522 100644
--- a/arch/mips/au1000/common/int-handler.S
+++ b/arch/mips/au1000/common/int-handler.S
@@ -64,5 +64,6 @@ NESTED(au1000_IRQ, PT_SIZE, sp)
 
 5:
 	move	a0, sp
-	j	spurious_interrupt
+	jal	spurious_interrupt
+	j	ret_from_irq
 END(au1000_IRQ)
diff --git a/arch/mips/ddb5xxx/ddb5476/int-handler.S b/arch/mips/ddb5xxx/ddb5476/int-handler.S
index 12c292e189ba..0c2bdae96bb1 100644
--- a/arch/mips/ddb5xxx/ddb5476/int-handler.S
+++ b/arch/mips/ddb5xxx/ddb5476/int-handler.S
@@ -54,7 +54,8 @@
 	.set	reorder
 
 	/* wrong alarm or masked ... */
-	// j	spurious_interrupt
+	// jal	spurious_interrupt
+	// j	ret_from_irq
 	move 	a0, sp
 	jal	vrc5476_irq_dispatch
 	j	ret_from_irq
diff --git a/arch/mips/ddb5xxx/ddb5476/vrc5476_irq.c b/arch/mips/ddb5xxx/ddb5476/vrc5476_irq.c
index f66fe5b58636..581eabad5f82 100644
--- a/arch/mips/ddb5xxx/ddb5476/vrc5476_irq.c
+++ b/arch/mips/ddb5xxx/ddb5476/vrc5476_irq.c
@@ -80,8 +80,6 @@ vrc5476_irq_init(u32 base)
 asmlinkage void
 vrc5476_irq_dispatch(struct pt_regs *regs)
 {
-	extern void spurious_interrupt(void);
-
 	u32 mask;
 	int nile4_irq;
 
@@ -107,5 +105,5 @@ vrc5476_irq_dispatch(struct pt_regs *regs)
 			return;
 		}
 	}
-	spurious_interrupt();
+	spurious_interrupt(regs);
 }
diff --git a/arch/mips/ddb5xxx/ddb5477/int-handler.S b/arch/mips/ddb5xxx/ddb5477/int-handler.S
index a2502a14400e..9884874dbeb5 100644
--- a/arch/mips/ddb5xxx/ddb5477/int-handler.S
+++ b/arch/mips/ddb5xxx/ddb5477/int-handler.S
@@ -44,8 +44,8 @@
 	.set	reorder
 
 	/* wrong alarm or masked ... */
-	j	spurious_interrupt
-	nop
+	jal	spurious_interrupt
+	j	ret_from_irq
 	END(ddb5477_handle_int)
 
 	.align	5
diff --git a/arch/mips/dec/int-handler.S b/arch/mips/dec/int-handler.S
index 41fa372007bf..5bafd585ac3e 100644
--- a/arch/mips/dec/int-handler.S
+++ b/arch/mips/dec/int-handler.S
@@ -282,7 +282,9 @@ fpu:
 #endif
 
 spurious:
-		j	spurious_interrupt
+		jal	spurious_interrupt
+		 nop
+		j	ret_from_irq
 		 nop
 		END(decstation_handle_int)
 
diff --git a/arch/mips/galileo-boards/ev96100/int-handler.S b/arch/mips/galileo-boards/ev96100/int-handler.S
index ff4d10a38859..0edf1fec2905 100644
--- a/arch/mips/galileo-boards/ev96100/int-handler.S
+++ b/arch/mips/galileo-boards/ev96100/int-handler.S
@@ -29,5 +29,6 @@ NESTED(ev96100IRQ, PT_SIZE, sp)
 	jal	ev96100_cpu_irq
 	j	ret_from_irq
 
-3:	j	spurious_interrupt
+3:	jal	spurious_interrupt
+	j	ret_from_irq
 	END(ev96100IRQ)
diff --git a/arch/mips/gt64120/ev64120/int-handler.S b/arch/mips/gt64120/ev64120/int-handler.S
index 752435faf2de..9dda5b449522 100644
--- a/arch/mips/gt64120/ev64120/int-handler.S
+++ b/arch/mips/gt64120/ev64120/int-handler.S
@@ -39,8 +39,9 @@
 		nop
 
     /* wrong alarm or masked ... */
-		j	spurious_interrupt
+		jal	spurious_interrupt
 		nop
+		j	ret_from_irq
 		END(galileo_handle_int)
 
 
diff --git a/arch/mips/jazz/int-handler.S b/arch/mips/jazz/int-handler.S
index dc752c67b528..e35f5fcd3f90 100644
--- a/arch/mips/jazz/int-handler.S
+++ b/arch/mips/jazz/int-handler.S
@@ -263,7 +263,8 @@ loc_call:	/*
 /*
  * "Jump extender" to reach spurious_interrupt
  */
-3:		j	spurious_interrupt
+3:		jal	spurious_interrupt
+		j	ret_from_irq
 
 /*
  * Vectors for interrupts generated by local devices
diff --git a/arch/mips/kernel/entry.S b/arch/mips/kernel/entry.S
index 83c87fe4ee4f..371571f4f280 100644
--- a/arch/mips/kernel/entry.S
+++ b/arch/mips/kernel/entry.S
@@ -119,29 +119,3 @@ syscall_exit_work:
 	li	a1, 1
 	jal	do_syscall_trace
 	b	resume_userspace
-
-/*
- * Common spurious interrupt handler.
- */
-LEAF(spurious_interrupt)
-	/*
-	 * Someone tried to fool us by sending an interrupt but we
-	 * couldn't find a cause for it.
-	 */
-	PTR_LA	t1, irq_err_count
-#ifdef CONFIG_SMP
-1:	ll      t0, (t1)
-	addiu   t0, 1
-	sc      t0, (t1)
-#if R10000_LLSC_WAR
-	beqzl	t0, 1b
-#else
-	beqz	t0, 1b
-#endif
-#else
-	lw      t0, (t1)
-	addiu   t0, 1
-	sw      t0, (t1)
-#endif
-	j	ret_from_irq
-	END(spurious_interrupt)
diff --git a/arch/mips/kernel/irq.c b/arch/mips/kernel/irq.c
index 3dd76b3d2967..e0efc4f2f93e 100644
--- a/arch/mips/kernel/irq.c
+++ b/arch/mips/kernel/irq.c
@@ -101,6 +101,11 @@ skip:
 	return 0;
 }
 
+asmlinkage void spurious_interrupt(struct pt_regs *regs)
+{
+	atomic_inc(&irq_err_count);
+}
+
 #ifdef CONFIG_KGDB
 extern void breakpoint(void);
 extern void set_debug_traps(void);
diff --git a/arch/mips/mips-boards/generic/mipsIRQ.S b/arch/mips/mips-boards/generic/mipsIRQ.S
index ddd5c73a2971..973e10aaacd5 100644
--- a/arch/mips/mips-boards/generic/mipsIRQ.S
+++ b/arch/mips/mips-boards/generic/mipsIRQ.S
@@ -150,6 +150,8 @@
 
 
 spurious:
-	j	spurious_interrupt
+	jal	spurious_interrupt
+	 nop
+	j	ret_from_irq
 	 nop
 	END(mipsIRQ)
diff --git a/arch/mips/mips-boards/sim/sim_irq.S b/arch/mips/mips-boards/sim/sim_irq.S
index da52297a2216..d16cf3822076 100644
--- a/arch/mips/mips-boards/sim/sim_irq.S
+++ b/arch/mips/mips-boards/sim/sim_irq.S
@@ -94,6 +94,8 @@
 
 
 spurious:
-	j	spurious_interrupt
+	jal	spurious_interrupt
+	 nop
+	j	ret_from_irq
 	 nop
 	END(simIRQ)
diff --git a/arch/mips/momentum/ocelot_3/int-handler.S b/arch/mips/momentum/ocelot_3/int-handler.S
index 4522f09ed769..b1207262984a 100644
--- a/arch/mips/momentum/ocelot_3/int-handler.S
+++ b/arch/mips/momentum/ocelot_3/int-handler.S
@@ -78,8 +78,10 @@
 		.set	reorder
 
 		/* wrong alarm or masked ... */
-		j	spurious_interrupt
+		jal	spurious_interrupt
 		nop
+		j	ret_from_irq
+		 nop
 		END(ocelot3_handle_int)
 
 		.align	5
diff --git a/arch/mips/momentum/ocelot_c/int-handler.S b/arch/mips/momentum/ocelot_c/int-handler.S
index 52349d9bf1be..f77834193c3c 100644
--- a/arch/mips/momentum/ocelot_c/int-handler.S
+++ b/arch/mips/momentum/ocelot_c/int-handler.S
@@ -52,8 +52,9 @@
 		.set	reorder
 
 		/* wrong alarm or masked ... */
-		j	spurious_interrupt
+		jal	spurious_interrupt
 		nop
+		j	ret_from_irq
 		END(ocelot_handle_int)
 
 		.align	5
diff --git a/arch/mips/philips/pnx8550/common/mipsIRQ.S b/arch/mips/philips/pnx8550/common/mipsIRQ.S
index 338bffda3fab..e049a719f83d 100644
--- a/arch/mips/philips/pnx8550/common/mipsIRQ.S
+++ b/arch/mips/philips/pnx8550/common/mipsIRQ.S
@@ -46,8 +46,9 @@
 
 		/* wrong alarm or masked ... */
 
-		j	spurious_interrupt
+		jal	spurious_interrupt
 		nop
+		j	ret_from_irq
 		END(cp0_irqdispatch)
 
 		.align	5
diff --git a/arch/mips/tx4927/common/tx4927_irq_handler.S b/arch/mips/tx4927/common/tx4927_irq_handler.S
index dd3ceda9d712..0b2ea02574f2 100644
--- a/arch/mips/tx4927/common/tx4927_irq_handler.S
+++ b/arch/mips/tx4927/common/tx4927_irq_handler.S
@@ -63,8 +63,9 @@
 		.set	reorder
 
 		/* wrong alarm or masked ... */
-		j	spurious_interrupt
+		jal	spurious_interrupt
 		nop
+		j	ret_from_irq
 		END(tx4927_irq_handler)
 
 		.align	5
diff --git a/arch/mips/vr41xx/common/int-handler.S b/arch/mips/vr41xx/common/int-handler.S
index 2b6043f16d09..e8652348fef1 100644
--- a/arch/mips/vr41xx/common/int-handler.S
+++ b/arch/mips/vr41xx/common/int-handler.S
@@ -98,8 +98,10 @@
 		bnez	t1, handle_irq
 		li	a0, 1
 
-		j	spurious_interrupt
+		jal	spurious_interrupt
 		nop
+		j	ret_from_irq
+		 nop
 
 handle_int:
 		jal	irq_dispatch
diff --git a/include/asm-mips/irq.h b/include/asm-mips/irq.h
index 8a342ccb34a8..d7aecca3b95f 100644
--- a/include/asm-mips/irq.h
+++ b/include/asm-mips/irq.h
@@ -46,5 +46,6 @@ do {									\
 #endif
 
 extern void arch_init_irq(void);
+extern void spurious_interrupt(struct pt_regs *regs);
 
 #endif /* _ASM_IRQ_H */