Re: [PATCH] restore libata build on frv

David Howells
2006-09-26T17:26:43Z

Linus Torvalds <torvalds@osdl.org> wrote:

> Zero _is_ an appropriate choice, dammit!
> ...
> and then, if your actual _hardware_ things that the bit-pattern with all
> bits clear is a valid irq that can be used for normal devices,

PCI, for example. According to the spec, 0x00 is valid in the Interrupt Line
register and 0xFF indicates unconnected or unset.

> then what you do is you add a irq number translation layer (WHICH WE NEED
> AND HAVE _ANYWAY_) and make sure that nobody sees that on a _software_
> level.

So, by your argument, if you _have_ to have an IRQ translation layer anyway,
then what's the problem with having zero as a valid IRQ and using some other
value to indicate an invalid IRQ? As you say, you have a translation layer
anyway...

That would mean the arch maintainer could make the optimal choice for their
arch - perhaps picking 255 which would be consistent with PCI.

As far as FRV goes, I'm quite happy with 0 as being NO_IRQ, since the 0 bit in
the primary PIC registers is the master switch, not a per-level bit (there are
no source indicators unfortunately).

However, x86, x86_64, and others *do* treat IRQ 0 as being valid, and expose
it to userspace in various ways:

warthog>cat /proc/interrupts
CPU0
0: 287035291 IO-APIC-edge timer
...

So on *that* basis, using IRQ 0 to indicate unset/invalid/etc would seem to be
bad.

David