Re: [RFC] killing the NR_IRQS arrays.



On Friday 16 February 2007 13:10, Eric W. Biederman wrote:
To do this I believe will require a s/unsigned int irq/struct irq_desc *irq/
throughout the entire kernel.  Getting the arch specific code and the
generic kernel infrastructure fixed and ready for that change looks
like a pain but pretty doable.

We did something like this a few years back on the s390 architecture, which
happens to be lucky enough not to share any interrupt based drivers with
any of the other architectures.

It helped a lot on s390, and I think the change will be beneficial on others
as well, e.g. powerpc already uses 'virtual' interrupt numbers to collapse
the large (sparse) range of interrupt numbers into 512 unique numbers. This
could easily be avoided if there was simply an array of irq_desc structures
per interrupt controller.

However, I also think we should maintain the old interface, and introduce
a new one to deal only with those cases that benefit from it (MSI, Xen,
powerpc VIO, ...). This means one subsystem can be converted at a time.

I don't think there is a point converting the legacy ISA interrupts to
a different interface, as the concept of IRQ numbers is part of the
subsystem itself (if you want to call ISA a subsystem...).

For PCI, it makes a lot more sense to use something else, considering
that PCI interrupts are defined as 'pins' instead of 'lines', and
while an interrupt pin is defined per slot, while the line is per
bus, in a system with multiple PCI buses, the line is still not
necessarily unique.

One interface I could imagine for PCI devices would be

/* generic functions */
int request_irq_desc(struct irq_desc *desc, irq_handler_t handler,
unsigned long irqflags, const char *devname, void *dev_id);
int free_irq_desc(struct irq_desc *desc, void *dev_id);

/* legacy functions */
int request_irq(int irq, irq_handler_t handler,
unsigned long irqflags, const char *devname, void *dev_id)
{
return request_irq_desc(lookup_irq_desc(irq), handler, irqflags,
devname, dev_id);
}
int free_irq(int irq, void *dev_id)
{
return free_irq_desc(lookup_irq_desc(irq), dev_id);
}

/* pci specific */
struct irq_desc *pci_request_irq(struct pci_device *dev, int pin,
irq_handler_t handler)
{
struct irq_desc *desc = pci_lookup_irq(dev, pin);
int ret;

if (!desc)
return NULL;

ret = request_irq_desc(desc, handler, IRQF_SHARED,
&dev->dev.bus_id, dev);
if (ret < 0)
return NULL;
return desc;
}
int pci_free_irq(struct pci_device *dev, int pin)
{
return free_irq_desc(pci_lookup_irq(dev, pin), dev);
}

Now I don't know enough about MSI yet, but I could imagine
that something along these lines would work as well, and we
could simply require all drivers that want to support MSI
to use the new interfaces.

Arnd <><
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: can someone explain...[ PCI interrupts]
    ... interrupts for PCI devices are roughly split up into two categories: INTx interrupt lines and MSI interrupts. ... Each processor contains a local APIC that can receive messages from other APICs and send messages to other local APICs. ... Basically, an IRQ value is a cookie useful for binding a device interrupt tuple or an ISA IRQ) to a x86 interrupt tuple. ...
    (freebsd-current)
  • Re: [spi-devel-general] Accelerometer, Gyros and ADCs etc within the kernel.
    ... Whilst input subsystem is probably the only place that these sorts ... The minimum needed seems to be a control interface to configure the devices ... it off and free the relevant interrupt, or b) simply free the relevant interrupt ... The device itself has a ring buffer. ...
    (Linux-Kernel)
  • 2.6.17-rc3 "Bus #03 (-#06) is hidden behind transparent bridge"
    ... PCI: PCI BIOS revision 2.10 entry at 0xf031f, ... ACPI: Interpreter enabled ... Using PIC for interrupt routing ... Using APIC driver default ...
    (Linux-Kernel)
  • Re: wont work: 2.6.0 && SiI 3112 SATA
    ... PCI: PCI BIOS revision 2.10 entry at 0xf0031, ... PCI: Found IRQ 10 for device 0000:00:1f.1 ... hde: lost interrupt ...
    (Linux-Kernel)
  • Re: Thinkpad X31 und CF-Card-Reader
    ... ACPI: bus type pci registered ... Embedded Controller interrupt mode. ... hde: ... ide: failed opcode was: unknown ...
    (de.comp.os.unix.linux.hardware)