17 Aug, 2022

3 commits

  • [ Upstream commit 6f194c99f466147148cc08452718b46664112548 ]

    When using a NOMAP domain, __irq_resolve_mapping() doesn't store
    the Linux IRQ number at the address optionally provided by the caller.
    While this isn't a huge deal (the returned value is guaranteed
    to the hwirq that was passed as a parameter), let's honour the letter
    of the API by writing the expected value.

    Fixes: d22558dd0a6c (“irqdomain: Introduce irq_resolve_mapping()”)
    Signed-off-by: Xu Qiang
    [maz: commit message]
    Signed-off-by: Marc Zyngier
    Link: https://lore.kernel.org/r/20220719063641.56541-2-xuqiang36@huawei.com
    Signed-off-by: Sasha Levin

    Xu Qiang
     
  • [ Upstream commit 0f5209fee90b4544c58b4278d944425292789967 ]

    The generic IPI code depends on the IRQ affinity mask being allocated
    and initialized. This will not be the case if SMP is disabled. Fix up
    the remaining driver that selected GENERIC_IRQ_IPI in a non-SMP config.

    Reported-by: kernel test robot
    Signed-off-by: Samuel Holland
    Signed-off-by: Marc Zyngier
    Link: https://lore.kernel.org/r/20220701200056.46555-3-samuel@sholland.org
    Signed-off-by: Sasha Levin

    Samuel Holland
     
  • [ Upstream commit 95001b756467ecc9f5973eb5e74e97699d9bbdf1 ]

    Function irq_chip::irq_request_resources() is reported as optional
    in the declaration of struct irq_chip.
    If the parent irq_chip does not implement it, we should ignore it
    and return.

    Don't return error if the functions is missing.

    Signed-off-by: Antonio Borneo
    Signed-off-by: Marc Zyngier
    Link: https://lore.kernel.org/r/20220512160544.13561-1-antonio.borneo@foss.st.com
    Signed-off-by: Sasha Levin

    Antonio Borneo
     

30 May, 2022

1 commit

  • commit 703f7066f40599c290babdb79dd61319264987e9 upstream.

    Since commit
    ee3e00e9e7101 ("random: use registers from interrupted code for CPU's w/o a cycle counter")

    the irq_flags argument is no longer used.

    Remove unused irq_flags.

    Cc: Borislav Petkov
    Cc: Dave Hansen
    Cc: Dexuan Cui
    Cc: H. Peter Anvin
    Cc: Haiyang Zhang
    Cc: Ingo Molnar
    Cc: K. Y. Srinivasan
    Cc: Stephen Hemminger
    Cc: Thomas Gleixner
    Cc: Wei Liu
    Cc: linux-hyperv@vger.kernel.org
    Cc: x86@kernel.org
    Signed-off-by: Sebastian Andrzej Siewior
    Acked-by: Wei Liu
    Signed-off-by: Jason A. Donenfeld
    Signed-off-by: Greg Kroah-Hartman

    Sebastian Andrzej Siewior
     

12 May, 2022

