1. 13 6月, 2016 2 次提交
    • J
      irqdomain: Don't set type when mapping an IRQ · 1e2a7d78
      Jon Hunter 提交于
      Some IRQ chips, such as GPIO controllers or secondary level interrupt
      controllers, may require require additional runtime power management
      control to ensure they are accessible. For such IRQ chips, it makes sense
      to enable the IRQ chip when interrupts are requested and disabled them
      again once all interrupts have been freed.
      
      When mapping an IRQ, the IRQ type settings are read and then programmed.
      The mapping of the IRQ happens before the IRQ is requested and so the
      programming of the type settings occurs before the IRQ is requested. This
      is a problem for IRQ chips that require additional power management
      control because they may not be accessible yet. Therefore, when mapping
      the IRQ, don't program the type settings, just save them and then program
      these saved settings when the IRQ is requested (so long as if they are not
      overridden via the call to request the IRQ).
      
      Add a stub function for irq_domain_free_irqs() to avoid any compilation
      errors when CONFIG_IRQ_DOMAIN_HIERARCHY is not selected.
      Signed-off-by: NJon Hunter <jonathanh@nvidia.com>
      Reviewed-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      1e2a7d78
    • J
      irqdomain: Fix handling of type settings for existing mappings · b62b2cf5
      Jon Hunter 提交于
      When mapping an IRQ, it is possible that a mapping for the IRQ already
      exists. If mapping does exist then there are the following issues with
      regard to the handling of the IRQ type settings ...
      1. If the domain is part of a hierarchy, then:
         a. We do not check that the type settings for the existing mapping
            match those of the new mapping.
         b. We do not check to see if the type settings have been programmed
            yet (and they might not have been) and so we may never set the
            type.
      2. If the domain is NOT part of a hierarchy, we will overwrite the
         current type settings programmed if they are different from the
         previous mapping. Please note that irq_create_mapping()
         calls irq_find_mapping() to check if a mapping already exists.
      
      Although, it may be unlikely that the type settings for a shared
      interrupt would not match, nonetheless we should check for this.
      Therefore, to fix this check if a mapping exists (regardless of whether
      the domain is part of a hierarchy or not) and if it does then:
      1. Return the IRQ number if the type settings match or are not
         specified.
      2. Program the type settings and return the IRQ number if the type
         settings have not been programmed yet.
      3. Otherwise if the type setting do not match, then print a warning
         and don't return the IRQ number.
      
      Furthermore, add a warning if the type return by irq_domain_translate()
      has bits outside the sense mask set and then clear these bits. If these
      bits are not cleared then this will cause the comparision of the type
      settings for an existing mapping to fail with that of the new mapping
      even if the sense bit themselves match. The reason being is that the
      existing type settings are read by calling irq_get_trigger_type() which
      will clear any bits outside the sense mask. This will allow us to detect
      irqchips that are not correctly clearing these bits and fix them.
      Signed-off-by: NJon Hunter <jonathanh@nvidia.com>
      Reviewed-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      b62b2cf5
  2. 21 5月, 2016 1 次提交
    • M
      radix-tree: introduce radix_tree_empty · e9256efc
      Matthew Wilcox 提交于
      Commit e6145236 ("radix_tree: add support for multi-order entries")
      left the impression that the support for multiorder radix tree entries
      was functional.  As soon as Ross tried to use it, it became apparent
      that my testing was completely inadequate, and it didn't even work a
      little bit for orders that were not a multiple of shift.
      
      This series of patches is the result of about 6 weeks of redesign,
      reimplementation, testing, arguing and hair-pulling.  The great news is
      that the test-suite is now far better than it was.  That's reflected in
      the diffstat for the test-suite alone:
      
       12 files changed, 436 insertions(+), 28 deletions(-)
      
      The highlight for users of the tree is that the restriction on the order
      of inserted entries being >= RADIX_TREE_MAP_SHIFT is now gone; the radix
      tree now supports any order between 0 and 64.
      
      For those who are interested in how the tree works, patch 9 is probably
      the most interesting one as it introduces the new machinery for handling
      sibling entries.
      
      I've tried to be fair in attributing authorship to the person who
      contributed the majority of the code in each patch; Ross has been an
      invaluable partner in the development of this support and it's fair to
      say that each of us has code in every commit.
      
      I should also express my appreciation of the 0day testing.  It prompted
      me that I was bloating the tinyconfig in an unacceptable way, and it
      bisected to a commit which contained a rather nasty memory-corruption
      bug.
      
      This patch (of 29):
      
      The irqdomain code was checking for 0 or 1 entries, not 0 entries like
      the comment said they were.  Introduce a new helper that will actually
      check for an empty tree.
      Signed-off-by: NMatthew Wilcox <willy@linux.intel.com>
      Reviewed-by: NRoss Zwisler <ross.zwisler@linux.intel.com>
      Reviewed-by: NJan Kara <jack@suse.cz>
      Cc: Konstantin Khlebnikov <koct9i@gmail.com>
      Cc: Kirill Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Neil Brown <neilb@suse.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e9256efc
  3. 02 5月, 2016 1 次提交
    • M
      irqdomain: Allow domain matching on irq_fwspec · 651e8b54
      Marc Zyngier 提交于
      When iterating over the irq domain list, we try to match a domain
      either by calling a match() function or by comparing a number
      of fields passed as parameters.
      
      Both approaches are a bit restrictive:
      - match() is DT specific and only takes a device node
      - the fallback case only deals with the fwnode_handle
      
      It would be useful if we had a per-domain function that would
      actually perform the matching check on the whole of the
      irq_fwspec structure. This would allow for a domain to triage
      matching attempts that need to extend beyond the fwnode.
      
      Let's introduce irq_find_matching_fwspec(), which takes a full
      blown irq_fwspec structure, and call into a select() function
      implemented by the irqdomain. irq_find_matching_fwnode() is
      made a wrapper around irq_find_matching_fwspec in order to
      preserve compatibility.
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: devicetree@vger.kernel.org
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Rob Herring <robh+dt@kernel.org>
      Link: http://lkml.kernel.org/r/1460365075-7316-2-git-send-email-marc.zyngier@arm.comSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      651e8b54
  4. 31 3月, 2016 1 次提交
  5. 10 3月, 2016 1 次提交
  6. 25 2月, 2016 1 次提交
  7. 26 1月, 2016 1 次提交
    • M
      irqdomain: Allow domain lookup with DOMAIN_BUS_WIRED token · 530cbe10
      Marc Zyngier 提交于
      Let's take the (outlandish) example of an interrupt controller
      capable of handling both wired interrupts and PCI MSIs.
      
      With the current code, the PCI MSI domain is going to be tagged
      with DOMAIN_BUS_PCI_MSI, and the wired domain with DOMAIN_BUS_ANY.
      
      Things get hairy when we start looking up the domain for a wired
      interrupt (typically when creating it based on some firmware
      information - DT or ACPI).
      
      In irq_create_fwspec_mapping(), we perform the lookup using
      DOMAIN_BUS_ANY, which is actually used as a wildcard. This gives
      us one chance out of two to end up with the wrong domain, and
      we try to configure a wired interrupt with the MSI domain.
      Everything grinds to a halt pretty quickly.
      
      What we really need to do is to start looking for a domain that
      would uniquely identify a wired interrupt domain, and only use
      DOMAIN_BUS_ANY as a fallback.
      
      In order to solve this, let's introduce a new DOMAIN_BUS_WIRED
      token, which is going to be used exactly as described above.
      Of course, this depends on the irqchip to setup the domain
      bus_token, and nobody had to implement this so far.
      
      Only so far.
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Frank Rowand <frowand.list@gmail.com>
      Cc: Grant Likely <grant.likely@linaro.org>
      Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Cc: Jiang Liu <jiang.liu@linux.intel.com>
      Link: http://lkml.kernel.org/r/1453816347-32720-2-git-send-email-marc.zyngier@arm.comSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      530cbe10
  8. 16 1月, 2016 1 次提交
  9. 21 12月, 2015 1 次提交
  10. 20 12月, 2015 1 次提交
  11. 16 12月, 2015 1 次提交
  12. 14 10月, 2015 8 次提交
  13. 16 9月, 2015 1 次提交
  14. 30 7月, 2015 1 次提交
    • M
      genirq/irqdomain: Allow irq domain aliasing · ad3aedfb
      Marc Zyngier 提交于
      It is not uncommon (at least with the ARM stuff) to have a piece
      of hardware that implements different flavours of "interrupts".
      A typical example of this is the GICv3 ITS, which implements
      standard PCI/MSI support, but also some form of "generic MSI".
      
      So far, the PCI/MSI domain is registered using the ITS device_node,
      so that irq_find_host can return it. On the contrary, the raw MSI
      domain is not registered with an device_node, making it impossible
      to be looked up by another subsystem (obviously, using the same
      device_node twice would only result in confusion, as it is not
      defined which one irq_find_host would return).
      
      A solution to this is to "type" domains that may be aliasing, and
      to be able to lookup an device_node that matches a given type.
      For this, we introduce irq_find_matching_host() as a superset
      of irq_find_host:
      
      struct irq_domain *irq_find_matching_host(struct device_node *node,
                                      enum irq_domain_bus_token bus_token);
      
      where bus_token is the "type" we want to match the domain against
      (so far, only DOMAIN_BUS_ANY is defined). This result in some
      moderately invasive changes on the PPC side (which is the only
      user of the .match method).
      
      This has otherwise no functionnal change.
      Reviewed-by: NHanjun Guo <hanjun.guo@linaro.org>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Cc: <linux-arm-kernel@lists.infradead.org>
      Cc: Yijing Wang <wangyijing@huawei.com>
      Cc: Ma Jun <majun258@huawei.com>
      Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Cc: Duc Dang <dhdang@apm.com>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Jiang Liu <jiang.liu@linux.intel.com>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Link: http://lkml.kernel.org/r/1438091186-10244-2-git-send-email-marc.zyngier@arm.comSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      ad3aedfb
  15. 12 6月, 2015 2 次提交
  16. 18 5月, 2015 1 次提交
  17. 23 11月, 2014 5 次提交
    • J
      irqdomain: Introduce helper function irq_domain_add_hierarchy() · afb7da83
      Jiang Liu 提交于
      Introduce helper function irq_domain_add_hierarchy(), which creates
      a linear irqdomain if parameter 'size' is not zero, otherwise creates
      a tree irqdomain.
      Signed-off-by: NJiang Liu <jiang.liu@linux.intel.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Grant Likely <grant.likely@linaro.org>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Yijing Wang <wangyijing@huawei.com>
      Cc: Yingjoe Chen <yingjoe.chen@mediatek.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Matthias Brugger <matthias.bgg@gmail.com>
      Link: http://lkml.kernel.org/r/1416061447-9472-5-git-send-email-jiang.liu@linux.intel.comSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      afb7da83
    • J
      irqdomain: Implement a method to automatically call parent domains alloc/free · 36d72731
      Jiang Liu 提交于
      Add a flags to irq_domain.flags to control whether the irqdomain core
      should automatically call parent irqdomain's alloc/free callbacks. It
      help to reduce hierarchy irqdomains users' code size.
      Signed-off-by: NJiang Liu <jiang.liu@linux.intel.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Grant Likely <grant.likely@linaro.org>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Yijing Wang <wangyijing@huawei.com>
      Cc: Yingjoe Chen <yingjoe.chen@mediatek.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Matthias Brugger <matthias.bgg@gmail.com>
      Link: http://lkml.kernel.org/r/1416061447-9472-4-git-send-email-jiang.liu@linux.intel.comSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      36d72731
    • J
      genirq: Introduce helper irq_domain_set_info() to reduce duplicated code · 1b537708
      Jiang Liu 提交于
      Signed-off-by: NJiang Liu <jiang.liu@linux.intel.com>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Grant Likely <grant.likely@linaro.org>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Yingjoe Chen <yingjoe.chen@mediatek.com>
      Cc: Yijing Wang <wangyijing@huawei.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      1b537708
    • Y
      irqdomain: Do irq_find_mapping and set_type for hierarchy irqdomain in case OF · 0cc01aba
      Yingjoe Chen 提交于
      It is possible to call irq_create_of_mapping to create/translate the
      same IRQ from DT for multiple times. Perform irq_find_mapping check
      and set_type for hierarchy irqdomain in irq_create_of_mapping() to
      avoid duplicate these functionality in all outer most irqdomain.
      Signed-off-by: NYingjoe Chen <yingjoe.chen@mediatek.com>
      Signed-off-by: NJiang Liu <jiang.liu@linux.intel.com>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Grant Likely <grant.likely@linaro.org>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Yingjoe Chen <yingjoe.chen@mediatek.com>
      Cc: Yijing Wang <wangyijing@huawei.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      0cc01aba
    • J
      irqdomain: Introduce new interfaces to support hierarchy irqdomains · f8264e34
      Jiang Liu 提交于
      We plan to use hierarchy irqdomain to suppport CPU vector assignment,
      interrupt remapping controller, IO-APIC controller, MSI interrupt
      and hypertransport interrupt etc on x86 platforms. So extend irqdomain
      interfaces to support hierarchy irqdomain.
      
      There are already many clients of current irqdomain interfaces.
      To minimize the changes, we choose to introduce new version 2 interfaces
      to support hierarchy instead of extending existing irqdomain interfaces.
      
      According to Thomas's suggestion, the most important design decision is
      to build hierarchy struct irq_data to support hierarchy irqdomain, so
      hierarchy irqdomain related data could be saved in struct irq_data.
      With support of hierarchy irq_data, we could also support stacked
      irq_chips. This is most useful in case of set_affinity().
      
      The new hierarchy irqdomain introduces following interfaces:
      1) irq_domain_alloc_irqs()/irq_domain_free_irqs(): allocate/release IRQ
         and related resources.
      2) __irq_domain_alloc_irqs(): a special version to support legacy IRQs.
      3) irq_domain_activate_irq()/irq_domain_deactivate_irq(): program
         interrupt controllers to activate/deactivate interrupt.
      
      There are also several help functions to ease irqdomain implemenations:
      1) irq_domain_get_irq_data(): get irq_data associated with a specific
         irqdomain.
      2) irq_domain_set_hwirq_and_chip(): save irqdomain specific data into
         irq_data.
      3) irq_domain_alloc_irqs_parent()/irq_domain_free_irqs_parent(): invoke
         parent irqdomain's alloc/free callbacks.
      
      We also changed irq_startup()/irq_shutdown() to invoke
      irq_domain_activate_irq()/irq_domain_deactivate_irq() to program
      interrupt controller when start/stop interrupts.
      
      [ tglx: Folded parts of the later patch series in ]
      Signed-off-by: NJiang Liu <jiang.liu@linux.intel.com>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Grant Likely <grant.likely@linaro.org>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Yingjoe Chen <yingjoe.chen@mediatek.com>
      Cc: Yijing Wang <wangyijing@huawei.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      f8264e34
  18. 22 6月, 2014 1 次提交
  19. 27 5月, 2014 1 次提交
  20. 27 2月, 2014 1 次提交
  21. 24 10月, 2013 1 次提交
  22. 25 6月, 2013 1 次提交
  23. 24 6月, 2013 4 次提交
    • K
      irq: fix checkpatch error · 798f0fd1
      Kefeng Wang 提交于
      ERROR: space required before the open parenthesis '('
      WARNING: Prefer pr_warn(... to pr_warning(...
      Just fix above 2 issue.
      Signed-off-by: NKefeng Wang <wangkefeng.wang@huawei.com>
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      798f0fd1
    • G
      irqdomain: make irq_linear_revmap() a fast path again · d3dcb436
      Grant Likely 提交于
      Over the years, irq_linear_revmap() gained tests and checks to make sure
      callers were using it safely, which while important, also make it less
      of a fast path. After the irqdomain refactoring done recently, it is now
      possible to make irq_linear_revmap() a fast path again. This patch moves
      irq_linear_revmap() to the header file and makes it a static inline so
      that interrupt controller drivers using a linear mapping can decode the
      virq from a hwirq in just a couple of instructions.
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      d3dcb436
    • G
      irqdomain: remove irq_domain_generate_simple() · 56a3d5ac
      Grant Likely 提交于
      Nobody calls it; remove the function
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      56a3d5ac
    • G
      irqdomain: Refactor irq_domain_associate_many() · ddaf144c
      Grant Likely 提交于
      Originally, irq_domain_associate_many() was designed to unwind the
      mapped irqs on a failure of any individual association. However, that
      proved to be a problem with certain IRQ controllers. Some of them only
      support a subset of irqs, and will fail when attempting to map a
      reserved IRQ. In those cases we want to map as many IRQs as possible, so
      instead it is better for irq_domain_associate_many() to make a
      best-effort attempt to map irqs, but not fail if any or all of them
      don't succeed. If a caller really cares about how many irqs got
      associated, then it should instead go back and check that all of the
      irqs is cares about were mapped.
      
      The original design open-coded the individual association code into the
      body of irq_domain_associate_many(), but with no longer needing to
      unwind associations, the code becomes simpler to split out
      irq_domain_associate() to contain the bulk of the logic, and
      irq_domain_associate_many() to be a simple loop wrapper.
      
      This patch also adds a new error check to the associate path to make
      sure it isn't called for an irq larger than the controller can handle,
      and adds locking so that the irq_domain_mutex is held while setting up a
      new association.
      
      v3: Fixup missing change to irq_domain_add_tree()
      v2: Fixup x86 warning. irq_domain_associate_many() no longer returns an
          error code, but reports errors to the printk log directly. In the
          majority of cases we don't actually want to fail if there is a
          problem, but rather log it and still try to boot the system.
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      
      irqdomain: Fix flubbed irq_domain_associate_many refactoring
      
      commit d39046ec72, "irqdomain: Refactor irq_domain_associate_many()" was
      missing the following hunk which causes a boot failure on anything using
      irq_domain_add_tree() to allocate an irq domain.
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      Cc: Michael Neuling <mikey@neuling.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
      Cc: Thomas Gleixner <tglx@linutronix.de>,
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      ddaf144c
  24. 18 6月, 2013 1 次提交