25 Jul, 2012

2 commits

  • When the map operation fails log the error code we get and add a WARN_ON()
    so we get a backtrace (which should help work out which interrupt is the
    source of the issue).

    Signed-off-by: Mark Brown
    Signed-off-by: Grant Likely

    Mark Brown
     
  • With the current state of irq_domain, the reverse map is always updated
    when new IRQs get mapped. This means that the irq_find_mapping() function
    can be simplified to execute the revmap lookup functions unconditionally

    This patch adds lookup functions for the revmaps that don't yet have one
    and removes the slow path lookup code path.

    v8: Broke out unrelated changes into separate patches. Rebased on Paul's irq
    association patches.
    v7: Rebased to irqdomain/next for v3.4 and applied before the removal of 'hint'
    v6: Remove the slow path entirely. The only place where the slow path
    could get called is for a linear mapping if the hwirq number is larger
    than the linear revmap size. There shouldn't be any interrupt
    controllers that do that.
    v5: rewrite to not use a ->revmap() callback. It is simpler, smaller,
    safer and faster to open code each of the revmap lookups directly into
    irq_find_mapping() via a switch statement.
    v4: Fix build failure on incorrect variable reference.

    Signed-off-by: Grant Likely
    Cc: Benjamin Herrenschmidt
    Cc: Thomas Gleixner
    Cc: Milton Miller
    Cc: Paul Mundt
    Cc: Rob Herring

    Grant Likely
     

11 Jul, 2012

7 commits

  • irq_create_direct_mapping can only be used with the NOMAP type. Make
    the function test to ensure it is passed the correct type of
    irq_domain.

    Signed-off-by: Grant Likely
    Cc: Paul Mundt
    Cc: Benjamin Herrenschmidt
    Cc: Thomas Gleixner
    Cc: Rob Herring

    Grant Likely
     
  • In preparation to remove the slow revmap path, eliminate the public
    radix revmap lookup functions. This simplifies the code and makes the
    slowpath removal patch a lot simpler.

    Signed-off-by: Grant Likely
    Cc: Paul Mundt
    Cc: Benjamin Herrenschmidt
    Cc: Thomas Gleixner
    Cc: Rob Herring

    Grant Likely
     
  • This adds a new strict mapping API for supporting creation of linux IRQs
    at existing positions within the domain. The new routines are as follows:

    For dynamic allocation and insertion to specified ranges:

    - irq_create_identity_mapping()
    - irq_create_strict_mappings()

    These will allocate and associate a range of linux IRQs at the specified
    location. This can be used by controllers that have their own static linux IRQ
    definitions to map a hwirq range to, as well as for platforms that wish to
    establish 1:1 identity mapping between linux and hwirq space.

    For insertion to specified ranges by platforms that do their own irq_desc
    management:

    - irq_domain_associate()
    - irq_domain_associate_many()

    These in turn call back in to the domain's ->map() routine, for further
    processing by the platform. Disassociation of IRQs get handled through
    irq_dispose_mapping() as normal.

    With these in place it should be possible to begin migration of legacy IRQ
    domains to linear ones, without requiring special handling for static vs
    dynamic IRQ definitions in DT vs non-DT paths. This also makes it possible
    for domains with static mappings to adopt whichever tree model best fits
    their needs, rather than simply restricting them to linear revmaps.

    Signed-off-by: Paul Mundt
    [grant.likely: Reorganized irq_domain_associate{,_many} to have all logic in one place]
    [grant.likely: Add error checking for unallocated irq_descs at associate time]
    Signed-off-by: Grant Likely
    Cc: Benjamin Herrenschmidt
    Cc: Thomas Gleixner
    Cc: Rob Herring

    Grant Likely
     
  • At irq_setup_virq() time all of the data needed to update the reverse
    map is available, but the current code ignores it and relies upon the
    slow path to insert revmap records. This patch adds revmap updating
    to the setup path so the slow path will no longer be necessary.

    Signed-off-by: Grant Likely
    Cc: Paul Mundt
    Cc: Benjamin Herrenschmidt
    Cc: Thomas Gleixner
    Cc: Rob Herring

    Grant Likely
     
  • This patch moves the irq disassociation code out into a separate
    function in preparation to extend irq_setup_virq to handle multiple
    irqs and rename it for use by interrupt controller drivers. The new
    function will be used by irq_setup_virq() in its error path.

    Signed-off-by: Grant Likely
    Acked-by: Benjamin Herrenschmidt
    Cc: Paul Mundt
    Cc: Thomas Gleixner
    Cc: Rob Herring

    Grant Likely
     
  • The revmap type should be linear for irq_domain_add_linear function.

    Signed-off-by: Dong Aisheng
    Signed-off-by: Grant Likely

    Dong Aisheng
     
  • A large proportion of interrupt controllers that support legacy mappings
    do so because non-DT systems need to use fixed IRQ numbers when registering
    devices via buses but can otherwise use a linear mapping. The interrupt
    controller itself typically is not affected by the mapping used and best
    practice is to use a linear mapping where possible so drivers frequently
    select at runtime depending on if a legacy range has been allocated to
    them.

    Standardise this behaviour by providing irq_domain_register_simple() which
    will allocate a linear mapping unless a positive first_irq is provided in
    which case it will fall back to a legacy mapping. This helps make best
    practice for irq_domain adoption clearer.

    Signed-off-by: Mark Brown
    Signed-off-by: Grant Likely

    Mark Brown
     

