diff mbox

IRQ #0 broken on ARM

Message ID CALT56yPs-SSssff1waj81CRQfER4ZKKR=B1jOXVL-aBChicSjg@mail.gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dmitry Baryshkov Nov. 21, 2014, 10:31 a.m. UTC
Hello,

After the commit a71b092a9c68685a270ebdde7b5986ba8787e575
(ARM: Convert handle_IRQ to use __handle_domain_irq) IRQ #0 is broken
on ARM. It is a valid IRQ and it is quite imporant (on sa1100 it's a GPIO0).

The worst thing is that the CPU will be stuck busy-looping around this IRQ
w/o printing anything to the console or masking the irq. How should we cope
with that? I'd like to propose to either revert the offending commit or to add
the following patch.

Comments

Russell King - ARM Linux Nov. 21, 2014, 10:34 a.m. UTC | #1
On Fri, Nov 21, 2014 at 02:31:05PM +0400, Dmitry Eremin-Solenikov wrote:
> Hello,
> 
> After the commit a71b092a9c68685a270ebdde7b5986ba8787e575
> (ARM: Convert handle_IRQ to use __handle_domain_irq) IRQ #0 is broken
> on ARM. It is a valid IRQ and it is quite imporant (on sa1100 it's a GPIO0).

No, it is not a valid IRQ.  (It was a mistake to think it was.)
Generic code will always assume IRQ0 is not valid, and the fix is to
fix the places in ARM where we try to use it.
Dmitry Baryshkov Nov. 21, 2014, 10:51 a.m. UTC | #2
2014-11-21 13:34 GMT+03:00 Russell King - ARM Linux <linux@arm.linux.org.uk>:
> On Fri, Nov 21, 2014 at 02:31:05PM +0400, Dmitry Eremin-Solenikov wrote:
>> Hello,
>>
>> After the commit a71b092a9c68685a270ebdde7b5986ba8787e575
>> (ARM: Convert handle_IRQ to use __handle_domain_irq) IRQ #0 is broken
>> on ARM. It is a valid IRQ and it is quite imporant (on sa1100 it's a GPIO0).
>
> No, it is not a valid IRQ.  (It was a mistake to think it was.)
> Generic code will always assume IRQ0 is not valid, and the fix is to
> fix the places in ARM where we try to use it.

Ok. SA1100, PXA, ebsa110, footbridge, rpc, orion5x, mv78xx0, ixp4xx,
lpc32xx, ks8695 and several other aging not so aging platforms are using IRQ0.

Breaking them in a very strange and silent manner doesn't look like a good
behaviour, does it? What would be a proposed fix?
Uwe Kleine-König Nov. 21, 2014, 10:53 a.m. UTC | #3
On Fri, Nov 21, 2014 at 10:34:56AM +0000, Russell King - ARM Linux wrote:
> On Fri, Nov 21, 2014 at 02:31:05PM +0400, Dmitry Eremin-Solenikov wrote:
> > Hello,
> > 
> > After the commit a71b092a9c68685a270ebdde7b5986ba8787e575
> > (ARM: Convert handle_IRQ to use __handle_domain_irq) IRQ #0 is broken
> > on ARM. It is a valid IRQ and it is quite imporant (on sa1100 it's a GPIO0).
> 
> No, it is not a valid IRQ.  (It was a mistake to think it was.)
> Generic code will always assume IRQ0 is not valid, and the fix is to
> fix the places in ARM where we try to use it.
To make this more understandable: Linux uses virtual irq numbers. The
virtual irq 0 is invalid. For a given irq domain the (hardware) irq 0 is
of course useful and can be supported. Still for a device driver (which
uses the virtual irq space) 0 should always be invalid.

Best regards
Uwe
Dmitry Baryshkov Nov. 21, 2014, 10:55 a.m. UTC | #4
2014-11-21 13:53 GMT+03:00 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:
> On Fri, Nov 21, 2014 at 10:34:56AM +0000, Russell King - ARM Linux wrote:
>> On Fri, Nov 21, 2014 at 02:31:05PM +0400, Dmitry Eremin-Solenikov wrote:
>> > Hello,
>> >
>> > After the commit a71b092a9c68685a270ebdde7b5986ba8787e575
>> > (ARM: Convert handle_IRQ to use __handle_domain_irq) IRQ #0 is broken
>> > on ARM. It is a valid IRQ and it is quite imporant (on sa1100 it's a GPIO0).
>>
>> No, it is not a valid IRQ.  (It was a mistake to think it was.)
>> Generic code will always assume IRQ0 is not valid, and the fix is to
>> fix the places in ARM where we try to use it.
> To make this more understandable: Linux uses virtual irq numbers. The
> virtual irq 0 is invalid. For a given irq domain the (hardware) irq 0 is
> of course useful and can be supported. Still for a device driver (which
> uses the virtual irq space) 0 should always be invalid.

I was talking about virtual irq space, not hwirq.
diff mbox

Patch

From e87f86497b796ed55fff644bbc75bf1890941829 Mon Sep 17 00:00:00 2001
From: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Date: Fri, 21 Nov 2014 13:27:11 +0300
Subject: [PATCH] genirq: handle IRQ 0 in __handle_domain_irq

__handle_domain_irq() function will ignore (well, report as bad) the IRQ
number 0. On some platforms IRQ0 is bad IRQ. On others it is not. And
while platforms are still in the process of converging to not using
IRQ number 0 as a valid IRQ, I'd like to propose to use IRQ0 as a valid
one in __handle_domain_irq().

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
---
 kernel/irq/irqdesc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index a1782f8..bfbeeb6 100644
--- a/kernel/irq/irqdesc.c
+++ b/kernel/irq/irqdesc.c
@@ -365,7 +365,7 @@  int __handle_domain_irq(struct irq_domain *domain, unsigned int hwirq,
 	 * Some hardware gives randomly wrong interrupts.  Rather
 	 * than crashing, do something sensible.
 	 */
-	if (unlikely(!irq || irq >= nr_irqs)) {
+	if (unlikely(irq >= nr_irqs)) {
 		ack_bad_irq(irq);
 		ret = -EINVAL;
 	} else {
-- 
2.1.1