Subject: Re: ARCH=ppc -> ARCH=powerpc : help needed for dts file

From: Benjamin Herrenschmidt <[email-masked]>
Date: Fri, 07 Mar 2008 11:19:57 +1100

On Fri, 2008-03-07 at 01:10 +0100, Philippe De Muyter wrote:
> 
> But I already noticed that the interrupt numbers that the arch/powerpc tree
> uses for the parts that do already work (compact-flash and serials) are
> different from the ones I saw on the running arch/ppc tree.  e.g.,
> the serial lines used irq 26 with the arch/ppc tree and now use 42 with
> the powerpc tree.  For the pci4520, irqs changed from 53, 54 and 55 in the
> arch/ppc kernel to 17, 18 and 19 with the arch/powerpc kernel.
> That's a little bit confusing.
> 
> There must be something hidden in the sources of the openpic driver to
> explain that difference.  Could it be fixed by a setting in the dts-file ?

The interrupt numbers that you see in /proc/interrupts and that drivers
see are "virtual". They have no direct relationship to the hardware
interrupt lines (well, the kernel attempts sometimes at keeping them the
same but not always).

Basially, when the kernel establishes interrupt routing when probing
devices, it gets dynamically assigned numbers and that's what drivers
and /proc/interrupts will see, and internally "binds" them to a given HW
source on a given interrupt controller.

This is done for several reasons, the main ones being that we have to
routinely deal with multiple controllers each having it's own hardware
number space, some systems have very large HW interrupt numbers not
suitable for the irq_desc array, and we reserve virtual numbers 0 as
always invalid and 1...15 for an ISA-type 8259 controller to avoid
problems with x86-oirignated legacy junk that tries to hard code those
numbers. 

There's an compile option to see the mapping between virtual numbers and
HW numbers in debugfs, try enabling debugfs, CONFIG_VIRQ_DEBUG, and
mount debugfs somewhere. You'll see a powerpc/virq_mapping file in there
with the mapping.

Ben.