18 Jun, 2012

1 commit


16 Jun, 2012

3 commits

  • Where irq_domain_associate() is called in irq_create_mapping, there is
    no need to test for IRQ_DOMAIN_MAP_LEGACY because it is already tested
    for earlier in the routine.

    Signed-off-by: Grant Likely
    Cc: Paul Mundt
    Cc: Benjamin Herrenschmidt
    Cc: Thomas Gleixner
    Cc: Rob Herring

    Grant Likely
     
  • While common irqdesc allocation is node aware, the irqdomain code is not.

    Presently we observe a number of regressions/inconsistencies on
    NUMA-capable platforms:

    - Platforms using irqdomains with legacy mappings, where the
    irq_descs are allocated node-local and the irqdomain data
    structure is not.

    - Drivers implementing irqdomains will lose node locality
    regardless of the underlying struct device's node id.

    This plugs in NUMA node id proliferation across the various allocation
    callsites by way of_node_to_nid() node lookup. While of_node_to_nid()
    does the right thing for OF-capable platforms it doesn't presently handle
    the non-DT case. This is trivially dealt with by simply wraping in to
    numa_node_id() unconditionally.

    Signed-off-by: Paul Mundt
    Cc: Benjamin Herrenschmidt
    Cc: Thomas Gleixner
    Cc: Rob Herring
    Signed-off-by: Grant Likely

    Paul Mundt
     
  • The pattern (np ? np->full_name : "") is rather common in the
    kernel, but can also make for quite long lines. This patch adds a new
    inline function, of_node_full_name() so that the test for a valid node
    pointer doesn't need to be open coded at all call sites.

    Signed-off-by: Grant Likely
    Cc: Paul Mundt
    Cc: Benjamin Herrenschmidt
    Cc: Thomas Gleixner

    Grant Likely
     

20 May, 2012

5 commits

  • Signed-off-by: Mark Brown
    Signed-off-by: Grant Likely

    Mark Brown
     
  • Convert to pr_fmt before things start to get out of hand and some
    janitors start getting overly excited.

    Signed-off-by: Paul Mundt
    Signed-off-by: Grant Likely

    Paul Mundt
     
  • Presently irq_domain_simple_map() isn't labelled as static, but there's
    no definition for it in the public irqdomain header either. At present
    all in-tree ->map users have meaningful work to do, and all others are
    using irq_domain_simple_ops directly. Make it static for now, as it can
    always be exported and added to the public API later.

    Signed-off-by: Paul Mundt
    Signed-off-by: Grant Likely

    Paul Mundt
     
  • modules making use of irq domains at the very least need access to the
    add/remove/lookup routines, though there's nothing preventing them from
    using the remainder of the public API, either.

    The current set of exports seem primarily geared at DT-enabled platforms
    using DT-backed IRQ domains, where many of the API accesses are hidden
    away in OF code. The non-DT cases need to do most of this on their own.

    Signed-off-by: Paul Mundt
    Signed-off-by: Grant Likely

    Paul Mundt
     
  • Now that IRQ domains are being used by modules it's necessary to support
    removing them, too. This adds a new irq_domain_remove() routine for doing
    the bulk of the heavy lifting. It's left as an exercise to the caller to
    ensure all mappings have been appropriatey disposed of before attempting
    to remove the domain.

    Signed-off-by: Paul Mundt
    Signed-off-by: Grant Likely

    Paul Mundt
     

