* [patch] x86 supports NO_IRQ convention
@ 2008-06-23 2:53 David Brownell
2008-06-23 9:08 ` Alan Cox
2008-06-23 10:42 ` Benjamin Herrenschmidt
0 siblings, 2 replies; 11+ messages in thread
From: David Brownell @ 2008-06-23 2:53 UTC (permalink / raw)
To: lkml; +Cc: Thomas Gleixner, Ingo Molnar, hpa
Hmm, x86 doesn't seem to support the NO_IRQ convention. This means
that portable code can't use it. Which in turn means that there's
no portable way for drivers to know whether they have been handed a
valid IRQ number (zero usually being valid). Double-plus ungood.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
---
I suspect this has been discussed before, but I can't find any
written resolution ...
include/asm-x86/irq.h | 4 ++++
1 file changed, 4 insertions(+)
--- a/include/asm-x86/irq.h 2008-06-22 16:36:43.000000000 -0700
+++ b/include/asm-x86/irq.h 2008-06-22 16:37:06.000000000 -0700
@@ -3,3 +3,7 @@
#else
# include "irq_64.h"
#endif
+
+#ifndef NO_IRQ
+#define NO_IRQ ((unsigned int)(-1))
+#endif
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [patch] x86 supports NO_IRQ convention
2008-06-23 2:53 David Brownell
@ 2008-06-23 9:08 ` Alan Cox
2008-06-23 11:29 ` David Brownell
2008-06-23 11:34 ` Johannes Stezenbach
2008-06-23 10:42 ` Benjamin Herrenschmidt
1 sibling, 2 replies; 11+ messages in thread
From: Alan Cox @ 2008-06-23 9:08 UTC (permalink / raw)
To: David Brownell; +Cc: lkml, Thomas Gleixner, Ingo Molnar, hpa
On Sun, 22 Jun 2008 19:53:18 -0700
David Brownell <david-b@pacbell.net> wrote:
> Hmm, x86 doesn't seem to support the NO_IRQ convention. This means
> that portable code can't use it. Which in turn means that there's
> no portable way for drivers to know whether they have been handed a
> valid IRQ number (zero usually being valid). Double-plus ungood.
NAK. It was discussed before repeatedly as you suspected and settled by
Linus ultimately.
Zero is not a valid IRQ in the kernel mapping of things. If you have a
physical IRQ 0 remap it. That way you can write the more natural
if (dev->irq)
setup_for_irq(dev);
else
poll(dev);
type stuff.
NO_IRQ was intentionally removed from various platforms and really wants
kicking out of some others.
Alan
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [patch] x86 supports NO_IRQ convention
2008-06-23 2:53 David Brownell
2008-06-23 9:08 ` Alan Cox
@ 2008-06-23 10:42 ` Benjamin Herrenschmidt
2008-06-23 11:28 ` David Brownell
1 sibling, 1 reply; 11+ messages in thread
From: Benjamin Herrenschmidt @ 2008-06-23 10:42 UTC (permalink / raw)
To: David Brownell; +Cc: lkml, Thomas Gleixner, Ingo Molnar, hpa
On Sun, 2008-06-22 at 19:53 -0700, David Brownell wrote:
> Hmm, x86 doesn't seem to support the NO_IRQ convention. This means
> that portable code can't use it. Which in turn means that there's
> no portable way for drivers to know whether they have been handed a
> valid IRQ number (zero usually being valid). Double-plus ungood.
>
> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
> ---
> I suspect this has been discussed before, but I can't find any
> written resolution ...
>
> include/asm-x86/irq.h | 4 ++++
> 1 file changed, 4 insertions(+)
>
> --- a/include/asm-x86/irq.h 2008-06-22 16:36:43.000000000 -0700
> +++ b/include/asm-x86/irq.h 2008-06-22 16:37:06.000000000 -0700
> @@ -3,3 +3,7 @@
> #else
> # include "irq_64.h"
> #endif
> +
> +#ifndef NO_IRQ
> +#define NO_IRQ ((unsigned int)(-1))
> +#endif
NO_IRQ on x86 is 0
In fact, we explicitely changed powerpc to do the same :-) (It became
easy after I made all linux irqs be virtual, and dynamically mapped to
physical numbers).
I think Linus wants everybody to follow...
Cheers,
Ben.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [patch] x86 supports NO_IRQ convention
2008-06-23 10:42 ` Benjamin Herrenschmidt
@ 2008-06-23 11:28 ` David Brownell
2008-06-23 20:06 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 11+ messages in thread
From: David Brownell @ 2008-06-23 11:28 UTC (permalink / raw)
To: benh; +Cc: lkml, Thomas Gleixner, Ingo Molnar, hpa
On Monday 23 June 2008, Benjamin Herrenschmidt wrote:
> NO_IRQ on x86 is 0
There is no such #define for it.
And since zero is used for timer IRQs, it's not invalid.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [patch] x86 supports NO_IRQ convention
2008-06-23 9:08 ` Alan Cox
@ 2008-06-23 11:29 ` David Brownell
2008-06-23 14:20 ` Alan Cox
2008-06-23 11:34 ` Johannes Stezenbach
1 sibling, 1 reply; 11+ messages in thread
From: David Brownell @ 2008-06-23 11:29 UTC (permalink / raw)
To: Alan Cox; +Cc: lkml, Thomas Gleixner, Ingo Molnar, hpa
On Monday 23 June 2008, Alan Cox wrote:
> Zero is not a valid IRQ in the kernel mapping of things.
That's counter-factual:
CPU0 CPU1
0: 42851354 6500253 IO-APIC-edge timer
1: 475459 45904 IO-APIC-edge i8042
8: 0 1 IO-APIC-edge rtc0
9: 135 18 IO-APIC-fasteoi acpi
12: 5232181 495206 IO-APIC-edge i8042
...
That's on x86. A quick survey of other boards around here
shows many that use IRQ 0 too.
I certainly agree it'd be convenient to be able to just test
for IRQ being nonzero. Presumably only one driver would ever
end up using IRQ 0 on x86, so other drivers could ignore the
fact that testing for nonzero would mean "not the timer irq"
rather than "no irq assigned".
- Dave
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [patch] x86 supports NO_IRQ convention
2008-06-23 9:08 ` Alan Cox
2008-06-23 11:29 ` David Brownell
@ 2008-06-23 11:34 ` Johannes Stezenbach
1 sibling, 0 replies; 11+ messages in thread
From: Johannes Stezenbach @ 2008-06-23 11:34 UTC (permalink / raw)
To: Alan Cox; +Cc: David Brownell, lkml, Thomas Gleixner, Ingo Molnar, hpa
On Mon, Jun 23, 2008 at 10:08:23AM +0100, Alan Cox wrote:
>
> Zero is not a valid IRQ in the kernel mapping of things. If you have a
> physical IRQ 0 remap it.
I'm confused. On my Thinkpad with kernel 2.6.25 I get:
$ cat /proc/interrupts
CPU0
0: 4398925 XT-PIC-XT timer
1: 287065 XT-PIC-XT i8042
2: 0 XT-PIC-XT cascade
...
Johannes
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [patch] x86 supports NO_IRQ convention
2008-06-23 11:29 ` David Brownell
@ 2008-06-23 14:20 ` Alan Cox
0 siblings, 0 replies; 11+ messages in thread
From: Alan Cox @ 2008-06-23 14:20 UTC (permalink / raw)
To: David Brownell; +Cc: lkml, Thomas Gleixner, Ingo Molnar, hpa
On Mon, 23 Jun 2008 04:29:36 -0700
David Brownell <david-b@pacbell.net> wrote:
> On Monday 23 June 2008, Alan Cox wrote:
> > Zero is not a valid IRQ in the kernel mapping of things.
>
> That's counter-factual:
There are historical reasons for the timer tick (which isn't visible
outside arch code) being 0 on x86.
> I certainly agree it'd be convenient to be able to just test
> for IRQ being nonzero.
0 means "no IRQ" in things like dev->irq. Lots of driver code assumes
this and it has been decreed 'correct'.
Alan
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [patch] x86 supports NO_IRQ convention
2008-06-23 11:28 ` David Brownell
@ 2008-06-23 20:06 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 11+ messages in thread
From: Benjamin Herrenschmidt @ 2008-06-23 20:06 UTC (permalink / raw)
To: David Brownell; +Cc: lkml, Thomas Gleixner, Ingo Molnar, hpa
On Mon, 2008-06-23 at 04:28 -0700, David Brownell wrote:
> On Monday 23 June 2008, Benjamin Herrenschmidt wrote:
> > NO_IRQ on x86 is 0
>
> There is no such #define for it.
> And since zero is used for timer IRQs, it's not invalid.
I'll refer you to past discussions with Linus here. 0 is invalid to
drivers for all intend and purposes.
Cheers,
Ben.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [patch] x86 supports NO_IRQ convention
[not found] ` <fa.EDfpY1oxab2UaliWrUY0jyr5T1k@ifi.uio.no>
@ 2008-06-24 2:20 ` Robert Hancock
2008-06-24 6:39 ` David Brownell
0 siblings, 1 reply; 11+ messages in thread
From: Robert Hancock @ 2008-06-24 2:20 UTC (permalink / raw)
To: David Brownell; +Cc: benh, lkml, Thomas Gleixner, Ingo Molnar, hpa
David Brownell wrote:
> On Monday 23 June 2008, Benjamin Herrenschmidt wrote:
>> NO_IRQ on x86 is 0
>
> There is no such #define for it.
> And since zero is used for timer IRQs, it's not invalid.
As far as drivers are concerned it is. IRQ 0 is only used by
architecture-specific code and is not sharable, so drivers need not be
concerned about it.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [patch] x86 supports NO_IRQ convention
2008-06-24 2:20 ` [patch] x86 supports NO_IRQ convention Robert Hancock
@ 2008-06-24 6:39 ` David Brownell
2008-06-24 9:12 ` Alan Cox
0 siblings, 1 reply; 11+ messages in thread
From: David Brownell @ 2008-06-24 6:39 UTC (permalink / raw)
To: Robert Hancock; +Cc: benh, lkml, Thomas Gleixner, Ingo Molnar, hpa
On Monday 23 June 2008, Robert Hancock wrote:
> IRQ 0 is only used by
> architecture-specific code and is not sharable,
That seems to be the consensus, and it does reflect
how it's used on all architectures I happen to have
seen it in use.
Leaving the question then of what should happen to
the existing NO_IRQ code ... none of the declarations
seems to have a comment "deprecated, don't use this"
and most of the defined values are nonzero.
Some docs appear to be missing.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [patch] x86 supports NO_IRQ convention
2008-06-24 6:39 ` David Brownell
@ 2008-06-24 9:12 ` Alan Cox
0 siblings, 0 replies; 11+ messages in thread
From: Alan Cox @ 2008-06-24 9:12 UTC (permalink / raw)
To: David Brownell
Cc: Robert Hancock, benh, lkml, Thomas Gleixner, Ingo Molnar, hpa
> Leaving the question then of what should happen to
> the existing NO_IRQ code ... none of the declarations
> seems to have a comment "deprecated, don't use this"
> and most of the defined values are nonzero.
Send patches to the arch maintainers in question.
Alan
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2008-06-24 9:30 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <fa.mcHAIQmpGZB1Vrm7ZD4/q9eo08Y@ifi.uio.no>
[not found] ` <fa.E+RvbN2EFmsI1cxQ84PIB8FbX50@ifi.uio.no>
[not found] ` <fa.EDfpY1oxab2UaliWrUY0jyr5T1k@ifi.uio.no>
2008-06-24 2:20 ` [patch] x86 supports NO_IRQ convention Robert Hancock
2008-06-24 6:39 ` David Brownell
2008-06-24 9:12 ` Alan Cox
2008-06-23 2:53 David Brownell
2008-06-23 9:08 ` Alan Cox
2008-06-23 11:29 ` David Brownell
2008-06-23 14:20 ` Alan Cox
2008-06-23 11:34 ` Johannes Stezenbach
2008-06-23 10:42 ` Benjamin Herrenschmidt
2008-06-23 11:28 ` David Brownell
2008-06-23 20:06 ` Benjamin Herrenschmidt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox