09 Oct, 2017

1 commit

  • Managed interrupts can end up in a stale state on CPU hotplug. If the
    interrupt is not targeting a single CPU, i.e. the affinity mask spawns
    multiple CPUs then the following can happen:

    After boot:

    dstate: 0x01601200
    IRQD_ACTIVATED
    IRQD_IRQ_STARTED
    IRQD_SINGLE_TARGET
    IRQD_AFFINITY_SET
    IRQD_AFFINITY_MANAGED
    node: 0
    affinity: 24-31
    effectiv: 24
    pending: 0

    After offlining CPU 31 - 24

    dstate: 0x01a31000
    IRQD_IRQ_DISABLED
    IRQD_IRQ_MASKED
    IRQD_SINGLE_TARGET
    IRQD_AFFINITY_SET
    IRQD_AFFINITY_MANAGED
    IRQD_MANAGED_SHUTDOWN
    node: 0
    affinity: 24-31
    effectiv: 24
    pending: 0

    Now CPU 25 gets onlined again, so it should get the effective interrupt
    affinity for this interruopt, but due to the x86 interrupt affinity setter
    restrictions this ends up after restarting the interrupt with:

    dstate: 0x01601300
    IRQD_ACTIVATED
    IRQD_IRQ_STARTED
    IRQD_SINGLE_TARGET
    IRQD_AFFINITY_SET
    IRQD_SETAFFINITY_PENDING
    IRQD_AFFINITY_MANAGED
    node: 0
    affinity: 24-31
    effectiv: 24
    pending: 24-31

    So the interrupt is still affine to CPU 24, which was the last CPU to go
    offline of that affinity set and the move to an online CPU within 24-31,
    in this case 25, is pending. This mechanism is x86/ia64 specific as those
    architectures cannot move interrupts from thread context and do this when
    an interrupt is actually handled. So the move is set to pending.

    Whats worse is that offlining CPU 25 again results in:

    dstate: 0x01601300
    IRQD_ACTIVATED
    IRQD_IRQ_STARTED
    IRQD_SINGLE_TARGET
    IRQD_AFFINITY_SET
    IRQD_SETAFFINITY_PENDING
    IRQD_AFFINITY_MANAGED
    node: 0
    affinity: 24-31
    effectiv: 24
    pending: 24-31

    This means the interrupt has not been shut down, because the outgoing CPU
    is not in the effective affinity mask, but of course nothing notices that
    the effective affinity mask is pointing at an offline CPU.

    In the case of restarting a managed interrupt the move restriction does not
    apply, so the affinity setting can be made unconditional. This needs to be
    done _before_ the interrupt is started up as otherwise the condition for
    moving it from thread context would not longer be fulfilled.

    With that change applied onlining CPU 25 after offlining 31-24 results in:

    dstate: 0x01600200
    IRQD_ACTIVATED
    IRQD_IRQ_STARTED
    IRQD_SINGLE_TARGET
    IRQD_AFFINITY_MANAGED
    node: 0
    affinity: 24-31
    effectiv: 25
    pending:

    And after offlining CPU 25:

    dstate: 0x01a30000
    IRQD_IRQ_DISABLED
    IRQD_IRQ_MASKED
    IRQD_SINGLE_TARGET
    IRQD_AFFINITY_MANAGED
    IRQD_MANAGED_SHUTDOWN
    node: 0
    affinity: 24-31
    effectiv: 25
    pending:

    which is the correct and expected result.

    Fixes: 761ea388e8c4 ("genirq: Handle managed irqs gracefully in irq_startup()")
    Reported-by: YASUAKI ISHIMATSU
    Signed-off-by: Thomas Gleixner
    Cc: axboe@kernel.dk
    Cc: linux-scsi@vger.kernel.org
    Cc: Sumit Saxena
    Cc: Marc Zyngier
    Cc: mpe@ellerman.id.au
    Cc: Shivasharan Srikanteshwara
    Cc: Kashyap Desai
    Cc: keith.busch@intel.com
    Cc: peterz@infradead.org
    Cc: Hannes Reinecke
    Cc: Christoph Hellwig
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/alpine.DEB.2.20.1710042208400.2406@nanos

    Thomas Gleixner
     

17 Sep, 2017