13 Apr, 2012

1 commit

  • sizeof(void*) returns an unsigned long, but it was being used as a width parameter to a "%-*s" format string which requires an int. On 64 bit platforms this causes a type mismatch:

    linux/kernel/irq/irqdomain.c:575: warning: field width should have type
    'int', but argument 6 has type 'long unsigned int'

    This change casts the size to an int so printf gets the right data type.

    Reported-by: Andreas Schwab
    Signed-off-by: Grant Likely
    Cc: David Daney

    Grant Likely
     

12 Apr, 2012

1 commit

  • This patch replaces the old global setting of irq_virq_count that is only
    used by the NOMAP mapping and instead uses a revmap_data property so that
    the maximum NOMAP allocation can be set per NOMAP irq_domain.

    There is exactly one user of irq_virq_count in-tree right now: PS3.
    Also, irq_virq_count is only useful for the NOMAP mapping. So,
    instead of having a single global irq_virq_count values, this change
    drops it entirely and added a max_irq argument to irq_domain_add_nomap().
    That makes it a property of an individual nomap irq domain instead of
    a global system settting.

    Signed-off-by: Grant Likely
    Tested-by: Benjamin Herrenschmidt
    Cc: Thomas Gleixner
    Cc: Milton Miller

    Grant Likely
     

11 Apr, 2012

2 commits

  • This patch fixes the irq_domain_mapping debugfs output to pad pointer
    values with leading zeros so that pointer values are displayed
    correctly. Otherwise you get output similar to "0x 5e0000000000000".
    Also, when the irq_domain is set to 'null'

    Signed-off-by: Grant Likely
    Cc: David Daney
    Cc: Mika Westerberg

    Grant Likely
     
  • In commit 4bbdd45a (irq_domain/powerpc: eliminate irq_map; use
    irq_alloc_desc() instead) code was added that ignores error returns
    from irq_alloc_desc_from() by (silently) casting the return value to
    unsigned. The negitive value error return now suddenly looks like a
    valid irq number.

    Commits cc79ca69 (irq_domain: Move irq_domain code from powerpc to
    kernel/irq) and 1bc04f2c (irq_domain: Add support for base irq and
    hwirq in legacy mappings) move this code to its current location in
    irqdomain.c

    The result of all of this is a null pointer dereference OOPS if one of
    the error cases is hit.

    The fix: Don't cast away the negativeness of the return value and then
    check for errors.

    Signed-off-by: David Daney
    Acked-by: Rob Herring
    [grant.likely: dropped addition of new 'irq' variable]
    Signed-off-by: Grant Likely

    David Daney
     

30 Mar, 2012

1 commit


25 Feb, 2012

1 commit

  • This patch makes IRQ_DOMAIN usable on MIPS. It uses an ugly workaround
    to preserve current behaviour so that MIPS has time to add irq_domain
    registration to the irq controller drivers. The workaround will be
    removed in Linux v3.6

    Signed-off-by: Grant Likely
    Cc: Ralf Baechle
    Cc: Rob Herring
    Cc: Thomas Gleixner
    Cc: linux-mips@linux-mips.org

    Grant Likely
     

16 Feb, 2012

