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
     

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
     

24 Aug, 2021

1 commit


11 Aug, 2021

1 commit

  • 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
     

10 Aug, 2021

1 commit

  • 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
     

22 Mar, 2021

1 commit

  • Fix ~36 single-word typos in the IRQ, irqchip and irqdomain code comments.

    Signed-off-by: Ingo Molnar
    Cc: Thomas Gleixner
    Cc: Marc Zyngier
    Cc: Borislav Petkov
    Cc: Peter Zijlstra
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Ingo Molnar

    Ingo Molnar
     

30 Jan, 2021

1 commit

  • When MSI_FLAG_ACTIVATE_EARLY is set (which is the case for PCI),
    __msi_domain_alloc_irqs() performs the activation of the interrupt (which
    in the case of PCI results in the endpoint being programmed) as soon as the
    interrupt is allocated.

    But it appears that this is only done for the first vector, introducing an
    inconsistent behaviour for PCI Multi-MSI.

    Fix it by iterating over the number of vectors allocated to each MSI
    descriptor. This is easily achieved by introducing a new
    "for_each_msi_vector" iterator, together with a tiny bit of refactoring.

    Fixes: f3b0946d629c ("genirq/msi: Make sure PCI MSIs are activated early")
    Reported-by: Shameer Kolothum
    Signed-off-by: Marc Zyngier
    Signed-off-by: Thomas Gleixner
    Tested-by: Shameer Kolothum
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20210123122759.1781359-1-maz@kernel.org

    Marc Zyngier
     

19 Dec, 2020

1 commit

  • Since commit 5fe71d271df8 ("irqchip/gic-v3-its: Tag ITS device as shared if
    allocating for a proxy device"), some of the devices are wrongly marked as
    "shared" by the ITS driver on systems equipped with the ITS(es). The
    problem is that the @info->flags may not be initialized anywhere and we end
    up looking at random bits on the stack. That's obviously not good.

    We can perform the initialization in the IRQ core layer before calling
    msi_domain_prepare_irqs(), which is neat enough.

    Fixes: 5fe71d271df8 ("irqchip/gic-v3-its: Tag ITS device as shared if allocating for a proxy device")
    Signed-off-by: Zenghui Yu
    Signed-off-by: Marc Zyngier
    Link: https://lore.kernel.org/r/20201218060039.1770-1-yuzenghui@huawei.com

    Zenghui Yu
     

16 Sep, 2020

3 commits

  • To support MSI irq domains which do not fit at all into the regular MSI
    irqdomain scheme, like the XEN MSI interrupt management for PV/HVM/DOM0,
    it's necessary to allow to override the alloc/free implementation.

    This is a preperatory step to switch X86 away from arch_*_msi_irqs() and
    store the irq domain pointer right in struct device.

    No functional change for existing MSI irq domain users.

    Aside of the evil XEN wrapper this is also useful for special MSI domains
    which need to do extra alloc/free work before/after calling the generic
    core function. Work like allocating/freeing MSI descriptors, MSI storage
    space etc.

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Marc Zyngier
    Link: https://lore.kernel.org/r/20200826112333.526797548@linutronix.de

    Thomas Gleixner
     
  • PCI devices behind a VMD bus are not subject to interrupt remapping, but
    the irq domain for VMD MSI cannot be distinguished from a regular PCI/MSI
    irq domain.

    Add a new domain bus token and allow it in the bus token check in
    msi_check_reservation_mode() to keep the functionality the same once VMD
    uses this token.

    Signed-off-by: Thomas Gleixner
    Acked-by: Marc Zyngier
    Acked-by: Jon Derrick
    Link: https://lore.kernel.org/r/20200826112332.954409970@linutronix.de

    Thomas Gleixner
     
  • pci_msi_get_hwirq() and pci_msi_set_desc are not longer special. Enable the
    generic MSI domain ops in the core and PCI MSI code unconditionally and get
    rid of the x86 specific implementations in the X86 MSI code and in the
    hyperv PCI driver.

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Marc Zyngier
    Link: https://lore.kernel.org/r/20200826112332.564274859@linutronix.de

    Thomas Gleixner
     

01 Feb, 2020

1 commit

  • Evan tracked down a subtle race between the update of the MSI message and
    the device raising an interrupt internally on PCI devices which do not
    support MSI masking. The update of the MSI message is non-atomic and
    consists of either 2 or 3 sequential 32bit wide writes to the PCI config
    space.

    - Write address low 32bits
    - Write address high 32bits (If supported by device)
    - Write data

    When an interrupt is migrated then both address and data might change, so
    the kernel attempts to mask the MSI interrupt first. But for MSI masking is
    optional, so there exist devices which do not provide it. That means that
    if the device raises an interrupt internally between the writes then a MSI
    message is sent built from half updated state.

    On x86 this can lead to spurious interrupts on the wrong interrupt
    vector when the affinity setting changes both address and data. As a
    consequence the device interrupt can be lost causing the device to
    become stuck or malfunctioning.

    Evan tried to handle that by disabling MSI accross an MSI message
    update. That's not feasible because disabling MSI has issues on its own:

    If MSI is disabled the PCI device is routing an interrupt to the legacy
    INTx mechanism. The INTx delivery can be disabled, but the disablement is
    not working on all devices.

    Some devices lose interrupts when both MSI and INTx delivery are disabled.

    Another way to solve this would be to enforce the allocation of the same
    vector on all CPUs in the system for this kind of screwed devices. That
    could be done, but it would bring back the vector space exhaustion problems
    which got solved a few years ago.

    Fortunately the high address (if supported by the device) is only relevant
    when X2APIC is enabled which implies interrupt remapping. In the interrupt
    remapping case the affinity setting is happening at the interrupt remapping
    unit and the PCI MSI message is programmed only once when the PCI device is
    initialized.

    That makes it possible to solve it with a two step update:

    1) Target the MSI msg to the new vector on the current target CPU

    2) Target the MSI msg to the new vector on the new target CPU

    In both cases writing the MSI message is only changing a single 32bit word
    which prevents the issue of inconsistency.

    After writing the final destination it is necessary to check whether the
    device issued an interrupt while the intermediate state #1 (new vector,
    current CPU) was in effect.

    This is possible because the affinity change is always happening on the
    current target CPU. The code runs with interrupts disabled, so the
    interrupt can be detected by checking the IRR of the local APIC. If the
    vector is pending in the IRR then the interrupt is retriggered on the new
    target CPU by sending an IPI for the associated vector on the target CPU.

    This can cause spurious interrupts on both the local and the new target
    CPU.

    1) If the new vector is not in use on the local CPU and the device
    affected by the affinity change raised an interrupt during the
    transitional state (step #1 above) then interrupt entry code will
    ignore that spurious interrupt. The vector is marked so that the
    'No irq handler for vector' warning is supressed once.

    2) If the new vector is in use already on the local CPU then the IRR check
    might see an pending interrupt from the device which is using this
    vector. The IPI to the new target CPU will then invoke the handler of
    the device, which got the affinity change, even if that device did not
    issue an interrupt

    3) If the new vector is in use already on the local CPU and the device
    affected by the affinity change raised an interrupt during the
    transitional state (step #1 above) then the handler of the device which
    uses that vector on the local CPU will be invoked.

    expose issues in device driver interrupt handlers which are not prepared to
    handle a spurious interrupt correctly. This not a regression, it's just
    exposing something which was already broken as spurious interrupts can
    happen for a lot of reasons and all driver handlers need to be able to deal
    with them.

    Reported-by: Evan Green
    Debugged-by: Evan Green
    Signed-off-by: Thomas Gleixner
    Tested-by: Evan Green
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/87imkr4s7n.fsf@nanos.tec.linutronix.de

    Thomas Gleixner
     

19 Dec, 2018

1 commit

  • The interrupt affinity management uses straight cpumask pointers to convey
    the automatically assigned affinity masks for managed interrupts. The core
    interrupt descriptor allocation also decides based on the pointer being non
    NULL whether an interrupt is managed or not.

    Devices which use managed interrupts usually have two classes of
    interrupts:

    - Interrupts for multiple device queues
    - Interrupts for general device management

    Currently both classes are treated the same way, i.e. as managed
    interrupts. The general interrupts get the default affinity mask assigned
    while the device queue interrupts are spread out over the possible CPUs.

    Treating the general interrupts as managed is both a limitation and under
    certain circumstances a bug. Assume the following situation:

    default_irq_affinity = 4..7

    So if CPUs 4-7 are offlined, then the core code will shut down the device
    management interrupts because the last CPU in their affinity mask went
    offline.

    It's also a limitation because it's desired to allow manual placement of
    the general device interrupts for various reasons. If they are marked
    managed then the interrupt affinity setting from both user and kernel space
    is disabled.

    To remedy that situation it's required to convey more information than the
    cpumasks through various interfaces related to interrupt descriptor
    allocation.

    Instead of adding yet another argument, create a new data structure
    'irq_affinity_desc' which for now just contains the cpumask. This struct
    can be expanded to convey auxilliary information in the next step.

    No functional change, just preparatory work.

    [ tglx: Simplified logic and clarified changelog ]

    Suggested-by: Thomas Gleixner
    Suggested-by: Bjorn Helgaas
    Signed-off-by: Dou Liyang
    Signed-off-by: Thomas Gleixner
    Cc: linux-pci@vger.kernel.org
    Cc: kashyap.desai@broadcom.com
    Cc: shivasharan.srikanteshwara@broadcom.com
    Cc: sumit.saxena@broadcom.com
    Cc: ming.lei@redhat.com
    Cc: hch@lst.de
    Cc: douliyang1@huawei.com
    Link: https://lkml.kernel.org/r/20181204155122.6327-2-douliyangs@gmail.com

    Dou Liyang
     

13 May, 2018

1 commit

  • So far, MSIs have been used to signal edge-triggered interrupts, as
    a write is a good model for an edge (you can't "unwrite" something).
    On the other hand, routing zillions of wires in an SoC because you
    need level interrupts is a bit extreme.

    People have come up with a variety of schemes to support this, which
    involves sending two messages: one to signal the interrupt, and one
    to clear it. Since the kernel cannot represent this, we've ended up
    with side-band mechanisms that are pretty awful.

    Instead, let's acknoledge the requirement, and ensure that, under the
    right circumstances, the irq_compose_msg and irq_write_msg can take
    as a parameter an array of two messages instead of a pointer to a
    single one. We also add some checking that the compose method only
    clobbers the second message if the MSI domain has been created with
    the MSI_FLAG_LEVEL_CAPABLE flags.

    Signed-off-by: Marc Zyngier
    Signed-off-by: Thomas Gleixner
    Cc: Rob Herring
    Cc: Jason Cooper
    Cc: Ard Biesheuvel
    Cc: Srinivas Kandagatla
    Cc: Thomas Petazzoni
    Cc: Miquel Raynal
    Link: https://lkml.kernel.org/r/20180508121438.11301-2-marc.zyngier@arm.com

    Marc Zyngier
     

20 Mar, 2018

2 commits

  • Add SPDX identifiers to files

    - which contain an explicit license boiler plate or reference

    - which do not contain a license reference and were not updated in the
    initial SPDX conversion because the license was deduced by the scanners
    via EXPORT_SYMBOL_GPL as GPL2.0 only.

    [ tglx: Moved adding identifiers from the patch which removes the
    references/boilerplate ]

    Signed-off-by: Thomas Gleixner
    Cc: Kate Stewart
    Cc: Greg Kroah-Hartman
    Cc: Philippe Ombredanne
    Link: https://lkml.kernel.org/r/20180314212030.668321222@linutronix.de

    Thomas Gleixner
     
  • Remove pointless references to the file name itself and condense the
    information so it wastes less space.

    Signed-off-by: Thomas Gleixner
    Acked-by: Marc Zyngier
    Cc: Kate Stewart
    Cc: Greg Kroah-Hartman
    Cc: Philippe Ombredanne
    Link: https://lkml.kernel.org/r/20180314212030.412095827@linutronix.de

    Thomas Gleixner
     

30 Dec, 2017

2 commits

  • The new reservation mode for interrupts assigns a dummy vector when the
    interrupt is allocated and assigns a real vector when the interrupt is
    requested. The reservation mode prevents vector pressure when devices with
    a large amount of queues/interrupts are initialized, but only a minimal
    subset of those queues/interrupts is actually used.

    This mode has an issue with MSI interrupts which cannot be masked. If the
    driver is not careful or the hardware emits an interrupt before the device
    irq is requestd by the driver then the interrupt ends up on the dummy
    vector as a spurious interrupt which can cause malfunction of the device or
    in the worst case a lockup of the machine.

    Change the logic for the reservation mode so that the early activation of
    MSI interrupts checks whether:

    - the device is a PCI/MSI device
    - the reservation mode of the underlying irqdomain is activated
    - PCI/MSI masking is globally enabled
    - the PCI/MSI device uses either MSI-X, which supports masking, or
    MSI with the maskbit supported.

    If one of those conditions is false, then clear the reservation mode flag
    in the irq data of the interrupt and invoke irq_domain_activate_irq() with
    the reserve argument cleared. In the x86 vector code, clear the can_reserve
    flag in the vector allocation data so a subsequent free_irq() won't create
    the same situation again. The interrupt stays assigned to a real vector
    until pci_disable_msi() is invoked and all allocations are undone.

    Fixes: 4900be83602b ("x86/vector/msi: Switch to global reservation mode")
    Reported-by: Alexandru Chirvasitu
    Reported-by: Andy Shevchenko
    Signed-off-by: Thomas Gleixner
    Tested-by: Alexandru Chirvasitu
    Tested-by: Andy Shevchenko
    Cc: Dou Liyang
    Cc: Pavel Machek
    Cc: Maciej W. Rozycki
    Cc: Mikael Pettersson
    Cc: Josh Poulson
    Cc: Mihai Costache
    Cc: Stephen Hemminger
    Cc: Marc Zyngier
    Cc: linux-pci@vger.kernel.org
    Cc: Haiyang Zhang
    Cc: Dexuan Cui
    Cc: Simon Xiao
    Cc: Saeed Mahameed
    Cc: Jork Loeser
    Cc: Bjorn Helgaas
    Cc: devel@linuxdriverproject.org
    Cc: KY Srinivasan
    Cc: Alan Cox
    Cc: Sakari Ailus ,
    Cc: linux-media@vger.kernel.org
    Link: https://lkml.kernel.org/r/alpine.DEB.2.20.1712291406420.1899@nanos
    Link: https://lkml.kernel.org/r/alpine.DEB.2.20.1712291409460.1899@nanos

    Thomas Gleixner
     
  • When analyzing the fallout of the x86 vector allocation rework it turned
    out that the error handling in msi_domain_alloc_irqs() is broken.

    If MSI_FLAG_MUST_REACTIVATE is set for a MSI domain then it clears the
    activation flag for a successfully initialized msi descriptor. If a
    subsequent initialization fails then the error handling code path does not
    deactivate the interrupt because the activation flag got cleared.

    Move the clearing of the activation flag outside of the initialization loop
    so that an eventual failure can be cleaned up correctly.

    Fixes: 22d0b12f3560 ("genirq/irqdomain: Add force reactivation flag to irq domains")
    Signed-off-by: Thomas Gleixner
    Tested-by: Alexandru Chirvasitu
    Tested-by: Andy Shevchenko
    Cc: Dou Liyang
    Cc: Pavel Machek
    Cc: Maciej W. Rozycki
    Cc: Mikael Pettersson
    Cc: Josh Poulson
    Cc: Mihai Costache
    Cc: Stephen Hemminger
    Cc: Marc Zyngier
    Cc: linux-pci@vger.kernel.org
    Cc: Haiyang Zhang
    Cc: Dexuan Cui
    Cc: Simon Xiao
    Cc: Saeed Mahameed
    Cc: Jork Loeser
    Cc: Bjorn Helgaas
    Cc: devel@linuxdriverproject.org
    Cc: KY Srinivasan
    Cc: Alan Cox
    Cc: Sakari Ailus ,
    Cc: linux-media@vger.kernel.org

    Thomas Gleixner
     

26 Sep, 2017

5 commits

  • Allow irqdomains to tell the core code, that after early activation the
    interrupt needs to be reactivated at request_irq() time.

    This allows reservation of vectors at early activation time and actual
    vector assignment at request_irq() time.

    Signed-off-by: Thomas Gleixner
    Tested-by: Juergen Gross
    Tested-by: Yu Chen
    Acked-by: Juergen Gross
    Cc: Boris Ostrovsky
    Cc: Tony Luck
    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: Paolo Bonzini
    Cc: Rui Zhang
    Cc: "K. Y. Srinivasan"
    Cc: Arjan van de Ven
    Cc: Dan Williams
    Cc: Len Brown
    Link: https://lkml.kernel.org/r/20170913213153.106242536@linutronix.de

    Thomas Gleixner
     
  • Propagate the early activation mode to the irqdomain activate()
    callbacks. This is required for the upcoming reservation, late vector
    assignment scheme, so that the early activation call can act accordingly.

    Signed-off-by: Thomas Gleixner
    Tested-by: Juergen Gross
    Tested-by: Yu Chen
    Acked-by: Juergen Gross
    Cc: Boris Ostrovsky
    Cc: Tony Luck
    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: Paolo Bonzini
    Cc: Rui Zhang
    Cc: "K. Y. Srinivasan"
    Cc: Arjan van de Ven
    Cc: Dan Williams
    Cc: Len Brown
    Link: https://lkml.kernel.org/r/20170913213153.028353660@linutronix.de

    Thomas Gleixner
     
  • Allow irq_domain_activate_irq() to fail. This is required to support a
    reservation and late vector assignment scheme.

    Signed-off-by: Thomas Gleixner
    Tested-by: Juergen Gross
    Tested-by: Yu Chen
    Acked-by: Juergen Gross
    Cc: Boris Ostrovsky
    Cc: Tony Luck
    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: Paolo Bonzini
    Cc: Rui Zhang
    Cc: "K. Y. Srinivasan"
    Cc: Arjan van de Ven
    Cc: Dan Williams
    Cc: Len Brown
    Link: https://lkml.kernel.org/r/20170913213152.933882227@linutronix.de

    Thomas Gleixner
     
  • The irq_domain_ops.activate() callback has no return value and no way to
    tell the function that the activation is early.

    The upcoming changes to support a reservation scheme which allows to assign
    interrupt vectors on x86 only when the interrupt is actually requested
    requires:

    - A return value, so activation can fail at request_irq() time

    - Information that the activate invocation is early, i.e. before
    request_irq().

    Signed-off-by: Thomas Gleixner
    Tested-by: Juergen Gross
    Tested-by: Yu Chen
    Acked-by: Juergen Gross
    Cc: Boris Ostrovsky
    Cc: Tony Luck
    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: Paolo Bonzini
    Cc: Rui Zhang
    Cc: "K. Y. Srinivasan"
    Cc: Arjan van de Ven
    Cc: Dan Williams
    Cc: Len Brown
    Link: https://lkml.kernel.org/r/20170913213152.848490816@linutronix.de

    Thomas Gleixner
     
  • For debugging the allocation of unused or potentially leaked interrupt
    descriptor it's helpful to have some information about the site which
    allocated them. In case of MSI this is simple because the caller hands the
    device struct pointer into the domain allocation function.

    Duplicate the device name and show it in the debugfs entry of the interrupt
    descriptor.

    Signed-off-by: Thomas Gleixner
    Tested-by: Juergen Gross
    Tested-by: Yu Chen
    Acked-by: Juergen Gross
    Cc: Boris Ostrovsky
    Cc: Tony Luck
    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: Paolo Bonzini
    Cc: Rui Zhang
    Cc: "K. Y. Srinivasan"
    Cc: Arjan van de Ven
    Cc: Dan Williams
    Cc: Len Brown
    Link: https://lkml.kernel.org/r/20170913213152.433038426@linutronix.de

    Thomas Gleixner
     

06 Sep, 2017

1 commit

  • On allocating the interrupts routed via a wire-to-MSI bridge, the allocator
    iterates over the MSI descriptors to build the hierarchy, but fails to use
    the descriptor interrupt number, and instead uses the base number,
    generating the wrong IRQ domain mappings.

    The fix is to use the MSI descriptor interrupt number when setting up
    the interrupt instead of the base interrupt for the allocation range.

    The only saving grace is that although the MSI descriptors are allocated
    in bulk, the wired interrupts are only allocated one by one (so
    desc->irq == virq) and the bug went unnoticed so far.

    Fixes: 2145ac9310b60 ("genirq/msi: Add msi_domain_populate_irqs")
    Signed-off-by: John Keeping
    Signed-off-by: Thomas Gleixner
    Reviewed-by: Marc Zyngier
    Cc: stable@vger.kernel.org
    Link: http://lkml.kernel.org/r/20170906103540.373864a2.john@metanate.com

    John Keeping
     

23 Jun, 2017

2 commits

  • 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: Marc Zyngier
    Signed-off-by: Thomas Gleixner

    Marc Zyngier
     
  • Prevent overwriting an already assigned domain name. Remove the extra check
    for chip->name, because if domain->name is NULL overwriting it with NULL is
    not a problem.

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

    Thomas Gleixner
     

23 May, 2017

1 commit

  • In order to ease debug, let's populate the domain name upfront, before any
    MSI gets requested. This allows the domain to appear in the
    irq_domain_mapping, and the user to easily find the expected data.

    Signed-off-by: Marc Zyngier
    Link: http://lkml.kernel.org/r/20170512115538.10767-4-marc.zyngier@arm.com
    Signed-off-by: Thomas Gleixner

    Marc Zyngier
     

23 Jan, 2017

1 commit


22 Nov, 2016

1 commit

  • The generic MSI layer doesn't have any PCI ties anymore, and the
    build hack should have been removed some time ago.

    Fixes: d9109698be6e ("genirq: Introduce msi_domain_alloc/free_irqs()")
    Signed-off-by: Marc Zyngier
    Link: http://lkml.kernel.org/r/1479806476-20801-1-git-send-email-marc.zyngier@arm.com
    Signed-off-by: Thomas Gleixner

    Marc Zyngier
     

15 Sep, 2016

1 commit

  • For irq spreading want to store affinity masks in the msi_entry. Add the
    infrastructure for it.

    We allocate an array of cpumasks with an array size of the number of used
    vectors in the entry, so we can hand in the information per linux interrupt
    later.

    As we hand in the number of used vectors, we assign them right
    away. Convert all the call sites.

    Signed-off-by: Thomas Gleixner
    Cc: axboe@fb.com
    Cc: keith.busch@intel.com
    Cc: agordeev@redhat.com
    Cc: linux-block@vger.kernel.org
    Cc: Christoph Hellwig
    Link: http://lkml.kernel.org/r/1473862739-15032-2-git-send-email-hch@lst.de

    Thomas Gleixner
     

09 Aug, 2016

1 commit

  • Bharat Kumar Gogada reported issues with the generic MSI code, where the
    end-point ended up with garbage in its MSI configuration (both for the vector
    and the message).

    It turns out that the two MSI paths in the kernel are doing slightly different
    things:

    generic MSI: disable MSI -> allocate MSI -> enable MSI -> setup EP
    PCI MSI: disable MSI -> allocate MSI -> setup EP -> enable MSI

    And it turns out that end-points are allowed to latch the content of the MSI
    configuration registers as soon as MSIs are enabled. In Bharat's case, the
    end-point ends up using whatever was there already, which is not what you
    want.

    In order to make things converge, we introduce a new MSI domain flag
    (MSI_FLAG_ACTIVATE_EARLY) that is unconditionally set for PCI/MSI. When set,
    this flag forces the programming of the end-point as soon as the MSIs are
    allocated.

    A consequence of this is that we have an extra activate in irq_startup, but
    that should be without much consequence.

    tglx:

    - Several people reported a VMWare regression with PCI/MSI-X passthrough. It
    turns out that the patch also cures that issue.

    - We need to have a look at the MSI disable interrupt path, where we write
    the msg to all zeros without disabling MSI in the PCI device. Is that
    correct?

    Fixes: 52f518a3a7c2 "x86/MSI: Use hierarchical irqdomains to manage MSI interrupts"
    Reported-and-tested-by: Bharat Kumar Gogada
    Reported-and-tested-by: Foster Snowhill
    Reported-by: Matthias Prager
    Reported-by: Jason Taylor
    Signed-off-by: Marc Zyngier
    Acked-by: Bjorn Helgaas
    Cc: linux-pci@vger.kernel.org
    Cc: stable@vger.kernel.org
    Link: http://lkml.kernel.org/r/1468426713-31431-1-git-send-email-marc.zyngier@arm.com
    Signed-off-by: Thomas Gleixner

    Marc Zyngier
     

04 Jul, 2016

4 commits

  • virq is not required to be the same for all msi descs. Use the base irq number
    from the desc in the debug printk.

    Reported-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Thomas Gleixner
     
  • Allow the MSI code to provide affinity hints per MSI descriptor.

    Signed-off-by: Thomas Gleixner
    Cc: Christoph Hellwig
    Cc: linux-block@vger.kernel.org
    Cc: linux-pci@vger.kernel.org
    Cc: linux-nvme@lists.infradead.org
    Cc: axboe@fb.com
    Cc: agordeev@redhat.com
    Link: http://lkml.kernel.org/r/1467621574-8277-6-git-send-email-hch@lst.de
    Signed-off-by: Thomas Gleixner

    Thomas Gleixner
     
  • Add an extra argument to the irq(domain) allocation functions, so we can hand
    down affinity hints to the allocator. Thats necessary to implement proper
    support for multiqueue devices.

    Signed-off-by: Thomas Gleixner
    Cc: Christoph Hellwig
    Cc: linux-block@vger.kernel.org
    Cc: linux-pci@vger.kernel.org
    Cc: linux-nvme@lists.infradead.org
    Cc: axboe@fb.com
    Cc: agordeev@redhat.com
    Link: http://lkml.kernel.org/r/1467621574-8277-4-git-send-email-hch@lst.de
    Signed-off-by: Thomas Gleixner

    Thomas Gleixner
     
  • No user and we definitely don't want to grow one.

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Bart Van Assche
    Cc: Christoph Hellwig
    Cc: linux-block@vger.kernel.org
    Cc: linux-pci@vger.kernel.org
    Cc: linux-nvme@lists.infradead.org
    Cc: axboe@fb.com
    Cc: agordeev@redhat.com
    Link: http://lkml.kernel.org/r/1467621574-8277-2-git-send-email-hch@lst.de
    Signed-off-by: Thomas Gleixner

    Thomas Gleixner
     

22 Jan, 2016

1 commit

  • Pull PCI updates from Bjorn Helgaas:
    "PCI changes for the v4.5 merge window:

    Enumeration:
    - Simplify config space size computation (Bjorn Helgaas)
    - Avoid iterating through ROM outside the resource window (Edward O'Callaghan)
    - Support PCIe devices with short cfg_size (Jason S. McMullan)
    - Add Netronome vendor and device IDs (Jason S. McMullan)
    - Limit config space size for Netronome NFP6000 family (Jason S. McMullan)
    - Add Netronome NFP4000 PF device ID (Simon Horman)
    - Limit config space size for Netronome NFP4000 (Simon Horman)
    - Print warnings for all invalid expansion ROM headers (Vladis Dronov)

    Resource management:
    - Fix minimum allocation address overwrite (Christoph Biedl)

    PCI device hotplug:
    - acpiphp_ibm: Fix null dereferences on null ibm_slot (Colin Ian King)
    - pciehp: Always protect pciehp_disable_slot() with hotplug mutex (Guenter Roeck)
    - shpchp: Constify hpc_ops structure (Julia Lawall)
    - ibmphp: Remove unneeded NULL test (Julia Lawall)

    Power management:
    - Make ASPM sysfs link_state_store() consistent with link_state_show() (Andy Lutomirski)

    Virtualization
    - Add function 1 DMA alias quirk for Lite-On/Plextor M6e/Marvell 88SS9183 (Tim Sander)

    MSI:
    - Remove empty pci_msi_init_pci_dev() (Bjorn Helgaas)
    - Mark PCIe/PCI (MSI) IRQ cascade handlers as IRQF_NO_THREAD (Grygorii Strashko)
    - Initialize MSI capability for all architectures (Guilherme G. Piccoli)
    - Relax msi_domain_alloc() to support parentless MSI irqdomains (Liu Jiang)

    ARM Versatile host bridge driver:
    - Remove unused pci_sys_data structures (Lorenzo Pieralisi)

    Broadcom iProc host bridge driver:
    - Hide CONFIG_PCIE_IPROC (Arnd Bergmann)
    - Do not use 0x in front of %pap (Dmitry V. Krivenok)
    - Update iProc PCIe device tree binding (Ray Jui)
    - Add PAXC interface support (Ray Jui)
    - Add iProc PCIe MSI device tree binding (Ray Jui)
    - Add iProc PCIe MSI support (Ray Jui)

    Freescale i.MX6 host bridge driver:
    - Use gpio_set_value_cansleep() (Fabio Estevam)
    - Add support for active-low reset GPIO (Petr Štetiar)

    HiSilicon host bridge driver:
    - Add support for HiSilicon Hip06 PCIe host controllers (Gabriele Paoloni)

    Intel VMD host bridge driver:
    - Export irq_domain_set_info() for module use (Keith Busch)
    - x86/PCI: Allow DMA ops specific to a PCI domain (Keith Busch)
    - Use 32 bit PCI domain numbers (Keith Busch)
    - Add driver for Intel Volume Management Device (VMD) (Keith Busch)

    Qualcomm host bridge driver:
    - Document PCIe devicetree bindings (Stanimir Varbanov)
    - Add Qualcomm PCIe controller driver (Stanimir Varbanov)
    - dts: apq8064: add PCIe devicetree node (Stanimir Varbanov)
    - dts: ifc6410: enable PCIe DT node for this board (Stanimir Varbanov)

    Renesas R-Car host bridge driver:
    - Add support for R-Car H3 to pcie-rcar (Harunobu Kurokawa)
    - Allow DT to override default window settings (Phil Edworthy)
    - Convert to DT resource parsing API (Phil Edworthy)
    - Revert "PCI: rcar: Build pcie-rcar.c only on ARM" (Phil Edworthy)
    - Remove unused pci_sys_data struct from pcie-rcar (Phil Edworthy)
    - Add runtime PM support to pcie-rcar (Phil Edworthy)
    - Add Gen2 PHY setup to pcie-rcar (Phil Edworthy)
    - Add gen2 fallback compatibility string for pci-rcar-gen2 (Simon Horman)
    - Add gen2 fallback compatibility string for pcie-rcar (Simon Horman)

    Synopsys DesignWare host bridge driver:
    - Simplify control flow (Bjorn Helgaas)
    - Make config accessor override checking symmetric (Bjorn Helgaas)
    - Ensure ATU is enabled before IO/conf space accesses (Stanimir Varbanov)

    Miscellaneous:
    - Add of_pci_get_host_bridge_resources() stub (Arnd Bergmann)
    - Check for PCI_HEADER_TYPE_BRIDGE equality, not bitmask (Bjorn Helgaas)
    - Fix all whitespace issues (Bogicevic Sasa)
    - x86/PCI: Simplify pci_bios_{read,write} (Geliang Tang)
    - Use to_pci_dev() instead of open-coding it (Geliang Tang)
    - Use kobj_to_dev() instead of open-coding it (Geliang Tang)
    - Use list_for_each_entry() to simplify code (Geliang Tang)
    - Fix typos in (Thomas Petazzoni)
    - x86/PCI: Clarify AMD Fam10h config access restrictions comment (Tomasz Nowicki)"

    * tag 'pci-v4.5-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (58 commits)
    PCI: Add function 1 DMA alias quirk for Lite-On/Plextor M6e/Marvell 88SS9183
    PCI: Limit config space size for Netronome NFP4000
    PCI: Add Netronome NFP4000 PF device ID
    x86/PCI: Add driver for Intel Volume Management Device (VMD)
    PCI/AER: Use 32 bit PCI domain numbers
    x86/PCI: Allow DMA ops specific to a PCI domain
    irqdomain: Export irq_domain_set_info() for module use
    PCI: host: Add of_pci_get_host_bridge_resources() stub
    genirq/MSI: Relax msi_domain_alloc() to support parentless MSI irqdomains
    PCI: rcar: Add Gen2 PHY setup to pcie-rcar
    PCI: rcar: Add runtime PM support to pcie-rcar
    PCI: designware: Make config accessor override checking symmetric
    PCI: ibmphp: Remove unneeded NULL test
    ARM: dts: ifc6410: enable PCIe DT node for this board
    ARM: dts: apq8064: add PCIe devicetree node
    PCI: hotplug: Use list_for_each_entry() to simplify code
    PCI: rcar: Remove unused pci_sys_data struct from pcie-rcar
    PCI: hisi: Add support for HiSilicon Hip06 PCIe host controllers
    PCI: Avoid iterating through memory outside the resource window
    PCI: acpiphp_ibm: Fix null dereferences on null ibm_slot
    ...

    Linus Torvalds
     

15 Jan, 2016

1 commit


16 Dec, 2015

2 commits


04 Nov, 2015

1 commit

  • Pull irq updates from Thomas Gleixner:
    "The irq departement delivers:

    - Rework the irqdomain core infrastructure to accomodate ACPI based
    systems. This is required to support ARM64 without creating
    artificial device tree nodes.

    - Sanitize the ACPI based ARM GIC initialization by making use of the
    new firmware independent irqdomain core

    - Further improvements to the generic MSI management

    - Generalize the irq migration on CPU hotplug

    - Improvements to the threaded interrupt infrastructure

    - Allow the migration of "chained" low level interrupt handlers

    - Allow optional force masking of interrupts in disable_irq[_nosysnc]

    - Support for two new interrupt chips - Sigh!

    - A larger set of errata fixes for ARM gicv3

    - The usual pile of fixes, updates, improvements and cleanups all
    over the place"

    * 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (71 commits)
    Document that IRQ_NONE should be returned when IRQ not actually handled
    PCI/MSI: Allow the MSI domain to be device-specific
    PCI: Add per-device MSI domain hook
    of/irq: Use the msi-map property to provide device-specific MSI domain
    of/irq: Split of_msi_map_rid to reuse msi-map lookup
    irqchip/gic-v3-its: Parse new version of msi-parent property
    PCI/MSI: Use of_msi_get_domain instead of open-coded "msi-parent" parsing
    of/irq: Use of_msi_get_domain instead of open-coded "msi-parent" parsing
    of/irq: Add support code for multi-parent version of "msi-parent"
    irqchip/gic-v3-its: Add handling of PCI requester id.
    PCI/MSI: Add helper function pci_msi_domain_get_msi_rid().
    of/irq: Add new function of_msi_map_rid()
    Docs: dt: Add PCI MSI map bindings
    irqchip/gic-v2m: Add support for multiple MSI frames
    irqchip/gic-v3: Fix translation of LPIs after conversion to irq_fwspec
    irqchip/mxs: Add Alphascale ASM9260 support
    irqchip/mxs: Prepare driver for hardware with different offsets
    irqchip/mxs: Panic if ioremap or domain creation fails
    irqdomain: Documentation updates
    irqdomain/msi: Use fwnode instead of of_node
    ...

    Linus Torvalds