diff mbox series

[v2,for-4.9,04/32] MIPS: Lantiq: Fix cascaded IRQ setup

Message ID 1491388344-13521-5-git-send-email-amit.pundir@linaro.org
State Superseded
Headers show
Series Stable commits picked up from lede project | expand

Commit Message

Amit Pundir April 5, 2017, 10:31 a.m. UTC
From: Felix Fietkau <nbd@nbd.name>


With the IRQ stack changes integrated, the XRX200 devices started
emitting a constant stream of kernel messages like this:

[  565.415310] Spurious IRQ: CAUSE=0x1100c300

This is caused by IP0 getting handled by plat_irq_dispatch() rather than
its vectored interrupt handler, which is fixed by commit de856416e714
("MIPS: IRQ Stack: Fix erroneous jal to plat_irq_dispatch").

Fix plat_irq_dispatch() to handle non-vectored IPI interrupts correctly
by setting up IP2-6 as proper chained IRQ handlers and calling do_IRQ
for all MIPS CPU interrupts.

Signed-off-by: Felix Fietkau <nbd@nbd.name>

Acked-by: John Crispin <john@phrozen.org>

Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/15077/
[james.hogan@imgtec.com: tweaked commit message]
Signed-off-by: James Hogan <james.hogan@imgtec.com>


(cherry picked from commit 6c356eda225e3ee134ed4176b9ae3a76f793f4dd)
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>

---
 arch/mips/lantiq/irq.c | 38 +++++++++++++++++---------------------
 1 file changed, 17 insertions(+), 21 deletions(-)

-- 
2.7.4

Comments

Greg KH April 6, 2017, 7:34 a.m. UTC | #1
On Wed, Apr 05, 2017 at 04:01:56PM +0530, Amit Pundir wrote:
> From: Felix Fietkau <nbd@nbd.name>

> 

> With the IRQ stack changes integrated, the XRX200 devices started

> emitting a constant stream of kernel messages like this:

> 

> [  565.415310] Spurious IRQ: CAUSE=0x1100c300

> 

> This is caused by IP0 getting handled by plat_irq_dispatch() rather than

> its vectored interrupt handler, which is fixed by commit de856416e714

> ("MIPS: IRQ Stack: Fix erroneous jal to plat_irq_dispatch").

> 

> Fix plat_irq_dispatch() to handle non-vectored IPI interrupts correctly

> by setting up IP2-6 as proper chained IRQ handlers and calling do_IRQ

> for all MIPS CPU interrupts.

> 

> Signed-off-by: Felix Fietkau <nbd@nbd.name>

> Acked-by: John Crispin <john@phrozen.org>

> Cc: linux-mips@linux-mips.org

> Patchwork: https://patchwork.linux-mips.org/patch/15077/

> [james.hogan@imgtec.com: tweaked commit message]

> Signed-off-by: James Hogan <james.hogan@imgtec.com>

> 

> (cherry picked from commit 6c356eda225e3ee134ed4176b9ae3a76f793f4dd)

> Signed-off-by: Amit Pundir <amit.pundir@linaro.org>

> ---

>  arch/mips/lantiq/irq.c | 38 +++++++++++++++++---------------------

>  1 file changed, 17 insertions(+), 21 deletions(-)


Also works for 4.4 and 4.10-stable...

greg k-h
James Hogan April 6, 2017, 9:29 a.m. UTC | #2
Hi Amit,

On Wed, Apr 05, 2017 at 04:01:56PM +0530, Amit Pundir wrote:
> From: Felix Fietkau <nbd@nbd.name>

> 

> With the IRQ stack changes integrated, the XRX200 devices started

> emitting a constant stream of kernel messages like this:

> 

> [  565.415310] Spurious IRQ: CAUSE=0x1100c300

> 

> This is caused by IP0 getting handled by plat_irq_dispatch() rather than

> its vectored interrupt handler, which is fixed by commit de856416e714

> ("MIPS: IRQ Stack: Fix erroneous jal to plat_irq_dispatch").

> 

> Fix plat_irq_dispatch() to handle non-vectored IPI interrupts correctly

> by setting up IP2-6 as proper chained IRQ handlers and calling do_IRQ

> for all MIPS CPU interrupts.

> 

> Signed-off-by: Felix Fietkau <nbd@nbd.name>

> Acked-by: John Crispin <john@phrozen.org>

> Cc: linux-mips@linux-mips.org

> Patchwork: https://patchwork.linux-mips.org/patch/15077/

> [james.hogan@imgtec.com: tweaked commit message]

> Signed-off-by: James Hogan <james.hogan@imgtec.com>

> 

> (cherry picked from commit 6c356eda225e3ee134ed4176b9ae3a76f793f4dd)

> Signed-off-by: Amit Pundir <amit.pundir@linaro.org>