9 commits

  • Make irq_domain_ops pointer a constant to make it safer for multiple
    instances to share the same ops pointer and change the irq_domain code
    so that it does not modify the ops.

    v4: Fix mismatched type reference in powerpc code

    Signed-off-by: Grant Likely
    Cc: Thomas Gleixner
    Cc: Benjamin Herrenschmidt
    Cc: Milton Miller
    Tested-by: Olof Johansson

    Grant Likely
     
  • Rather than having each interrupt controller driver creating its own barely
    unique .xlate function for irq_domain, create a library of translators which
    any driver can use directly.

    v5: - Remove irq_domain_xlate_pci(). It was incorrect.

    Signed-off-by: Grant Likely
    Cc: Rob Herring
    Cc: Benjamin Herrenschmidt
    Cc: Mark Salter
    Cc: Thomas Gleixner
    Cc: Milton Miller
    Tested-by: Olof Johansson

    Grant Likely
     
  • irq_domain_add_simple() was a stop-gap measure until complete irq_domain
    support was complete. This patch removes the irq_domain_add_simple()
    interface.

    This patch also drops the explicit irq_domain initialization performed
    by the mach-versatile code because the versatile interrupt controller
    already has irq_domain support built into it. This was a bug that was
    hanging around quietly for a while, but with the full irq_domain which
    actually verifies that irq_domain ranges are available it would cause
    the registration to fail and the system wouldn't boot.

    v4: Fixed number of irqs in mx5 gpio code
    v2: Updated to pass in host_data pointer on irq_domain allocation.

    Signed-off-by: Grant Likely
    Cc: Rob Herring
    Cc: Thomas Gleixner
    Cc: Milton Miller
    Cc: Russell King
    Tested-by: Olof Johansson

    Grant Likely
     
  • This patch removes the simplistic implementation of irq_domains and enables
    the powerpc infrastructure for all irq_domain users. The powerpc
    infrastructure includes support for complex mappings between Linux and
    hardware irq numbers, and can manage allocation of irq_descs.

    This patch also converts the few users of irq_domain_add()/irq_domain_del()
    to call irq_domain_add_legacy() instead.

    v3: Fix bug that set up too many irqs in translation range.
    v2: Fix removal of irq_alloc_descs() call in gic driver

    Signed-off-by: Grant Likely
    Cc: Rob Herring
    Cc: Benjamin Herrenschmidt
    Cc: Thomas Gleixner
    Cc: Milton Miller
    Tested-by: Olof Johansson

    Grant Likely
     
  • 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
    Cc: Rob Herring
    Cc: Benjamin Herrenschmidt
    Cc: Thomas Gleixner
    Cc: Milton Miller
    Tested-by: Olof Johansson

    Grant Likely
     
  • Each revmap type has different arguments for setting up the revmap.
    This patch splits up the generator functions so that each revmap type
    can do its own setup and the user doesn't need to keep track of how
    each revmap type handles the arguments.

    This patch also adds a host_data argument to the generators. There are
    cases where the host_data pointer will be needed before the function returns.
    ie. the legacy map calls the .map callback for each irq before returning.

    v2: - Add void *host_data argument to irq_domain_add_*() functions
    - fixed failure to compile
    - Moved IRQ_DOMAIN_MAP_* defines into irqdomain.c

    Signed-off-by: Grant Likely
    Cc: Rob Herring
    Cc: Benjamin Herrenschmidt
    Cc: Thomas Gleixner
    Cc: Milton Miller
    Tested-by: Olof Johansson

    Grant Likely
     
  • No functional changes. Replaces non-exported references to 'host' with domain.
    Does not change any symbol names referenced by other .c files.

    Signed-off-by: Grant Likely
    Cc: Benjamin Herrenschmidt
    Cc: Thomas Gleixner
    Cc: Milton Miller
    Tested-by: Olof Johansson

    Grant Likely
     
  • zero always means no irq when using irq domains. Get rid of the NO_IRQ
    references.

    Signed-off-by: Grant Likely
    Cc: Rob Herring
    Cc: Benjamin Herrenschmidt
    Cc: Thomas Gleixner
    Cc: Milton Miller
    Tested-by: Olof Johansson

    Grant Likely
     
  • This patch only moves the code. It doesn't make any changes, and the
    code is still only compiled for powerpc. Follow-on patches will generalize
    the code for other architectures.

    Signed-off-by: Grant Likely
    Cc: Benjamin Herrenschmidt
    Cc: Thomas Gleixner
    Cc: Milton Miller
    Tested-by: Olof Johansson

    Grant Likely
     

15 Feb, 2012

2 commits

  • Part of the series to unify the irq remapping mechanisms in the
    kernel. A follow up patch will copy the powerpc implementation into
    kernel/irq/irqdomain.c, which will be a lot easier if the structures
    are identical.

    Where they differ, I've chose to use the powerpc names since there is
    a lot more code using those names.

    Signed-off-by: Grant Likely
    Cc: Rob Herring
    Cc: Benjamin Herrenschmidt
    Cc: Thomas Gleixner
    Cc: Milton Miller
    Tested-by: Olof Johansson

    Grant Likely
     
  • irq_domain printk's too much. Drop some output.

    Signed-off-by: Grant Likely
    Cc: Rob Herring
    Cc: Thomas Gleixner
    Tested-by: Olof Johansson

    Grant Likely
     

08 Jan, 2012

1 commit

  • devicetree/next changes queued for v3.3 merge window

    * tag 'devicetree-for-linus-20120104' of git://git.secretlab.ca/git/linux-2.6:
    ARM: prom.h: Fix build error by removing unneeded header file
    irq: check domain hwirq range for DT translate
    dt: add empty of_get_node/of_put_node functions
    of/pdt: fix section mismatch warning
    i2c-designware: add OF binding support
    dt/i2c: Enumerate some of the known trivial i2c devices
    dt: reform for_each_property to for_each_property_of_node
    ARM/of: allow *machine_desc.dt_compat to be const
    of/base: Take NULL string into account for property with multiple strings
    OF/device-tree: Add some entries to vendor-prefixes.txt

    Fix up trivial add-add conflicts in include/linux/of.h

    Linus Torvalds
     

28 Dec, 2011

1 commit


24 Dec, 2011

1 commit

  • irqdomain support is used in interrupt controller drivers that may not
    have device tree support but only need the basic HW->Linux irq
    translation. Rather than having each of these implement their own IRQ
    domain, allow them to use the simple ops.

    Acked-by: Thomas Gleixner
    Acked-by: Rob Herring
    Cc: Grant Likely
    Signed-off-by: Jamie Iles
    Signed-off-by: Russell King

    Jamie Iles
     

31 Oct, 2011

1 commit

  • Interrupt controllers can have non-zero starting value for h/w irq numbers.
    Adding support in irq_domain allows the domain hwirq numbering to match
    the interrupt controllers' numbering.

    As this makes looping over irqs for a domain more complicated, add loop
    iterators to iterate over all hwirqs and irqs for a domain.

    Signed-off-by: Rob Herring
    Reviewed-by: Jamie Iles
    Tested-by: Thomas Abraham
    Acked-by: Grant Likely
    Acked-by: Thomas Gleixner

    Rob Herring
     

20 Sep, 2011

1 commit

  • The sanity check in irq_domain_add() tests desc->irq_data != NULL or
    irq_data->domain != NULL. This prevents adding an irq_domain to a irq
    descriptor when irq_data exists, which true when the irq descriptor
    exists.

    This went unnoticed so far as the simple domain code did not enter
    this code path because domain->nr_irqs is always 0 for the simple domains.

    Split the check for irq_data == NULL out and have a separate warning
    for it.

    [ tglx: Made the check for irq_data == NULL separate ]

    Signed-off-by: Rob Herring
    Cc: Grant Likely
    Cc: marc.zyngier@arm.com
    Cc: thomas.abraham@linaro.org
    Cc: jamie@jamieiles.com
    Cc: b-cousson@ti.com
    Cc: shawn.guo@linaro.org
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: devicetree-discuss@lists.ozlabs.org
    Link: http://lkml.kernel.org/r/1316017900-19918-3-git-send-email-robherring2@gmail.com
    Signed-off-by: Thomas Gleixner

    Rob Herring