1 commit

  • commit 8707898e22fd665bc1d7b18b809be4b56ce25bdd upstream.

    A kernel hang can be observed when running setserial in a loop on a kernel
    with force threaded interrupts. The sequence of events is:

    setserial
    open("/dev/ttyXXX")
    request_irq()
    do_stuff()
    -> serial interrupt
    -> wake(irq_thread)
    desc->threads_active++;
    close()
    free_irq()
    kthread_stop(irq_thread)
    synchronize_irq() threads_active != 0

    The thread is created in request_irq() and woken up, but does not get on a
    CPU to reach the actual thread function, which would handle the pending
    wake-up. kthread_stop() sets the should stop condition which makes the
    thread immediately exit, which in turn leaves the stale threads_active
    count around.

    This problem was introduced with commit 519cc8652b3a, which addressed a
    interrupt sharing issue in the PCIe code.

    Before that commit free_irq() invoked synchronize_irq(), which waits for
    the hard interrupt handler and also for associated threads to complete.

    To address the PCIe issue synchronize_irq() was replaced with
    __synchronize_hardirq(), which only waits for the hard interrupt handler to
    complete, but not for threaded handlers.

    This was done under the assumption, that the interrupt thread already
    reached the thread function and waits for a wake-up, which is guaranteed to
    be handled before acting on the stop condition. The problematic case, that
    the thread would not reach the thread function, was obviously overlooked.

    Make sure that the interrupt thread is really started and reaches
    thread_fn() before returning from __setup_irq().

    This utilizes the existing wait queue in the interrupt descriptor. The
    wait queue is unused for non-shared interrupts. For shared interrupts the
    usage might cause a spurious wake-up of a waiter in synchronize_irq() or the
    completion of a threaded handler might cause a spurious wake-up of the
    waiter for the ready flag. Both are harmless and have no functional impact.

    [ tglx: Amended changelog ]

    Fixes: 519cc8652b3a ("genirq: Synchronize only with single thread on free_irq()")
    Signed-off-by: Thomas Pfaff
    Signed-off-by: Thomas Gleixner
    Reviewed-by: Marc Zyngier
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/552fe7b4-9224-b183-bb87-a8f36d335690@pcs.com
    Signed-off-by: Greg Kroah-Hartman

    Thomas Pfaff
     

20 Apr, 2022

1 commit

  • commit 08d835dff916bfe8f45acc7b92c7af6c4081c8a7 upstream.

    If CPUs on a node are offline at boot time, the number of nodes is
    different when building affinity masks for present cpus and when building
    affinity masks for possible cpus. This causes the following problem:

    In the case that the number of vectors is less than the number of nodes
    there are cases where bits of masks for present cpus are overwritten when
    building masks for possible cpus.

    Fix this by excluding CPUs, which are not part of the current build mask
    (present/possible).

    [ tglx: Massaged changelog and added comment ]

    Fixes: b82592199032 ("genirq/affinity: Spread IRQs to all available NUMA nodes")
    Signed-off-by: Rei Yamamoto
    Signed-off-by: Thomas Gleixner
    Reviewed-by: Ming Lei
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20220331003309.10891-1-yamamoto.rei@jp.fujitsu.com
    Signed-off-by: Greg Kroah-Hartman

    Rei Yamamoto
     

19 Nov, 2021

1 commit

  • commit 9c8e9c9681a0f3f1ae90a90230d059c7a1dece5a upstream.

    The recent rework of PCI/MSI[X] masking moved the non-mask checks from the
    low level accessors into the higher level mask/unmask functions.

    This missed the fact that these accessors can be invoked from other places
    as well. The missing checks break XEN-PV which sets pci_msi_ignore_mask and
    also violates the virtual MSIX and the msi_attrib.maskbit protections.

    Instead of sprinkling checks all over the place, lift them back into the
    low level accessor functions. To avoid checking three different conditions
    combine them into one property of msi_desc::msi_attrib.

    [ josef: Fixed the missed conversion in the core code ]

    Fixes: fcacdfbef5a1 ("PCI/MSI: Provide a new set of mask and unmask functions")
    Reported-by: Josef Johansson
    Signed-off-by: Thomas Gleixner
    Tested-by: Josef Johansson
    Cc: Bjorn Helgaas
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

24 Sep, 2021

1 commit

  • …t/maz/arm-platforms into irq/urgent

    Pull irqchip fixes from Marc Zyngier:

    - Work around a bad GIC integration on a Renesas platform, where the
    interconnect cannot deal with byte-sized MMIO accesses

    - Cleanup another Renesas driver abusing the comma operator

    - Fix a potential GICv4 memory leak on an error path

    - Make the type of 'size' consistent with the rest of the code in
    __irq_domain_add()

    - Fix a regression in the Armada 370-XP IPI path

    - Fix the build for the obviously unloved goldfish-pic

    - Some documentation fixes

    Link: https://lore.kernel.org/r/20210924090933.2766857-1-maz@kernel.org

    Thomas Gleixner
     