Is there a particular reason this is desired in stable? I was under the
impression it was only helpful in the presence of a bug in the separate
IRQ stack stuff in 4.11, which was fixed in the above mentioned commit
de856416e714 ("MIPS: IRQ Stack: Fix erroneous jal to
plat_irq_dispatch"), and otherwise just a nice to have cleanup.

If you've cherry picked the IRQ stack work, have you also cherry-picked
de856416e714?

Cheers
James
Amit Pundir April 6, 2017, 10:53 a.m. UTC | #3
Hi James,

On 6 April 2017 at 14:59, James Hogan <james.hogan@imgtec.com> wrote:
> Hi Amit,

>

> On Wed, Apr 05, 2017 at 04:01:56PM +0530, Amit Pundir wrote:

>> From: Felix Fietkau <nbd@nbd.name>

>>

>> With the IRQ stack changes integrated, the XRX200 devices started

>> emitting a constant stream of kernel messages like this:

>>

>> [  565.415310] Spurious IRQ: CAUSE=0x1100c300

>>

>> This is caused by IP0 getting handled by plat_irq_dispatch() rather than

>> its vectored interrupt handler, which is fixed by commit de856416e714

>> ("MIPS: IRQ Stack: Fix erroneous jal to plat_irq_dispatch").

>>

>> Fix plat_irq_dispatch() to handle non-vectored IPI interrupts correctly

>> by setting up IP2-6 as proper chained IRQ handlers and calling do_IRQ

>> for all MIPS CPU interrupts.

>>

>> Signed-off-by: Felix Fietkau <nbd@nbd.name>

>> Acked-by: John Crispin <john@phrozen.org>

>> Cc: linux-mips@linux-mips.org

>> Patchwork: https://patchwork.linux-mips.org/patch/15077/

>> [james.hogan@imgtec.com: tweaked commit message]

>> Signed-off-by: James Hogan <james.hogan@imgtec.com>

>>

>> (cherry picked from commit 6c356eda225e3ee134ed4176b9ae3a76f793f4dd)

>> Signed-off-by: Amit Pundir <amit.pundir@linaro.org>

>

> Is there a particular reason this is desired in stable? I was under the

> impression it was only helpful in the presence of a bug in the separate

> IRQ stack stuff in 4.11, which was fixed in the above mentioned commit

> de856416e714 ("MIPS: IRQ Stack: Fix erroneous jal to

> plat_irq_dispatch"), and otherwise just a nice to have cleanup.


I picked up this patch from Lede source tree
https://github.com/lede-project/source/ for stable 4.9.

>

> If you've cherry picked the IRQ stack work, have you also cherry-picked

> de856416e714?


Thanks for pointing it out. I indeed missed out on picking
de856416e714 ("MIPS: IRQ Stack: Fix erroneous jal to
plat_irq_dispatch") and dda45f701c9d ("MIPS: Switch to the irq_stack
in interrupts"). Should I pick them too for 4.9/4.10 stable or drop
these 3 IRQ stack patches altogether if they are not stable material?

Regards,
Amit Pundir

>

> Cheers

> James
James Hogan April 6, 2017, 11:25 a.m. UTC | #4
On Thu, Apr 06, 2017 at 04:23:24PM +0530, Amit Pundir wrote:
> On 6 April 2017 at 14:59, James Hogan <james.hogan@imgtec.com> wrote:

> > Is there a particular reason this is desired in stable? I was under the

> > impression it was only helpful in the presence of a bug in the separate

> > IRQ stack stuff in 4.11, which was fixed in the above mentioned commit

> > de856416e714 ("MIPS: IRQ Stack: Fix erroneous jal to

> > plat_irq_dispatch"), and otherwise just a nice to have cleanup.

> 

> I picked up this patch from Lede source tree

> https://github.com/lede-project/source/ for stable 4.9.

> 

> >

> > If you've cherry picked the IRQ stack work, have you also cherry-picked

> > de856416e714?

> 

> Thanks for pointing it out. I indeed missed out on picking

> de856416e714 ("MIPS: IRQ Stack: Fix erroneous jal to

> plat_irq_dispatch") and dda45f701c9d ("MIPS: Switch to the irq_stack

> in interrupts"). Should I pick them too for 4.9/4.10 stable or drop

> these 3 IRQ stack patches altogether if they are not stable material?


I'd definitely drop this one.

Greg said he doesn't object to accepting the IRQ stack work once its
been shaken out in mainline, at which point the fixes will be needed
too:

https://marc.info/?l=linux-mips&m=148449064421154&w=2

Though note that its more than just the one patch:

https://patchwork.linux-mips.org/project/linux-mips/list/?series=23&state=*

(I seem to remember somebody saying LEDE had applied these patches).

Cheers
James
Amit Pundir April 6, 2017, 11:44 a.m. UTC | #5
On 6 April 2017 at 16:55, James Hogan <james.hogan@imgtec.com> wrote:
> On Thu, Apr 06, 2017 at 04:23:24PM +0530, Amit Pundir wrote:

>> On 6 April 2017 at 14:59, James Hogan <james.hogan@imgtec.com> wrote:

>> > Is there a particular reason this is desired in stable? I was under the

>> > impression it was only helpful in the presence of a bug in the separate

>> > IRQ stack stuff in 4.11, which was fixed in the above mentioned commit

>> > de856416e714 ("MIPS: IRQ Stack: Fix erroneous jal to

>> > plat_irq_dispatch"), and otherwise just a nice to have cleanup.

>>

>> I picked up this patch from Lede source tree

>> https://github.com/lede-project/source/ for stable 4.9.

>>

>> >

>> > If you've cherry picked the IRQ stack work, have you also cherry-picked

>> > de856416e714?

>>

>> Thanks for pointing it out. I indeed missed out on picking

>> de856416e714 ("MIPS: IRQ Stack: Fix erroneous jal to

>> plat_irq_dispatch") and dda45f701c9d ("MIPS: Switch to the irq_stack

>> in interrupts"). Should I pick them too for 4.9/4.10 stable or drop

>> these 3 IRQ stack patches altogether if they are not stable material?

>

> I'd definitely drop this one.


Yes I'd drop this lone survivor too. I'll send the complete batch separately.

>

> Greg said he doesn't object to accepting the IRQ stack work once its

> been shaken out in mainline, at which point the fixes will be needed

> too:

>

> https://marc.info/?l=linux-mips&m=148449064421154&w=2

>

> Though note that its more than just the one patch:

>

> https://patchwork.linux-mips.org/project/linux-mips/list/?series=23&state=*

>

> (I seem to remember somebody saying LEDE had applied these patches).


I see all these patches in LEDE source too. Sorted out for both 4.4
and 4.9 already. I'll send them on stable shortly.

Regards,
Amit Pundir

>

> Cheers

> James
diff mbox series

Patch

diff --git a/arch/mips/lantiq/irq.c b/arch/mips/lantiq/irq.c
index 8ac0e59..0ddf369 100644
--- a/arch/mips/lantiq/irq.c
+++ b/arch/mips/lantiq/irq.c
@@ -269,6 +269,11 @@  static void ltq_hw5_irqdispatch(void)
 DEFINE_HWx_IRQDISPATCH(5)
 #endif
 
+static void ltq_hw_irq_handler(struct irq_desc *desc)
+{
+	ltq_hw_irqdispatch(irq_desc_get_irq(desc) - 2);
+}
+
 #ifdef CONFIG_MIPS_MT_SMP
 void __init arch_init_ipiirq(int irq, struct irqaction *action)
 {
@@ -313,23 +318,19 @@  static struct irqaction irq_call = {
 asmlinkage void plat_irq_dispatch(void)
 {
 	unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM;
-	unsigned int i;
-
-	if ((MIPS_CPU_TIMER_IRQ == 7) && (pending & CAUSEF_IP7)) {
-		do_IRQ(MIPS_CPU_TIMER_IRQ);
-		goto out;
-	} else {
-		for (i = 0; i < MAX_IM; i++) {
-			if (pending & (CAUSEF_IP2 << i)) {
-				ltq_hw_irqdispatch(i);
-				goto out;
-			}
-		}
+	int irq;
+
+	if (!pending) {
+		spurious_interrupt();
+		return;
 	}
-	pr_alert("Spurious IRQ: CAUSE=0x%08x\n", read_c0_status());
 
-out:
-	return;
+	pending >>= CAUSEB_IP;
+	while (pending) {
+		irq = fls(pending) - 1;
+		do_IRQ(MIPS_CPU_IRQ_BASE + irq);
+		pending &= ~BIT(irq);
+	}
 }
 
 static int icu_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw)
@@ -354,11 +355,6 @@  static const struct irq_domain_ops irq_domain_ops = {
 	.map = icu_map,
 };
 
-static struct irqaction cascade = {
-	.handler = no_action,
-	.name = "cascade",
-};
-
 int __init icu_of_init(struct device_node *node, struct device_node *parent)
 {
 	struct device_node *eiu_node;
@@ -390,7 +386,7 @@  int __init icu_of_init(struct device_node *node, struct device_node *parent)
 	mips_cpu_irq_init();
 
 	for (i = 0; i < MAX_IM; i++)
-		setup_irq(i + 2, &cascade);
+		irq_set_chained_handler(i + 2, ltq_hw_irq_handler);
 
 	if (cpu_has_vint) {
 		pr_info("Setting up vectored interrupts\n");