1. 07 7月, 2017 2 次提交
  2. 23 6月, 2017 5 次提交
    • M
      genirq/irqdomain: Remove auto-recursive hierarchy support · 6a6544e5
      Marc Zyngier 提交于
      It did seem like a good idea at the time, but it never really
      caught on, and auto-recursive domains remain unused 3 years after
      having been introduced.
      
      Oh well, time for a late spring cleanup.
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      6a6544e5
    • M
      genirq/irqdomain: Add irq_domain_update_bus_token helper · 61d0a000
      Marc Zyngier 提交于
      We can have irq domains that are identified by the same fwnode
      (because they are serviced by the same HW), and yet have different
      functionnality (because they serve different busses, for example).
      This is what we use the bus_token field.
      
      Since we don't use this field when generating the domain name,
      all the aliasing domains will get the same name, and the debugfs
      file creation fails. Also, bus_token is updated by individual drivers,
      and the core code is unaware of that update.
      
      In order to sort this mess, let's introduce a helper that takes care
      of updating bus_token, and regenerate the debugfs file.
      
      A separate patch will update all the individual users.
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      61d0a000
    • T
      genirq/debugfs: Add proper debugfs interface · 087cdfb6
      Thomas Gleixner 提交于
      Debugging (hierarchical) interupt domains is tedious as there is no
      information about the hierarchy and no information about states of
      interrupts in the various domain levels.
      
      Add a debugfs directory 'irq' and subdirectories 'domains' and 'irqs'.
      
      The domains directory contains the domain files. The content is information
      about the domain. If the domain is part of a hierarchy then the parent
      domains are printed as well.
      
      # ls /sys/kernel/debug/irq/domains/
      default     INTEL-IR-2	    INTEL-IR-MSI-2  IO-APIC-IR-2  PCI-MSI
      DMAR-MSI    INTEL-IR-3	    INTEL-IR-MSI-3  IO-APIC-IR-3  unknown-1
      INTEL-IR-0  INTEL-IR-MSI-0  IO-APIC-IR-0    IO-APIC-IR-4  VECTOR
      INTEL-IR-1  INTEL-IR-MSI-1  IO-APIC-IR-1    PCI-HT
      
      # cat /sys/kernel/debug/irq/domains/VECTOR 
      name:   VECTOR
       size:   0
       mapped: 216
       flags:  0x00000041
      
      # cat /sys/kernel/debug/irq/domains/IO-APIC-IR-0 
      name:   IO-APIC-IR-0
       size:   24
       mapped: 19
       flags:  0x00000041
       parent: INTEL-IR-3
          name:   INTEL-IR-3
           size:   65536
           mapped: 167
           flags:  0x00000041
           parent: VECTOR
              name:   VECTOR
               size:   0
               mapped: 216
               flags:  0x00000041
      
      Unfortunately there is no per cpu information about the VECTOR domain (yet).
      
      The irqs directory contains detailed information about mapped interrupts.
      
      # cat /sys/kernel/debug/irq/irqs/3
      handler:  handle_edge_irq
      status:   0x00004000
      istate:   0x00000000
      ddepth:   1
      wdepth:   0
      dstate:   0x01018000
                  IRQD_IRQ_DISABLED
                  IRQD_SINGLE_TARGET
                  IRQD_MOVE_PCNTXT
      node:     0
      affinity: 0-143
      effectiv: 0
      pending:  
      domain:  IO-APIC-IR-0
       hwirq:   0x3
       chip:    IR-IO-APIC
        flags:   0x10
                   IRQCHIP_SKIP_SET_WAKE
       parent:
          domain:  INTEL-IR-3
           hwirq:   0x20000
           chip:    INTEL-IR
            flags:   0x0
           parent:
              domain:  VECTOR
               hwirq:   0x3
               chip:    APIC
                flags:   0x0
      
      This was developed to simplify the debugging of the managed affinity
      changes.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Acked-by: NMarc Zyngier <marc.zyngier@arm.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Keith Busch <keith.busch@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Christoph Hellwig <hch@lst.de>
      Link: http://lkml.kernel.org/r/20170619235444.537566163@linutronix.deSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      087cdfb6
    • T
      genirq/irqdomain: Add map counter · 9dc6be3d
      Thomas Gleixner 提交于
      Add a map counter instead of counting radix tree entries for
      diagnosis. That also gives correct information for linear domains.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Acked-by: NMarc Zyngier <marc.zyngier@arm.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Keith Busch <keith.busch@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Christoph Hellwig <hch@lst.de>
      Link: http://lkml.kernel.org/r/20170619235444.459397746@linutronix.de
      9dc6be3d
    • T
      genirq: Allow fwnode to carry name information only · d59f6617
      Thomas Gleixner 提交于
      In order to provide proper debug interface it's required to have domain
      names available when the domain is added. Non fwnode based architectures
      like x86 have no way to do so.
      
      It's not possible to use domain ops or host data for this as domain ops
      might be the same for several instances, but the names have to be unique.
      
      Extend the irqchip fwnode to allow transporting the domain name. If no node
      is supplied, create a 'unknown-N' placeholder.
      
      Warn if an invalid node is supplied and treat it like no node. This happens
      e.g. with i2 devices on x86 which hand in an ACPI type node which has no
      interface for retrieving the name.
      
      [ Folded a fix from Marc to make DT name parsing work ]
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Acked-by: NMarc Zyngier <marc.zyngier@arm.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Keith Busch <keith.busch@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Christoph Hellwig <hch@lst.de>
      Link: http://lkml.kernel.org/r/20170619235443.588784933@linutronix.de
      d59f6617
  3. 23 5月, 2017 2 次提交
  4. 30 1月, 2017 1 次提交
  5. 23 1月, 2017 2 次提交
  6. 05 9月, 2016 1 次提交
  7. 03 9月, 2016 1 次提交
  8. 11 7月, 2016 1 次提交
  9. 04 7月, 2016 1 次提交
  10. 23 6月, 2016 1 次提交
    • J
      irqdomain: Fix disposal of mappings for interrupt hierarchies · d16dcd3d
      Jon Hunter 提交于
      The function irq_create_of_mapping() is used to create an interrupt
      mapping. However, depending on whether the irqdomain, to which the
      interrupt belongs, is part of a hierarchy, determines whether the
      mapping is created via calling irq_domain_alloc_irqs() or
      irq_create_mapping().
      
      To dispose of the interrupt mapping, drivers call irq_dispose_mapping().
      However, this function does not check to see if the irqdomain is part
      of a hierarchy or not and simply assumes that it was mapped via calling
      irq_create_mapping() so calls irq_domain_disassociate() to unmap the
      interrupt.
      
      Fix this by checking to see if the irqdomain is part of a hierarchy and
      if so call irq_domain_free_irqs() to free/unmap the interrupt.
      Signed-off-by: NJon Hunter <jonathanh@nvidia.com>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Jiang Liu <jiang.liu@linux.intel.com>
      Link: http://lkml.kernel.org/r/1466501002-16368-1-git-send-email-jonathanh@nvidia.comSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      d16dcd3d
  11. 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
  12. 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
  13. 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
  14. 31 3月, 2016 1 次提交
  15. 10 3月, 2016 1 次提交
  16. 25 2月, 2016 1 次提交
  17. 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
  18. 16 1月, 2016 1 次提交
  19. 21 12月, 2015 1 次提交
  20. 20 12月, 2015 1 次提交
  21. 16 12月, 2015 1 次提交
  22. 14 10月, 2015 8 次提交
  23. 16 9月, 2015 1 次提交
  24. 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
  25. 12 6月, 2015 1 次提交