22 Sep, 2021

1 commit


04 Sep, 2021

1 commit

  • Pull powerpc updates from Michael Ellerman:

    - Convert pseries & powernv to use MSI IRQ domains.

    - Rework the pseries CPU numbering so that CPUs that are removed, and
    later re-added, are given a CPU number on the same node as
    previously, when possible.

    - Add support for a new more flexible device-tree format for specifying
    NUMA distances.

    - Convert powerpc to GENERIC_PTDUMP.

    - Retire sbc8548 and sbc8641d board support.

    - Various other small features and fixes.

    Thanks to Alexey Kardashevskiy, Aneesh Kumar K.V, Anton Blanchard,
    Cédric Le Goater, Christophe Leroy, Emmanuel Gil Peyrot, Fabiano Rosas,
    Fangrui Song, Finn Thain, Gautham R. Shenoy, Hari Bathini, Joel
    Stanley, Jordan Niethe, Kajol Jain, Laurent Dufour, Leonardo Bras, Lukas
    Bulwahn, Marc Zyngier, Masahiro Yamada, Michal Suchanek, Nathan
    Chancellor, Nicholas Piggin, Parth Shah, Paul Gortmaker, Pratik R.
    Sampat, Randy Dunlap, Sebastian Andrzej Siewior, Srikar Dronamraju, Wan
    Jiabing, Xiongwei Song, and Zheng Yongjun.

    * tag 'powerpc-5.15-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (154 commits)
    powerpc/bug: Cast to unsigned long before passing to inline asm
    powerpc/ptdump: Fix generic ptdump for 64-bit
    KVM: PPC: Fix clearing never mapped TCEs in realmode
    powerpc/pseries/iommu: Rename "direct window" to "dma window"
    powerpc/pseries/iommu: Make use of DDW for indirect mapping
    powerpc/pseries/iommu: Find existing DDW with given property name
    powerpc/pseries/iommu: Update remove_dma_window() to accept property name
    powerpc/pseries/iommu: Reorganize iommu_table_setparms*() with new helper
    powerpc/pseries/iommu: Add ddw_property_create() and refactor enable_ddw()
    powerpc/pseries/iommu: Allow DDW windows starting at 0x00
    powerpc/pseries/iommu: Add ddw_list_new_entry() helper
    powerpc/pseries/iommu: Add iommu_pseries_alloc_table() helper
    powerpc/kernel/iommu: Add new iommu_table_in_use() helper
    powerpc/pseries/iommu: Replace hard-coded page shift
    powerpc/numa: Update cpu_cpu_map on CPU online/offline
    powerpc/numa: Print debug statements only when required
    powerpc/numa: convert printk to pr_xxx
    powerpc/numa: Drop dbg in favour of pr_debug
    powerpc/smp: Enable CACHE domain for shared processor
    powerpc/smp: Update cpu_core_map on all PowerPc systems
    ...

    Linus Torvalds
     

31 Aug, 2021

1 commit

  • Pull irq updates from Thomas Gleixner:
    "Updates to the interrupt core and driver subsystems:

    Core changes:

    - The usual set of small fixes and improvements all over the place,
    but nothing stands out

    MSI changes:

    - Further consolidation of the PCI/MSI interrupt chip code

    - Make MSI sysfs code independent of PCI/MSI and expose the MSI
    interrupts of platform devices in the same way as PCI exposes them.

    Driver changes:

    - Support for ARM GICv3 EPPI partitions

    - Treewide conversion to generic_handle_domain_irq() for all chained
    interrupt controllers

    - Conversion to bitmap_zalloc() throughout the irq chip drivers

    - The usual set of small fixes and improvements"

    * tag 'irq-core-2021-08-30' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (57 commits)
    platform-msi: Add ABI to show msi_irqs of platform devices
    genirq/msi: Move MSI sysfs handling from PCI to MSI core
    genirq/cpuhotplug: Demote debug printk to KERN_DEBUG
    irqchip/qcom-pdc: Trim unused levels of the interrupt hierarchy
    irqdomain: Export irq_domain_disconnect_hierarchy()
    irqchip/gic-v3: Fix priority comparison when non-secure priorities are used
    irqchip/apple-aic: Fix irq_disable from within irq handlers
    pinctrl/rockchip: drop the gpio related codes
    gpio/rockchip: drop irq_gc_lock/irq_gc_unlock for irq set type
    gpio/rockchip: support next version gpio controller
    gpio/rockchip: use struct rockchip_gpio_regs for gpio controller
    gpio/rockchip: add driver for rockchip gpio
    dt-bindings: gpio: change items restriction of clock for rockchip,gpio-bank
    pinctrl/rockchip: add pinctrl device to gpio bank struct
    pinctrl/rockchip: separate struct rockchip_pin_bank to a head file
    pinctrl/rockchip: always enable clock for gpio controller
    genirq: Fix kernel doc indentation
    EDAC/altera: Convert to generic_handle_domain_irq()
    powerpc: Bulk conversion to generic_handle_domain_irq()
    nios2: Bulk conversion to generic_handle_domain_irq()
    ...

    Linus Torvalds
     

30 Aug, 2021

1 commit

  • …m-platforms into irq/core

    Pull irqchip updates from Marc Zyngier:

    - API updates:

    - Treewide conversion to generic_handle_domain_irq() for anything
    that looks like a chained interrupt controller

    - Update the irqdomain documentation

    - Use of bitmap_zalloc() throughout the tree

    - New functionalities:

    - Support for GICv3 EPPI partitions

    - Fixes:

    - Qualcomm PDC hierarchy fixes

    - Yet another priority decoding fix for the GICv3 pseudo-NMIs

    - Fix the apple-aic driver irq_eoi() callback to always unmask
    the interrupt

    - Properly handle edge interrupts on loongson-pch-pic

    - Let the mtk-sysirq driver advertise IRQCHIP_SKIP_SET_WAKE

    Link: https://lore.kernel.org/r/20210828121013.2647964-1-maz@kernel.org

    Thomas Gleixner
     

24 Aug, 2021

2 commits

  • Move PCI's MSI sysfs code to the irq core so that other busses such as
    platform can reuse it.

    Signed-off-by: Barry Song
    Signed-off-by: Thomas Gleixner
    Acked-by: Greg Kroah-Hartman
    Acked-by: Bjorn Helgaas
    Acked-by: Marc Zyngier
    Link: https://lore.kernel.org/r/20210813035628.6844-2-21cnbao@gmail.com

    Barry Song
     
  • This sort of information is only generally useful when debugging.
    No need to have these sprinkled through the kernel log otherwise.

    Real world problem:

    During pre-release testing these have an affect on performance on
    real products. To the point where so much logging builds up, that
    it sets off the watchdog(s) on some high profile consumer devices.

    Signed-off-by: Lee Jones
    Signed-off-by: Thomas Gleixner
    Link: https://lore.kernel.org/r/20210816134817.1503661-1-lee.jones@linaro.org

    Lee Jones
     

23 Aug, 2021

1 commit


13 Aug, 2021

1 commit


11 Aug, 2021

4 commits

  • Fix all kernel-doc warnings in these 3 files and do some simple editing
    (capitalize acronyms, capitalize Linux).

    kernel/irq/pm.c:235: warning: expecting prototype for irq_pm_syscore_ops(). Prototype was for irq_pm_syscore_resume() instead
    kernel/irq/msi.c:530: warning: expecting prototype for __msi_domain_free_irqs(). Prototype was for msi_domain_free_irqs() instead
    kernel/irq/msi.c:31: warning: No description found for return value of 'alloc_msi_entry'
    kernel/irq/msi.c:103: warning: No description found for return value of 'msi_domain_set_affinity'
    kernel/irq/msi.c:288: warning: No description found for return value of 'msi_create_irq_domain'
    kernel/irq/msi.c:499: warning: No description found for return value of 'msi_domain_alloc_irqs'
    kernel/irq/msi.c:545: warning: No description found for return value of 'msi_get_domain_info'
    kernel/irq/ipi.c:264: warning: expecting prototype for ipi_send_mask(). Prototype was for __ipi_send_mask() instead
    kernel/irq/ipi.c:25: warning: No description found for return value of 'irq_reserve_ipi'
    kernel/irq/ipi.c:116: warning: No description found for return value of 'irq_destroy_ipi'
    kernel/irq/ipi.c:163: warning: No description found for return value of 'ipi_get_hwirq'
    kernel/irq/ipi.c:222: warning: No description found for return value of '__ipi_send_single'
    kernel/irq/ipi.c:308: warning: No description found for return value of 'ipi_send_single'
    kernel/irq/ipi.c:329: warning: No description found for return value of 'ipi_send_mask'

    Signed-off-by: Randy Dunlap
    Signed-off-by: Thomas Gleixner
    Link: https://lore.kernel.org/r/20210810234835.12547-1-rdunlap@infradead.org

    Randy Dunlap
     
  • Return a negative error code from the error handling case instead of 0, as
    done elsewhere in this function.

    Fixes: f52da98d900e ("genirq/timings: Add selftest for irqs circular buffer")
    Reported-by: Hulk Robot
    Signed-off-by: Zhen Lei
    Signed-off-by: Thomas Gleixner
    Link: https://lore.kernel.org/r/20210811093333.2376-1-thunder.leizhen@huawei.com

    Zhen Lei
     
  • Describe the arguments correctly.

    Fixes the following W=1 kernel build warning(s):

    kernel/irq/matrix.c:287: warning: Function parameter or
    member 'msk' not described in 'irq_matrix_alloc_managed'
    kernel/irq/matrix.c:287: warning: Function parameter or
    member 'mapped_cpu' not described in 'irq_matrix_alloc_managed'
    kernel/irq/matrix.c:287: warning: Excess function
    parameter 'cpu' description in 'irq_matrix_alloc_managed'

    Signed-off-by: Baokun Li
    Signed-off-by: Thomas Gleixner
    Link: https://lore.kernel.org/r/20210605063413.684085-1-libaokun1@huawei.com

    Baokun Li
     
  • With CONFIG_IRQ_FORCED_THREADING=y, testing the boolean force_irqthreads
    could incur a cache line miss in invoke_softirq() and other places.

    Replace the test with a static key to avoid the potential cache miss.

    [ tglx: Dropped the IDE part, removed the export and updated blk-mq ]

    Suggested-by: Eric Dumazet
    Signed-off-by: Tanner Love
    Signed-off-by: Thomas Gleixner
    Reviewed-by: Eric Dumazet
    Reviewed-by: Kees Cook
    Link: https://lore.kernel.org/r/20210602180338.3324213-1-tannerlove.kernel@gmail.com

    Tanner Love
     

10 Aug, 2021