1 commit

  • The result of cpumask_any_and() is invalid when result greater or equal
    nr_cpu_ids. The current check is checking for greater only. Fix it.

    Fixes: 761ea388e8c4 ("genirq: Handle managed irqs gracefully in irq_startup()")
    Signed-off-by: Thomas Gleixner
    Cc: Boris Ostrovsky
    Cc: Juergen Gross
    Cc: Tony Luck
    Cc: Chen Yu
    Cc: Marc Zyngier
    Cc: Alok Kataria
    Cc: Joerg Roedel
    Cc: "Rafael J. Wysocki"
    Cc: Steven Rostedt
    Cc: Christoph Hellwig
    Cc: Peter Zijlstra
    Cc: Borislav Petkov
    Cc: stable@vger.kernel.org
    Cc: Paolo Bonzini
    Cc: Rui Zhang
    Cc: "K. Y. Srinivasan"
    Cc: Arjan van de Ven
    Cc: Dan Williams
    Cc: Len Brown
    Link: http://lkml.kernel.org/r/20170913213152.272283444@linutronix.de

    Thomas Gleixner
     

05 Sep, 2017

1 commit

  • Pull irq updates from Thomas Gleixner:
    "The interrupt subsystem delivers this time:

    - Refactoring of the GIC-V3 driver to prepare for the GIC-V4 support

    - Initial GIC-V4 support

    - Consolidation of the FSL MSI support

    - Utilize the effective affinity interface in various ARM irqchip
    drivers

    - Yet another interrupt chip driver (UniPhier AIDET)

    - Bulk conversion of the irq chip driver to use %pOF

    - The usual small fixes and improvements all over the place"

    * 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (77 commits)
    irqchip/ls-scfg-msi: Add MSI affinity support
    irqchip/ls-scfg-msi: Add LS1043a v1.1 MSI support
    irqchip/ls-scfg-msi: Add LS1046a MSI support
    arm64: dts: ls1046a: Add MSI dts node
    arm64: dts: ls1043a: Share all MSIs
    arm: dts: ls1021a: Share all MSIs
    arm64: dts: ls1043a: Fix typo of MSI compatible string
    arm: dts: ls1021a: Fix typo of MSI compatible string
    irqchip/ls-scfg-msi: Fix typo of MSI compatible strings
    irqchip/irq-bcm7120-l2: Use correct I/O accessors for irq_fwd_mask
    irqchip/mmp: Make mmp_intc_conf const
    irqchip/gic: Make irq_chip const
    irqchip/gic-v3: Advertise GICv4 support to KVM
    irqchip/gic-v4: Enable low-level GICv4 operations
    irqchip/gic-v4: Add some basic documentation
    irqchip/gic-v4: Add VLPI configuration interface
    irqchip/gic-v4: Add VPE command interface
    irqchip/gic-v4: Add per-VM VPE domain creation
    irqchip/gic-v3-its: Set implementation defined bit to enable VLPIs
    irqchip/gic-v3-its: Allow doorbell interrupts to be injected/cleared
    ...

    Linus Torvalds
     

18 Aug, 2017

3 commits

  • irq_modify_status starts by clearing the trigger settings from
    irq_data before applying the new settings, but doesn't restore them,
    leaving them to IRQ_TYPE_NONE.

    That's pretty confusing to the potential request_irq() that could
    follow. Instead, snapshot the settings before clearing them, and restore
    them if the irq_modify_status() invocation was not changing the trigger.

    Fixes: 1e2a7d78499e ("irqdomain: Don't set type when mapping an IRQ")
    Reported-and-tested-by: jeffy
    Signed-off-by: Marc Zyngier
    Signed-off-by: Thomas Gleixner
    Cc: Jon Hunter
    Cc: stable@vger.kernel.org
    Link: http://lkml.kernel.org/r/20170818095345.12378-1-marc.zyngier@arm.com

    Marc Zyngier
     
  • Follow-on patch for gpio-thunderx uses a irqdomain hierarchy which
    requires slightly different flow handlers, add them to chip.c which
    contains most of the other flow handlers. Make these conditionally
    compiled based on CONFIG_IRQ_FASTEOI_HIERARCHY_HANDLERS.

    Signed-off-by: David Daney
    Signed-off-by: Thomas Gleixner
    Cc: Mark Rutland
    Cc: Alexandre Courbot
    Cc: Marc Zyngier
    Cc: Linus Walleij
    Cc: linux-gpio@vger.kernel.org
    Link: http://lkml.kernel.org/r/1503017616-3252-3-git-send-email-david.daney@cavium.com

    David Daney
     
  • Many of the family of functions including irq_chip_mask_parent(),
    irq_chip_unmask_parent() are exported, but not all.

    Add EXPORT_SYMBOL_GPL to irq_chip_enable_parent,
    irq_chip_disable_parent and irq_chip_set_affinity_parent, so they
    likewise are usable from modules.

    Signed-off-by: David Daney
    Signed-off-by: Thomas Gleixner
    Cc: Mark Rutland
    Cc: Alexandre Courbot
    Cc: Marc Zyngier
    Cc: Linus Walleij
    Cc: linux-gpio@vger.kernel.org
    Link: http://lkml.kernel.org/r/1503017616-3252-2-git-send-email-david.daney@cavium.com

    David Daney
     

18 Jul, 2017

1 commit

  • Interrupts with the IRQF_FORCE_RESUME flag set have also the
    IRQF_NO_SUSPEND flag set. They are not disabled in the suspend path, but
    must be forcefully resumed. That's used by XEN to keep IPIs enabled beyond
    the suspension of device irqs. Force resume works by pretending that the
    interrupt was disabled and then calling __irq_enable().

    Incrementing the disabled depth counter was enough to do that, but with the
    recent changes which use state flags to avoid unnecessary hardware access,
    this is not longer sufficient. If the state flags are not set, then the
    hardware callbacks are not invoked and the interrupt line stays disabled in
    "hardware".

    Set the disabled and masked state when pretending that an interrupt got
    disabled by suspend.

    Fixes: bf22ff45bed6 ("genirq: Avoid unnecessary low level irq function calls")
    Suggested-by: Thomas Gleixner
    Signed-off-by: Juergen Gross
    Signed-off-by: Thomas Gleixner
    Cc: xen-devel@lists.xenproject.org
    Cc: boris.ostrovsky@oracle.com
    Link: http://lkml.kernel.org/r/20170717174703.4603-2-jgross@suse.com

    Juergen Gross
     

10 Jul, 2017

1 commit

  • Pull irq fixes from Thomas Gleixner:

    - A few fixes mopping up the fallout of the big irq overhaul

    - Move the interrupt resource management logic out of the spin locked,
    irq disabled region to avoid unnecessary restrictions of the resource
    callbacks

    - Preparation for reworking the per cpu irq request function.

    * 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    irqdomain: Allow ACPI device nodes to be used as irqdomain identifiers
    genirq/debugfs: Remove redundant NULL pointer check
    genirq: Allow to pass the IRQF_TIMER flag with percpu irq request
    genirq/timings: Move free timings out of spinlocked region
    genirq: Move irq resource handling out of spinlocked region
    genirq: Add mutex to irq desc to serialize request/free_irq()
    genirq: Move bus locking into __setup_irq()
    genirq: Force inlining of __irq_startup_managed to prevent build failure
    genirq/debugfs: Fix build for !CONFIG_IRQ_DOMAIN

    Linus Torvalds
     

04 Jul, 2017

2 commits

  • If CONFIG_SMP=n, and gcc (e.g. 4.1.2) decides not to inline
    __irq_startup_managed(), the build fails with:

    kernel/built-in.o: In function `irq_startup':
    (.text+0x38ed8): undefined reference to `irq_set_affinity_locked'

    Fix this by forcing inlining of __irq_startup_managed().

    Fixes: 761ea388e8c4e3ac ("genirq: Handle managed irqs gracefully in irq_startup()")
    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Thomas Gleixner
    Cc: Arnd Bergmann
    Link: http://lkml.kernel.org/r/1499162761-12398-1-git-send-email-geert@linux-m68k.org

    Geert Uytterhoeven
     
  • Pull documentation updates from Jonathan Corbet:
    "There has been a fair amount of activity in the docs tree this time
    around. Highlights include:

    - Conversion of a bunch of security documentation into RST

    - The conversion of the remaining DocBook templates by The Amazing
    Mauro Machine. We can now drop the entire DocBook build chain.

    - The usual collection of fixes and minor updates"

    * tag 'docs-4.13' of git://git.lwn.net/linux: (90 commits)
    scripts/kernel-doc: handle DECLARE_HASHTABLE
    Documentation: atomic_ops.txt is core-api/atomic_ops.rst
    Docs: clean up some DocBook loose ends
    Make the main documentation title less Geocities
    Docs: Use kernel-figure in vidioc-g-selection.rst
    Docs: fix table problems in ras.rst
    Docs: Fix breakage with Sphinx 1.5 and upper
    Docs: Include the Latex "ifthen" package
    doc/kokr/howto: Only send regression fixes after -rc1
    docs-rst: fix broken links to dynamic-debug-howto in kernel-parameters
    doc: Document suitability of IBM Verse for kernel development
    Doc: fix a markup error in coding-style.rst
    docs: driver-api: i2c: remove some outdated information
    Documentation: DMA API: fix a typo in a function name
    Docs: Insert missing space to separate link from text
    doc/ko_KR/memory-barriers: Update control-dependencies example
    Documentation, kbuild: fix typo "minimun" -> "minimum"
    docs: Fix some formatting issues in request-key.rst
    doc: ReSTify keys-trusted-encrypted.txt
    doc: ReSTify keys-request-key.txt
    ...

    Linus Torvalds
     

26 Jun, 2017

1 commit

  • Check irq state in enable/disable/unmask/mask_irq to avoid unnecessary
    low level irq function calls.

    This has two advantages:
    - Conditionals are faster than hardware access

    - Solves issues with the underlying refcounting of the pinctrl
    infrastructure

    Suggested-by: Thomas Gleixner
    Signed-off-by: Jeffy Chen
    Signed-off-by: Thomas Gleixner
    Cc: tfiga@chromium.org
    Cc: briannorris@chromium.org
    Cc: dianders@chromium.org
    Link: http://lkml.kernel.org/r/1498476814-12563-2-git-send-email-jeffy.chen@rock-chips.com

    Jeffy Chen
     

23 Jun, 2017

4 commits

  • Affinity managed interrupts should keep their assigned affinity accross CPU
    hotplug. To avoid magic hackery in device drivers, the core code shall
    manage them transparently and set these interrupts into a managed shutdown
    state when the last CPU of the assigned affinity mask goes offline. The
    interrupt will be restarted when one of the CPUs in the assigned affinity
    mask comes back online.

    Add the necessary logic to irq_startup(). If an interrupt is requested and
    started up, the code checks whether it is affinity managed and if so, it
    checks whether a CPU in the interrupts affinity mask is online. If not, it
    puts the interrupt into managed shutdown state.

    Signed-off-by: Thomas Gleixner
    Cc: Jens Axboe
    Cc: Marc Zyngier
    Cc: Michael Ellerman
    Cc: Keith Busch
    Cc: Peter Zijlstra
    Cc: Christoph Hellwig
    Link: http://lkml.kernel.org/r/20170619235447.189851170@linutronix.de

    Thomas Gleixner
     
  • In order to handle managed interrupts gracefully on irq_startup() so they
    won't lose their assigned affinity, it's necessary to allow startups which
    keep the interrupts in managed shutdown state, if none of the assigend CPUs
    is online. This allows drivers to request interrupts w/o the CPUs being
    online, which avoid online/offline churn in drivers.

    Add a force argument which can override that decision and let only
    request_irq() and enable_irq() allow the managed shutdown
    handling. enable_irq() is required, because the interrupt might be
    requested with IRQF_NOAUTOEN and enable_irq() invokes irq_startup() which
    would then wreckage the assignment again. All other callers force startup
    and potentially break the assigned affinity.

    No functional change as this only adds the function argument.

    Signed-off-by: Thomas Gleixner
    Cc: Jens Axboe
    Cc: Marc Zyngier
    Cc: Michael Ellerman
    Cc: Keith Busch
    Cc: Peter Zijlstra
    Cc: Christoph Hellwig
    Link: http://lkml.kernel.org/r/20170619235447.112094565@linutronix.de

    Thomas Gleixner
     
  • Split out the inner workings of irq_startup() so it can be reused to handle
    managed interrupts gracefully.

    Signed-off-by: Thomas Gleixner
    Cc: Jens Axboe
    Cc: Marc Zyngier
    Cc: Michael Ellerman
    Cc: Keith Busch
    Cc: Peter Zijlstra
    Cc: Christoph Hellwig
    Link: http://lkml.kernel.org/r/20170619235447.033235144@linutronix.de

    Thomas Gleixner
     
  • The startup vs. setaffinity ordering of interrupts depends on the
    IRQF_NOAUTOEN flag. Chained interrupts are not getting any affinity
    assignment at all.

    A regular interrupt is started up and then the affinity is set. A
    IRQF_NOAUTOEN marked interrupt is not started up, but the affinity is set
    nevertheless.

    Move the affinity setup to startup_irq() so the ordering is always the same
    and chained interrupts get the proper default affinity assigned as well.

    Signed-off-by: Thomas Gleixner
    Cc: Jens Axboe
    Cc: Marc Zyngier
    Cc: Michael Ellerman
    Cc: Keith Busch
    Cc: Peter Zijlstra
    Cc: Christoph Hellwig
    Link: http://lkml.kernel.org/r/20170619235445.020534783@linutronix.de

    Thomas Gleixner
     

04 Jun, 2017

2 commits

  • Shared interrupts do not go well with disabling auto enable:

    1) The sharing interrupt might request it while it's still disabled and
    then wait for interrupts forever.

    2) The interrupt might have been requested by the driver sharing the line
    before IRQ_NOAUTOEN has been set. So the driver which expects that
    disabled state after calling request_irq() will not get what it wants.
    Even worse, when it calls enable_irq() later, it will trigger the
    unbalanced enable_irq() warning.

    Reported-by: Brian Norris
    Signed-off-by: Thomas Gleixner
    Cc: dianders@chromium.org
    Cc: jeffy
    Cc: Marc Zyngier
    Cc: tfiga@chromium.org
    Link: http://lkml.kernel.org/r/20170531100212.210682135@linutronix.de

    Thomas Gleixner
     
  • If an interrupt is marked NOAUTOEN then request_irq() installs the action,
    but does not enable the interrupt via startup_irq(). The interrupt is
    enabled via enable_irq() later from the driver. enable_irq() calls
    irq_enable().

    That means that for interrupts which have a irq_startup() callback this
    callback is never invoked. Neither is irq_domain_activate_irq() invoked for
    such interrupts.

    If an interrupt depends on irq_startup() or irq_domain_activate_irq() then
    the enable via irq_enable() is not enough.

    Add a status flag IRQD_IRQ_STARTED_UP and use this to select the proper
    mechanism in enable_irq(). Use the flag also to avoid pointless calls into
    the low level functions.

    Signed-off-by: Thomas Gleixner
    Acked-by: Marc Zyngier
    Cc: dianders@chromium.org
    Cc: jeffy
    Cc: Brian Norris
    Cc: tfiga@chromium.org
    Link: http://lkml.kernel.org/r/20170531100212.130986205@linutronix.de

    Thomas Gleixner
     

16 May, 2017

2 commits

  • irq_set_chained_handler_and_data() sets up the chained interrupt and then
    stores the handler data.

    That's racy against an immediate interrupt which gets handled before the
    store of the handler data happened. The handler will dereference a NULL
    pointer and crash.

    Cure it by storing handler data before installing the chained handler.

    Reported-by: Borislav Petkov
    Signed-off-by: Thomas Gleixner
    Cc: stable@vger.kernel.org

    Thomas Gleixner
     
  • This book got converted from DocBook. Update its references to
    point to the current location.

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     

11 Mar, 2017

1 commit

  • On a specific audio system an interrupt input of an audio CODEC is used as a
    shared interrupt. That interrupt input is handled by a CODEC specific irq
    chip driver and triggers a CPU interrupt via the CODEC irq output line.

    The CODEC interrupt handler demultiplexes the CODEC interrupt inputs and
    the interrupt handlers for these demultiplexed inputs run nested in the
    context of the CODEC interrupt handler.

    The demultiplexed interrupts use handle_nested_irq() as their interrupt
    handler, which unfortunately has no support for shared interrupts. So the
    above hardware cannot be supported.

    Add shared interrupt support to handle_nested_irq() by iterating over the
    interrupt action chain.

    [ tglx: Massaged changelog ]

    Signed-off-by: Charles Keepax
    Cc: patches@opensource.wolfsonmicro.com
    Link: http://lkml.kernel.org/r/1488904098-5350-1-git-send-email-ckeepax@opensource.wolfsonmicro.com
    Signed-off-by: Thomas Gleixner

    Charles Keepax
     

26 Sep, 2016

1 commit


21 Sep, 2016

1 commit


19 Sep, 2016

1 commit

  • There is no point in trying to configure the trigger of a chained
    interrupt if no trigger information has been configured. At best
    this is ignored, and at the worse this confuses the underlying
    irqchip (which is likely not to handle such a thing), and
    unnecessarily alarms the user.

    Only apply the configuration if type is not IRQ_TYPE_NONE.

    Fixes: 1e12c4a9393b ("genirq: Correctly configure the trigger on chained interrupts")
    Reported-and-tested-by: Geert Uytterhoeven
    Signed-off-by: Marc Zyngier
    Link: https://lkml.kernel.org/r/CAMuHMdVW1eTn20=EtYcJ8hkVwohaSuH_yQXrY2MGBEvZ8fpFOg@mail.gmail.com
    Link: http://lkml.kernel.org/r/1474274967-15984-1-git-send-email-marc.zyngier@arm.com
    Signed-off-by: Thomas Gleixner

    Marc Zyngier
     

15 Sep, 2016

1 commit


06 Sep, 2016

1 commit

  • Some callers of __irq_set_trigger() masks all flags except trigger mode
    flags. This is unnecessary, ase __irq_set_trigger() already does this
    before usage of flags.

    [ tglx: Moved the flag mask and adjusted comment. Removed the hunk in
    enable_percpu_irq() as it is required there ]

    Signed-off-by: Alexander Kuleshov
    Link: http://lkml.kernel.org/r/20160719095408.13778-1-kuleshovmail@gmail.com
    Signed-off-by: Thomas Gleixner

    Alexander Kuleshov
     

03 Sep, 2016

1 commit

  • The percpu_devid handler is not robust against spurious interrupts. If a
    spurious interrupt happens and no action is installed then the handler
    crashes with a NULL pointer dereference.

    Add a sanity check for this and log the wreckage once in dmesg.

    Reported-by: Majun
    Signed-off-by: Thomas Gleixner
    Cc: Mark Rutland
    Cc: Marc Zyngier
    Cc: guohanjun@huawei.com
    Cc: dingtianhong@huawei.com
    Cc: linux-arm-kernel@lists.infradead.org
    Link: http://lkml.kernel.org/r/alpine.DEB.2.20.1609021436160.5647@nanos

    Thomas Gleixner
     

17 Aug, 2016

1 commit

  • Commit 1e2a7d78499e ("irqdomain: Don't set type when mapping an IRQ")
    moved the trigger configuration call from the irqdomain mapping to
    the interrupt being actually requested.

    This patch failed to handle the case where we configure a chained
    interrupt, which doesn't get requested through the usual path.

    In order to solve this, let's call __irq_set_trigger just before
    starting the cascade interrupt. Special care must be taken to
    make the flow handler stick, as the .irq_set_type method could
    have reset it (it doesn't know we're dealing with a chained
    interrupt).

    Based on an initial patch by Jon Hunter.

    Fixes: 1e2a7d78499e ("irqdomain: Don't set type when mapping an IRQ")
    Reported-by: John Stultz
    Reported-by: Linus Walleij
    Tested-by: John Stultz
    Acked-by: Jon Hunter
    Signed-off-by: Marc Zyngier

    Marc Zyngier
     

18 Jun, 2016

1 commit

  • This adds a software irq handler for controllers that multiplex
    interrupts from multiple devices, but don't know which device generated
    the interrupt. For these devices, the irq handler that demuxes must
    check every action for every software irq using the same h/w irq in order
    to find out which device generated the interrupt. This will inevitably
    trigger spurious interrupt detection if we are noting the irq.

    The new irq handler does not track the handling for spurious interrupt
    detection. An irq that uses this also won't get stats tracked since it
    didn't generate the interrupt, nor added to randomness since they are
    not random.

    Signed-off-by: Keith Busch
    Cc: Bjorn Helgaas
    Cc: linux-pci@vger.kernel.org
    Cc: Jon Derrick
    Link: http://lkml.kernel.org/r/1466200821-29159-1-git-send-email-keith.busch@intel.com
    Signed-off-by: Thomas Gleixner

    Keith Busch
     

13 Jun, 2016

1 commit

  • Some IRQ chips may be located in a power domain outside of the CPU
    subsystem and hence will require device specific runtime power
    management. In order to support such IRQ chips, add a pointer for a
    device structure to the irq_chip structure, and if this pointer is
    populated by the IRQ chip driver and CONFIG_PM is selected in the kernel
    configuration, then the pm_runtime_get/put APIs for this chip will be
    called when an IRQ is requested/freed, respectively.

    Reviewed-by: Kevin Hilman
    Signed-off-by: Jon Hunter
    Signed-off-by: Marc Zyngier

    Jon Hunter
     

10 Mar, 2016

1 commit

  • Export irq_chip_*_parent(), irq_domain_create_hierarchy(),
    irq_domain_set_hwirq_and_chip(), irq_domain_reset_irq_data(),
    irq_domain_alloc/free_irqs_parent()

    So gpio drivers can be built as modules. First user: gpio-xgene-sb

    Signed-off-by: Quan Nguyen
    Acked-by: Linus Walleij
    Cc: Phong Vo
    Cc: Marc Zyngier
    Cc: patches@apm.com
    Cc: Loc Ho
    Cc: Keyur Chudgar
    Cc: Jiang Liu
    Link: https://lists.01.org/pipermail/kbuild-all/2016-February/017914.html
    Link: http://lkml.kernel.org/r/1457017012-10628-1-git-send-email-qnguyen@apm.com
    Signed-off-by: Thomas Gleixner

    Quan Nguyen
     

20 Dec, 2015

1 commit

  • The Linux kernel already has the concept of IRQ domain, wherein a
    component can expose a set of IRQs which are managed by a particular
    interrupt controller chip or other subsystem. The PCI driver exposes
    the notion of an IRQ domain for Message-Signaled Interrupts (MSI) from
    PCI Express devices. This patch exposes the functions which are
    necessary for creating a MSI IRQ domain within a module.

    [ tglx: Split it into x86 and core irq parts ]

    Signed-off-by: Jake Oshins
    Cc: gregkh@linuxfoundation.org
    Cc: kys@microsoft.com
    Cc: devel@linuxdriverproject.org
    Cc: olaf@aepfle.de
    Cc: apw@canonical.com
    Cc: vkuznets@redhat.com
    Cc: haiyangz@microsoft.com
    Cc: marc.zyngier@arm.com
    Cc: bhelgaas@google.com
    Link: http://lkml.kernel.org/r/1449769983-12948-4-git-send-email-jakeo@microsoft.com
    Signed-off-by: Thomas Gleixner

    Jake Oshins
     

17 Nov, 2015

1 commit

  • In case of a wakeup interrupt, irq_pm_check_wakeup disables the interrupt
    and marks it pending and suspended, disables it and notifies the pm core
    about the wake event. The interrupt gets handled later once the system
    is resumed.

    However the irq stats is updated twice: once when it's disabled waiting
    for the system to resume and later when it's handled, resulting in wrong
    counting of the wakeup interrupt when waking up the system.

    This patch updates the interrupt count so that it's updated only when
    the interrupt gets handled. It's already handled correctly in
    handle_edge_irq and handle_edge_eoi_irq.

    Reported-by: Manoil Claudiu
    Signed-off-by: Sudeep Holla
    Cc: Marc Zyngier
    Link: http://lkml.kernel.org/r/1446661957-1019-1-git-send-email-sudeep.holla@arm.com
    Signed-off-by: Thomas Gleixner

    Sudeep Holla
     

11 Oct, 2015

1 commit

  • If an irq chip does not implement the irq_disable callback, then we
    use a lazy approach for disabling the interrupt. That means that the
    interrupt is marked disabled, but the interrupt line is not
    immediately masked in the interrupt chip. It only becomes masked if
    the interrupt is raised while it's marked disabled. We use this to avoid
    possibly expensive mask/unmask operations for common case operations.

    Unfortunately there are devices which do not allow the interrupt to be
    disabled easily at the device level. They are forced to use
    disable_irq_nosync(). This can result in taking each interrupt twice.

    Instead of enforcing the non lazy mode on all interrupts of a irq
    chip, provide a settings flag, which can be set by the driver for that
    particular interrupt line.

    Reported-and-tested-by: Duc Dang
    Signed-off-by: Thomas Gleixner
    Cc: Marc Zyngier
    Cc: Jason Cooper
    Link: http://lkml.kernel.org/r/alpine.DEB.2.11.1510092348370.6097@nanos

    Thomas Gleixner
     

10 Oct, 2015

1 commit

  • When a CPU is offlined all interrupts that have an action are migrated to
    other still online CPUs. However, if the interrupt has chained handler
    installed this is not done. Chained handlers are used by GPIO drivers which
    support interrupts, for instance.

    When the affinity is not corrected properly we end up in situation where
    most interrupts are not arriving to the online CPUs anymore. For example on
    Intel Braswell system which has SD-card card detection signal connected to
    a GPIO the IO-APIC routing entries look like below after CPU1 is offlined:

    pin30, enabled , level, low , V(52), IRR(0), S(0), logical , D(03), M(1)
    pin31, enabled , level, low , V(42), IRR(0), S(0), logical , D(03), M(1)
    pin32, enabled , level, low , V(62), IRR(0), S(0), logical , D(03), M(1)
    pin5b, enabled , level, low , V(72), IRR(0), S(0), logical , D(03), M(1)

    The problem here is that the destination mask still contains both CPUs even
    if CPU1 is already offline. This means that the IO-APIC still routes
    interrupts to the other CPU as well.

    We solve the problem by providing a default action for chained interrupts.
    This action allows the migration code to correct affinity (as it finds
    desc->action != NULL).

    Also make the default action handler to emit a warning if for some reason a
    chained handler ends up calling it.

    Signed-off-by: Mika Westerberg
    Cc: Jiang Liu
    Link: http://lkml.kernel.org/r/1444039935-30475-1-git-send-email-mika.westerberg@linux.intel.com
    Signed-off-by: Thomas Gleixner

    Mika Westerberg
     

22 Sep, 2015

1 commit

  • Actually, we always use the first irq action of the @desc->action
    chain, so remove the second parameter from handle_irq_event_percpu()
    which makes the code more tidy.

    Signed-off-by: Huang Shijie
    Reviewed-by: Jiang Liu
    Cc: peterz@infradead.org
    Cc: marc.zyngier@arm.com
    Link: http://lkml.kernel.org/r/1441160695-19809-1-git-send-email-shijie.huang@arm.com
    Signed-off-by: Thomas Gleixner

    Huang Shijie
     

16 Sep, 2015

