lkml.org 
[lkml]   [2012]   [Jan]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [RFC 12/14] irq_domain: Add support for base irq and hwirq in legacy mappings
    On 01/11/2012 02:22 PM, Grant Likely wrote:
    > Add support for a legacy mapping where irq = (hwirq - first_hwirq + first_irq)
    > so that a controller driver can allocate a fixed range of irq_descs and use
    > a simple calculation to translate back and forth between linux and hw irq
    > numbers. This is needed to use an irq_domain with many of the ARM interrupt
    > controller drivers that manage their own irq_desc allocations. Ultimately
    > the goal is to migrate those drivers to use the linear revmap, but doing it
    > this way allows each driver to be converted separately which makes the
    > migration path easier.
    >
    > This patch generalizes the IRQ_DOMAIN_MAP_LEGACY method to use
    > (first_irq-first_hwirq) as the offset between hwirq and linux irq number,
    > and adds checks to make sure that the hwirq number does not exceed range
    > assigned to the controller.
    >
    > Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
    > Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
    > ---
    > arch/powerpc/include/asm/irq.h | 3 -
    > arch/powerpc/sysdev/i8259.c | 2 +-
    > arch/powerpc/sysdev/tsi108_pci.c | 2 +-
    > include/linux/irqdomain.h | 20 +++++++++-
    > kernel/irq/irqdomain.c | 78 +++++++++++++++++++++++++-------------
    > 5 files changed, 73 insertions(+), 32 deletions(-)
    >

    snip...

    > @@ -454,8 +477,11 @@ unsigned int irq_find_mapping(struct irq_domain *domain,
    > return 0;
    >
    > /* legacy -> bail early */
    > - if (domain->revmap_type == IRQ_DOMAIN_MAP_LEGACY)
    > - return hwirq;
    > + if (domain->revmap_type == IRQ_DOMAIN_MAP_LEGACY) {
    > + if (hwirq > domain->revmap_data.legacy.size)
    > + return 0;
    > + return domain->revmap_data.legacy.first_irq + hwirq;

    This needs a "- domain->revmap_data.legacy.first_hwirq"

    Rob

    > + }
    >
    > /* Slow path does a linear search of the map */
    > if (hint < NUM_ISA_INTERRUPTS)


    \
     
     \ /
      Last update: 2012-01-13 01:39    [W:0.025 / U:0.568 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site