8 commits

  • msi_domain_alloc_irqs() invokes irq_domain_activate_irq(), but
    msi_domain_free_irqs() does not enforce deactivation before tearing down
    the interrupts.

    This happens when PCI/MSI interrupts are set up and never used before being
    torn down again, e.g. in error handling pathes. The only place which cleans
    that up is the error handling path in msi_domain_alloc_irqs().

    Move the cleanup from msi_domain_alloc_irqs() into msi_domain_free_irqs()
    to cure that.

    Fixes: f3b0946d629c ("genirq/msi: Make sure PCI MSIs are activated early")
    Signed-off-by: Bixuan Cui
    Signed-off-by: Thomas Gleixner
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20210518033117.78104-1-cuibixuan@huawei.com

    Bixuan Cui
     
  • When the interrupt interval is greater than 2 ^ PREDICTION_BUFFER_SIZE *
    PREDICTION_FACTOR us and less than 1s, the calculated index will be greater
    than the length of irqs->ema_time[]. Check the calculated index before
    using it to prevent array overflow.

    Fixes: 23aa3b9a6b7d ("genirq/timings: Encapsulate storing function")
    Signed-off-by: Ben Dai
    Signed-off-by: Thomas Gleixner
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20210425150903.25456-1-ben.dai9703@gmail.com

    Ben Dai
     
  • Make use of the struct_size() helper instead of an open-coded version,
    in order to avoid any potential type mistakes or integer overflows
    that, in the worst scenario, could lead to heap overflows.

    This code was detected with the help of Coccinelle and, audited and
    fixed manually.

    Signed-off-by: Gustavo A. R. Silva
    Signed-off-by: Thomas Gleixner
    Link: https://lore.kernel.org/r/20210513212729.GA214145@embeddedor

    Gustavo A. R. Silva
     
  • PCI MSI interrupt numbers are now mapped in a PCI-MSI domain but the
    underlying calls handling the passthrough of the interrupt in the
    guest need a number in the XIVE IRQ domain.

    Use the IRQ data mapped in the XIVE IRQ domain and not the one in the
    PCI-MSI domain.

    Signed-off-by: Cédric Le Goater
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20210701132750.1475580-16-clg@kaod.org

    Cédric Le Goater
     
  • Clarify wording and document commonly used IRQF_ONESHOT flag.

    Signed-off-by: Joel Savitz
    Signed-off-by: Thomas Gleixner
    Link: https://lore.kernel.org/r/20210731050740.444454-1-jsavitz@redhat.com

    Joel Savitz
     
  • The functions get_online_cpus() and put_online_cpus() have been
    deprecated during the CPU hotplug rework. They map directly to
    cpus_read_lock() and cpus_read_unlock().

    Replace deprecated CPU-hotplug functions with the official version.
    The behavior remains unchanged.

    Signed-off-by: Sebastian Andrzej Siewior
    Signed-off-by: Thomas Gleixner
    Link: https://lore.kernel.org/r/20210803141621.780504-26-bigeasy@linutronix.de

    Sebastian Andrzej Siewior
     
  • to pick up fixes on which further changes depend on.

    Thomas Gleixner
     
  • X86 IO/APIC and MSI interrupts (when used without interrupts remapping)
    require that the affinity setup on startup is done before the interrupt is
    enabled for the first time as the non-remapped operation mode cannot safely
    migrate enabled interrupts from arbitrary contexts. Provide a new irq chip
    flag which allows affected hardware to request this.

    This has to be opt-in because there have been reports in the past that some
    interrupt chips cannot handle affinity setting before startup.

    Fixes: 18404756765c ("genirq: Expose default irq affinity mask (take 3)")
    Signed-off-by: Thomas Gleixner
    Tested-by: Marc Zyngier
    Reviewed-by: Marc Zyngier
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20210729222542.779791738@linutronix.de

    Thomas Gleixner
     

31 Jul, 2021

1 commit


09 Jul, 2021

1 commit


28 Jun, 2021

2 commits

  • Fix kernel-doc warning in irqdesc.c:

    ../kernel/irq/irqdesc.c:692: warning: Excess function parameter 'lookup' description in 'handle_domain_irq'

    Fixes: e1c054918c6c ("genirq: Move non-irqdomain handle_domain_irq() handling into ARM's handle_IRQ()")
    Signed-off-by: Randy Dunlap
    Signed-off-by: Marc Zyngier
    Link: https://lore.kernel.org/r/20210628004044.9011-1-rdunlap@infradead.org

    Randy Dunlap
     
  • …m-platforms into irq/core

    Pull irqchip updates from Marc Zyngier:

    - Revamped the irqdomain internals to consistently cache irqdata

    - Expose a new API to simplify IRQ handling involving an irqdomain by
    not using the IRQ number

    - Convert all the irqchip drivers to this new API

    - Allow the Qualcomm PDC driver to be compiled as a module

    - Fix HiSi MBIGEN compile warning when CONFIG_ACPI isn't selected

    - Remove a bunch of spurious printks on error paths

    - The obligatory couple of DT updates

    Thomas Gleixner
     

10 Jun, 2021

8 commits