3 commits

  • Most interrupt flow handlers do not use the irq argument. Those few
    which use it can retrieve the irq number from the irq descriptor.

    Remove the argument.

    Search and replace was done with coccinelle and some extra helper
    scripts around it. Thanks to Julia for her help!

    Signed-off-by: Thomas Gleixner
    Cc: Julia Lawall
    Cc: Jiang Liu

    Thomas Gleixner
     
  • MSI descriptors are per-irq instead of per irqchip, so move it into
    struct irq_common_data.

    Signed-off-by: Jiang Liu
    Cc: Konrad Rzeszutek Wilk
    Cc: Tony Luck
    Cc: Bjorn Helgaas
    Cc: Benjamin Herrenschmidt
    Cc: Randy Dunlap
    Cc: Yinghai Lu
    Cc: Borislav Petkov
    Cc: Jason Cooper
    Cc: Kevin Cernekee
    Cc: Arnd Bergmann
    Cc: Marc Zyngier
    Link: http://lkml.kernel.org/r/1433145945-789-35-git-send-email-jiang.liu@linux.intel.com
    Signed-off-by: Thomas Gleixner

    Jiang Liu
     
  • Handler data (handler_data) is per-irq instead of per irqchip, so move
    it into struct irq_common_data.

    Signed-off-by: Jiang Liu
    Cc: Konrad Rzeszutek Wilk
    Cc: Tony Luck
    Cc: Bjorn Helgaas
    Cc: Benjamin Herrenschmidt
    Cc: Randy Dunlap
    Cc: Yinghai Lu
    Cc: Borislav Petkov
    Cc: Jason Cooper
    Cc: Kevin Cernekee
    Cc: Arnd Bergmann
    Cc: Marc Zyngier
    Link: http://lkml.kernel.org/r/1433145945-789-13-git-send-email-jiang.liu@linux.intel.com
    Signed-off-by: Thomas Gleixner

    Jiang Liu
     

02 Sep, 2015

1 commit

  • Pull irq updates from Thomas Gleixner:
    "This updated pull request does not contain the last few GIC related
    patches which were reported to cause a regression. There is a fix
    available, but I let it breed for a couple of days first.

    The irq departement provides:

    - new infrastructure to support non PCI based MSI interrupts
    - a couple of new irq chip drivers
    - the usual pile of fixlets and updates to irq chip drivers
    - preparatory changes for removal of the irq argument from interrupt
    flow handlers
    - preparatory changes to remove IRQF_VALID"

    * 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (129 commits)
    irqchip/imx-gpcv2: IMX GPCv2 driver for wakeup sources
    irqchip: Add bcm2836 interrupt controller for Raspberry Pi 2
    irqchip: Add documentation for the bcm2836 interrupt controller
    irqchip/bcm2835: Add support for being used as a second level controller
    irqchip/bcm2835: Refactor handle_IRQ() calls out of MAKE_HWIRQ
    PCI: xilinx: Fix typo in function name
    irqchip/gic: Ensure gic_cpu_if_up/down() programs correct GIC instance
    irqchip/gic: Only allow the primary GIC to set the CPU map
    PCI/MSI: pci-xgene-msi: Consolidate chained IRQ handler install/remove
    unicore32/irq: Prepare puv3_gpio_handler for irq argument removal
    tile/pci_gx: Prepare trio_handle_level_irq for irq argument removal
    m68k/irq: Prepare irq handlers for irq argument removal
    C6X/megamode-pic: Prepare megamod_irq_cascade for irq argument removal
    blackfin: Prepare irq handlers for irq argument removal
    arc/irq: Prepare idu_cascade_isr for irq argument removal
    sparc/irq: Use access helper irq_data_get_affinity_mask()
    sparc/irq: Use helper irq_data_get_irq_handler_data()
    parisc/irq: Use access helper irq_data_get_affinity_mask()
    mn10300/irq: Use access helper irq_data_get_affinity_mask()
    irqchip/i8259: Prepare i8259_irq_dispatch for irq argument removal
    ...

    Linus Torvalds
     

20 Aug, 2015

1 commit

  • This helper is required for irq chips which do not implement a
    irq_set_type callback and need to call down the irq domain hierarchy
    for the actual trigger type change.

    This helper is required to fix further wreckage caused by the
    conversion of TI OMAP to hierarchical irq domains and therefor tagged
    for stable.

    [ tglx: Massaged changelog ]

    Signed-off-by: Grygorii Strashko
    Cc: Sudeep Holla
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc:
    Cc: stable@vger.kernel.org # 4.1
    Link: http://lkml.kernel.org/r/1439554830-19502-3-git-send-email-grygorii.strashko@ti.com
    Signed-off-by: Thomas Gleixner

    Grygorii Strashko