21 Dec, 2019

1 commit

  • commit e045fa29e89383c717e308609edd19d2fd29e1be upstream.

    When a driver enables MSI-X, msix_program_entries() reads the MSI-X Vector
    Control register for each vector and saves it in desc->masked. Each
    register is 32 bits and bit 0 is the actual Mask bit.

    When we restored these registers during resume, we previously set the Mask
    bit if *any* bit in desc->masked was set instead of when the Mask bit
    itself was set:

    pci_restore_state
    pci_restore_msi_state
    __pci_restore_msix_state
    for_each_pci_msi_entry
    msix_mask_irq(entry, entry->masked) masked & ~PCI_MSIX_ENTRY_CTRL_MASKBIT
    if (flag)
    Signed-off-by: Bjorn Helgaas
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman

    Jian-Hong Pan
     

22 Jul, 2019

1 commit

  • Pull NTB updates from Jon Mason:
    "New feature to add support for NTB virtual MSI interrupts, the ability
    to test and use this feature in the NTB transport layer.

    Also, bug fixes for the AMD and Switchtec drivers, as well as some
    general patches"

    * tag 'ntb-5.3' of git://github.com/jonmason/ntb: (22 commits)
    NTB: Describe the ntb_msi_test client in the documentation.
    NTB: Add MSI interrupt support to ntb_transport
    NTB: Add ntb_msi_test support to ntb_test
    NTB: Introduce NTB MSI Test Client
    NTB: Introduce MSI library
    NTB: Rename ntb.c to support multiple source files in the module
    NTB: Introduce functions to calculate multi-port resource index
    NTB: Introduce helper functions to calculate logical port number
    PCI/switchtec: Add module parameter to request more interrupts
    PCI/MSI: Support allocating virtual MSI interrupts
    ntb_hw_switchtec: Fix setup MW with failure bug
    ntb_hw_switchtec: Skip unnecessary re-setup of shared memory window for crosslink case
    ntb_hw_switchtec: Remove redundant steps of switchtec_ntb_reinit_peer() function
    NTB: correct ntb_dev_ops and ntb_dev comment typos
    NTB: amd: Silence shift wrapping warning in amd_ntb_db_vector_mask()
    ntb_hw_switchtec: potential shift wrapping bug in switchtec_ntb_init_sndev()
    NTB: ntb_transport: Ensure qp->tx_mw_dma_addr is initaliazed
    NTB: ntb_hw_amd: set peer limit register
    NTB: ntb_perf: Clear stale values in doorbell and command SPAD register
    NTB: ntb_perf: Disable NTB link after clearing peer XLAT registers
    ...

    Linus Torvalds
     

09 Jul, 2019

1 commit


13 Jun, 2019

1 commit

  • For NTB devices, we want to be able to trigger MSI interrupts
    through a memory window. In these cases we may want to use
    more interrupts than the NTB PCI device has available in its MSI-X
    table.

    We allow for this by creating a new 'virtual' interrupt. These
    interrupts are allocated as usual but are not programmed into the
    MSI-X table (as there may not be space for them).

    The MSI address and data will then handled through an NTB MSI library
    introduced later in this series.

    Signed-off-by: Logan Gunthorpe
    Acked-by: Bjorn Helgaas
    Signed-off-by: Jon Mason

    Logan Gunthorpe
     

30 Apr, 2019

1 commit

  • In several places in the kernel we find PCI_DEVID used like this:

    PCI_DEVID(dev->bus->number, dev->devfn)

    Add a "pci_dev_id(struct pci_dev *dev)" helper to simplify callers.

    Signed-off-by: Heiner Kallweit
    Signed-off-by: Bjorn Helgaas

    Heiner Kallweit
     

18 Feb, 2019

2 commits

  • Multiple interrupt sets for affinity spreading are now handled in the core
    code and the number of sets and their size is recalculated via a driver
    supplied callback.

    That avoids the requirement to invoke pci_alloc_irq_vectors_affinity() with
    the arguments minvecs and maxvecs set to the same value and the callsite
    handling the ENOSPC situation.

    Remove the now obsolete sanity checks and the related comments.

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Ming Lei
    Acked-by: Marc Zyngier
    Cc: Christoph Hellwig
    Cc: Bjorn Helgaas
    Cc: Jens Axboe
    Cc: linux-block@vger.kernel.org
    Cc: Sagi Grimberg
    Cc: linux-nvme@lists.infradead.org
    Cc: linux-pci@vger.kernel.org
    Cc: Keith Busch
    Cc: Sumit Saxena
    Cc: Kashyap Desai
    Cc: Shivasharan Srikanteshwara
    Link: https://lkml.kernel.org/r/20190216172228.778630549@linutronix.de

    Thomas Gleixner
     
  • The interrupt affinity spreading mechanism supports to spread out
    affinities for one or more interrupt sets. A interrupt set contains one or
    more interrupts. Each set is mapped to a specific functionality of a
    device, e.g. general I/O queues and read I/O queus of multiqueue block
    devices.

    The number of interrupts per set is defined by the driver. It depends on
    the total number of available interrupts for the device, which is
    determined by the PCI capabilites and the availability of underlying CPU
    resources, and the number of queues which the device provides and the
    driver wants to instantiate.

    The driver passes initial configuration for the interrupt allocation via a
    pointer to struct irq_affinity.

    Right now the allocation mechanism is complex as it requires to have a loop
    in the driver to determine the maximum number of interrupts which are
    provided by the PCI capabilities and the underlying CPU resources. This
    loop would have to be replicated in every driver which wants to utilize
    this mechanism. That's unwanted code duplication and error prone.

    In order to move this into generic facilities it is required to have a
    mechanism, which allows the recalculation of the interrupt sets and their
    size, in the core code. As the core code does not have any knowledge about the
    underlying device, a driver specific callback is required in struct
    irq_affinity, which can be invoked by the core code. The callback gets the
    number of available interupts as an argument, so the driver can calculate the
    corresponding number and size of interrupt sets.

    At the moment the struct irq_affinity pointer which is handed in from the
    driver and passed through to several core functions is marked 'const', but for
    the callback to be able to modify the data in the struct it's required to
    remove the 'const' qualifier.

    Add the optional callback to struct irq_affinity, which allows drivers to
    recalculate the number and size of interrupt sets and remove the 'const'
    qualifier.

    For simple invocations, which do not supply a callback, a default callback
    is installed, which just sets nr_sets to 1 and transfers the number of
    spreadable vectors to the set_size array at index 0.

    This is for now guarded by a check for nr_sets != 0 to keep the NVME driver
    working until it is converted to the callback mechanism.

    To make sure that the driver configuration is correct under all circumstances
    the callback is invoked even when there are no interrupts for queues left,
    i.e. the pre/post requirements already exhaust the numner of available
    interrupts.

    At the PCI layer irq_create_affinity_masks() has to be invoked even for the
    case where the legacy interrupt is used. That ensures that the callback is
    invoked and the device driver can adjust to that situation.

    [ tglx: Fixed the simple case (no sets required). Moved the sanity check
    for nr_sets after the invocation of the callback so it catches
    broken drivers. Fixed the kernel doc comments for struct
    irq_affinity and de-'This patch'-ed the changelog ]

    Signed-off-by: Ming Lei
    Signed-off-by: Thomas Gleixner
    Acked-by: Marc Zyngier
    Cc: Christoph Hellwig
    Cc: Bjorn Helgaas
    Cc: Jens Axboe
    Cc: linux-block@vger.kernel.org
    Cc: Sagi Grimberg
    Cc: linux-nvme@lists.infradead.org
    Cc: linux-pci@vger.kernel.org
    Cc: Keith Busch
    Cc: Sumit Saxena
    Cc: Kashyap Desai
    Cc: Shivasharan Srikanteshwara
    Link: https://lkml.kernel.org/r/20190216172228.512444498@linutronix.de

    Ming Lei
     

16 Jan, 2019

1 commit

  • The API of pci_alloc_irq_vectors_affinity() says it returns -ENOSPC if
    fewer than @min_vecs interrupt vectors are available for @dev.

    However, if a device supports MSI-X but not MSI and a caller requests
    @min_vecs that can't be satisfied by MSI-X, we previously returned -EINVAL
    (from the failed attempt to enable MSI), not -ENOSPC.

    When -ENOSPC is returned, callers may reduce the number IRQs they request
    and try again. Most callers can use the @min_vecs and @max_vecs
    parameters to avoid this retry loop, but that doesn't work when using IRQ
    affinity "nr_sets" because rebalancing the sets is driver-specific.

    This return value bug has been present since pci_alloc_irq_vectors() was
    added in v4.10 by aff171641d18 ("PCI: Provide sensible IRQ vector
    alloc/free routines"), but it wasn't an issue because @min_vecs/@max_vecs
    removed the need for callers to iteratively reduce the number of IRQs
    requested and retry the allocation, so they didn't need to distinguish
    -ENOSPC from -EINVAL.

    In v5.0, 6da4b3ab9a6e ("genirq/affinity: Add support for allocating
    interrupt sets") added IRQ sets to the interface, which reintroduced the
    need to check for -ENOSPC and possibly reduce the number of IRQs requested
    and retry the allocation.

    Signed-off-by: Ming Lei
    [bhelgaas: changelog]
    Signed-off-by: Bjorn Helgaas
    Cc: Jens Axboe
    Cc: Keith Busch
    Cc: Christoph Hellwig

    Ming Lei
     

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
     

05 Nov, 2018

1 commit

  • A driver may have a need to allocate multiple sets of MSI/MSI-X interrupts,
    and have them appropriately affinitized.

    Add support for defining a number of sets in the irq_affinity structure, of
    varying sizes, and get each set affinitized correctly across the machine.

    [ tglx: Minor changelog tweaks ]

    Signed-off-by: Jens Axboe
    Signed-off-by: Ming Lei
    Signed-off-by: Thomas Gleixner
    Reviewed-by: Hannes Reinecke
    Reviewed-by: Ming Lei
    Reviewed-by: Keith Busch
    Reviewed-by: Sagi Grimberg
    Cc: linux-block@vger.kernel.org
    Link: https://lkml.kernel.org/r/20181102145951.31979-5-ming.lei@redhat.com

    Jens Axboe
     

26 Sep, 2018

1 commit

  • It is a serious driver defect to enable MSI or MSI-X more than once. Doing
    so may panic the kernel as in the stack trace below:

    Call Trace:
    sysfs_add_one+0xa5/0xd0
    create_dir+0x7c/0xe0
    sysfs_create_subdir+0x1c/0x20
    internal_create_group+0x6d/0x290
    sysfs_create_groups+0x4a/0xa0
    populate_msi_sysfs+0x1cd/0x210
    pci_enable_msix+0x31c/0x3e0
    igbuio_pci_open+0x72/0x300 [igb_uio]
    uio_open+0xcc/0x120 [uio]
    chrdev_open+0xa1/0x1e0
    [...]
    do_sys_open+0xf3/0x1f0
    SyS_open+0x1e/0x20
    system_call_fastpath+0x16/0x1b
    ---[ end trace 11042e2848880209 ]---
    Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: ffffffffa056b4fa

    We want to keep the WARN_ON() and stack trace so the driver can be fixed,
    but we can avoid the kernel panic by returning an error. We may still get
    warnings like this:

    Call Trace:
    pci_enable_msix+0x3c9/0x3e0
    igbuio_pci_open+0x72/0x300 [igb_uio]
    uio_open+0xcc/0x120 [uio]
    chrdev_open+0xa1/0x1e0
    [...]
    do_sys_open+0xf3/0x1f0
    SyS_open+0x1e/0x20
    system_call_fastpath+0x16/0x1b
    ------------[ cut here ]------------
    WARNING: at fs/sysfs/dir.c:526 sysfs_add_one+0xa5/0xd0()
    sysfs: cannot create duplicate filename '/devices/pci0000:00/0000:00:03.0/0000:01:00.1/msi_irqs'

    Signed-off-by: Tonghao Zhang
    [bhelgaas: changelog, fix patch whitespace, remove !!]
    Signed-off-by: Bjorn Helgaas

    Tonghao Zhang
     

15 Aug, 2018

1 commit

  • If flag IRQCHIP_ONESHOT_SAFE isn't set for an irqchip and we have a
    threaded interrupt with no primary handler, flag IRQF_ONESHOT needs to be
    set for the interrupt, causing some overhead in the threaded interrupt
    handler. For more detailed explanation also check following comment in
    __setup_irq():

    The interrupt was requested with handler = NULL, so we use the default
    primary handler for it. But it does not have the oneshot flag set. In
    combination with level interrupts this is deadly, because the default
    primary handler just wakes the thread, then the irq lines is reenabled,
    but the device still has the level irq asserted. Rinse and repeat....

    While this works for edge type interrupts, we play it safe and reject
    unconditionally because we can't say for sure which type this interrupt
    really has. The type flags are unreliable as the underlying chip
    implementation can override them.

    Another comment in __setup_irq() gives a hint already that this
    overhead can be avoided for PCI-MSI:

    Some irq chips like MSI based interrupts are per se one shot safe. Check
    the chip flags, so we can avoid the unmask dance at the end of the
    threaded handler for those.

    Following this let's mark all PCI-MSI irqchips as oneshot-safe.

    See also discussion here:
    https://lkml.kernel.org/r/alpine.DEB.2.21.1808032136490.1658@nanos.tec.linutronix.de

    Signed-off-by: Heiner Kallweit
    Signed-off-by: Bjorn Helgaas

    Heiner Kallweit
     

13 Jun, 2018

1 commit

  • The kzalloc() function has a 2-factor argument form, kcalloc(). This
    patch replaces cases of:

    kzalloc(a * b, gfp)

    with:
    kcalloc(a * b, gfp)

    as well as handling cases of:

    kzalloc(a * b * c, gfp)

    with:

    kzalloc(array3_size(a, b, c), gfp)

    as it's slightly less ugly than:

    kzalloc_array(array_size(a, b), c, gfp)

    This does, however, attempt to ignore constant size factors like:

    kzalloc(4 * 1024, gfp)

    though any constants defined via macros get caught up in the conversion.

    Any factors with a sizeof() of "unsigned char", "char", and "u8" were
    dropped, since they're redundant.

    The Coccinelle script used for this was:

    // Fix redundant parens around sizeof().
    @@
    type TYPE;
    expression THING, E;
    @@

    (
    kzalloc(
    - (sizeof(TYPE)) * E
    + sizeof(TYPE) * E
    , ...)
    |
    kzalloc(
    - (sizeof(THING)) * E
    + sizeof(THING) * E
    , ...)
    )

    // Drop single-byte sizes and redundant parens.
    @@
    expression COUNT;
    typedef u8;
    typedef __u8;
    @@

    (
    kzalloc(
    - sizeof(u8) * (COUNT)
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(__u8) * (COUNT)
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(char) * (COUNT)
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(unsigned char) * (COUNT)
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(u8) * COUNT
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(__u8) * COUNT
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(char) * COUNT
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(unsigned char) * COUNT
    + COUNT
    , ...)
    )

    // 2-factor product with sizeof(type/expression) and identifier or constant.
    @@
    type TYPE;
    expression THING;
    identifier COUNT_ID;
    constant COUNT_CONST;
    @@

    (
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * (COUNT_ID)
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * COUNT_ID
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * (COUNT_CONST)
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * COUNT_CONST
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * (COUNT_ID)
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * COUNT_ID
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * (COUNT_CONST)
    + COUNT_CONST, sizeof(THING)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * COUNT_CONST
    + COUNT_CONST, sizeof(THING)
    , ...)
    )

    // 2-factor product, only identifiers.
    @@
    identifier SIZE, COUNT;
    @@

    - kzalloc
    + kcalloc
    (
    - SIZE * COUNT
    + COUNT, SIZE
    , ...)

    // 3-factor product with 1 sizeof(type) or sizeof(expression), with
    // redundant parens removed.
    @@
    expression THING;
    identifier STRIDE, COUNT;
    type TYPE;
    @@

    (
    kzalloc(
    - sizeof(TYPE) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kzalloc(
    - sizeof(THING) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kzalloc(
    - sizeof(THING) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kzalloc(
    - sizeof(THING) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kzalloc(
    - sizeof(THING) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    )

    // 3-factor product with 2 sizeof(variable), with redundant parens removed.
    @@
    expression THING1, THING2;
    identifier COUNT;
    type TYPE1, TYPE2;
    @@

    (
    kzalloc(
    - sizeof(TYPE1) * sizeof(TYPE2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kzalloc(
    - sizeof(THING1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kzalloc(
    - sizeof(THING1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    )

    // 3-factor product, only identifiers, with redundant parens removed.
    @@
    identifier STRIDE, SIZE, COUNT;
    @@

    (
    kzalloc(
    - (COUNT) * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - COUNT * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - COUNT * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - (COUNT) * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - COUNT * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - (COUNT) * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - (COUNT) * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - COUNT * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    )

    // Any remaining multi-factor products, first at least 3-factor products,
    // when they're not all constants...
    @@
    expression E1, E2, E3;
    constant C1, C2, C3;
    @@

    (
    kzalloc(C1 * C2 * C3, ...)
    |
    kzalloc(
    - (E1) * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kzalloc(
    - (E1) * (E2) * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kzalloc(
    - (E1) * (E2) * (E3)
    + array3_size(E1, E2, E3)
    , ...)
    |
    kzalloc(
    - E1 * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    )

    // And then all remaining 2 factors products when they're not all constants,
    // keeping sizeof() as the second factor argument.
    @@
    expression THING, E1, E2;
    type TYPE;
    constant C1, C2, C3;
    @@

    (
    kzalloc(sizeof(THING) * C2, ...)
    |
    kzalloc(sizeof(TYPE) * C2, ...)
    |
    kzalloc(C1 * C2 * C3, ...)
    |
    kzalloc(C1 * C2, ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * (E2)
    + E2, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * E2
    + E2, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * (E2)
    + E2, sizeof(THING)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * E2
    + E2, sizeof(THING)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - (E1) * E2
    + E1, E2
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - (E1) * (E2)
    + E1, E2
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - E1 * E2
    + E1, E2
    , ...)
    )

    Signed-off-by: Kees Cook

    Kees Cook
     

13 May, 2018

1 commit

  • Nobody would be insane enough to try and use level triggered
    MSIs on PCI, but let's make sure it doesn't happen. Also,
    let's mandate that the irqchip backing the platform MSI domain
    is providing the IRQCHIP_SUPPORTS_LEVEL_MSI flag.

    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-3-marc.zyngier@arm.com

    Marc Zyngier
     

20 Mar, 2018

1 commit

  • Remove pointless comments that tell us the file name, remove blank line
    comments, follow multi-line comment conventions. No functional change
    intended.

    Signed-off-by: Bjorn Helgaas

    Bjorn Helgaas
     

02 Feb, 2018

1 commit

  • * pci/spdx:
    PCI: Add SPDX GPL-2.0+ to replace implicit GPL v2 or later statement
    PCI: Add SPDX GPL-2.0+ to replace GPL v2 or later boilerplate
    PCI: Add SPDX GPL-2.0 to replace COPYING boilerplate
    PCI: Add SPDX GPL-2.0 to replace GPL v2 boilerplate
    PCI: Add SPDX GPL-2.0 when no license was specified

    Bjorn Helgaas
     

27 Jan, 2018

1 commit

  • b24413180f56 ("License cleanup: add SPDX GPL-2.0 license identifier to
    files with no license") added SPDX GPL-2.0 to several PCI files that
    previously contained no license information.

    Add SPDX GPL-2.0 to all other PCI files that did not contain any license
    information and hence were under the default GPL version 2 license of the
    kernel.

    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Greg Kroah-Hartman

    Bjorn Helgaas
     

19 Jan, 2018

1 commit


18 Oct, 2017

1 commit

  • If interrupt reservation mode is enabled then the PCI/MSI interrupts must
    be reactivated after early activation.

    Make sure that all callers of pci_msi_create_irq_domain() have the
    MSI_FLAG_MUST_REACTIVATE set when reservation mode is enabled.

    Signed-off-by: Thomas Gleixner
    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
    Link: https://lkml.kernel.org/r/20171017075600.448649905@linutronix.de

    Thomas Gleixner
     

09 Sep, 2017

1 commit

  • Pull PCI updates from Bjorn Helgaas:

    - add enhanced Downstream Port Containment support, which prints more
    details about Root Port Programmed I/O errors (Dongdong Liu)

    - add Layerscape ls1088a and ls2088a support (Hou Zhiqiang)

    - add MediaTek MT2712 and MT7622 support (Ryder Lee)

    - add MediaTek MT2712 and MT7622 MSI support (Honghui Zhang)

    - add Qualcom IPQ8074 support (Varadarajan Narayanan)

    - add R-Car r8a7743/5 device tree support (Biju Das)

    - add Rockchip per-lane PHY support for better power management (Shawn
    Lin)

    - fix IRQ mapping for hot-added devices by replacing the
    pci_fixup_irqs() boot-time design with a host bridge hook called at
    probe-time (Lorenzo Pieralisi, Matthew Minter)

    - fix race when enabling two devices that results in upstream bridge
    not being enabled correctly (Srinath Mannam)

    - fix pciehp power fault infinite loop (Keith Busch)

    - fix SHPC bridge MSI hotplug events by enabling bus mastering
    (Aleksandr Bezzubikov)

    - fix a VFIO issue by correcting PCIe capability sizes (Alex
    Williamson)

    - fix an INTD issue on Xilinx and possibly other drivers by unifying
    INTx IRQ domain support (Paul Burton)

    - avoid IOMMU stalls by marking AMD Stoney GPU ATS as broken (Joerg
    Roedel)

    - allow APM X-Gene device assignment to guests by adding an ACS quirk
    (Feng Kan)

    - fix driver crashes by disabling Extended Tags on Broadcom HT2100
    (Extended Tags support is required for PCIe Receivers but not
    Requesters, and we now enable them by default when Requesters support
    them) (Sinan Kaya)

    - fix MSIs for devices that use phantom RIDs for DMA by assuming MSIs
    use the real Requester ID (not a phantom RID) (Robin Murphy)

    - prevent assignment of Intel VMD children to guests (which may be
    supported eventually, but isn't yet) by not associating an IOMMU with
    them (Jon Derrick)

    - fix Intel VMD suspend/resume by releasing IRQs on suspend (Scott
    Bauer)

    - fix a Function-Level Reset issue with Intel 750 NVMe by waiting
    longer (up to 60sec instead of 1sec) for device to become ready
    (Sinan Kaya)

    - fix a Function-Level Reset issue on iProc Stingray by working around
    hardware defects in the CRS implementation (Oza Pawandeep)

    - fix an issue with Intel NVMe P3700 after an iProc reset by adding a
    delay during shutdown (Oza Pawandeep)

    - fix a Microsoft Hyper-V lockdep issue by polling instead of blocking
    in compose_msi_msg() (Stephen Hemminger)

    - fix a wireless LAN driver timeout by clearing DesignWare MSI
    interrupt status after it is handled, not before (Faiz Abbas)

    - fix DesignWare ATU enable checking (Jisheng Zhang)

    - reduce Layerscape dependencies on the bootloader by doing more
    initialization in the driver (Hou Zhiqiang)

    - improve Intel VMD performance allowing allocation of more IRQ vectors
    than present CPUs (Keith Busch)

    - improve endpoint framework support for initial DMA mask, different
    BAR sizes, configurable page sizes, MSI, test driver, etc (Kishon
    Vijay Abraham I, Stan Drozd)

    - rework CRS support to add periodic messages while we poll during
    enumeration and after Function-Level Reset and prepare for possible
    other uses of CRS (Sinan Kaya)

    - clean up Root Port AER handling by removing unnecessary code and
    moving error handler methods to struct pcie_port_service_driver
    (Christoph Hellwig)

    - clean up error handling paths in various drivers (Bjorn Andersson,
    Fabio Estevam, Gustavo A. R. Silva, Harunobu Kurokawa, Jeffy Chen,
    Lorenzo Pieralisi, Sergei Shtylyov)

    - clean up SR-IOV resource handling by disabling VF decoding before
    updating the corresponding resource structs (Gavin Shan)

    - clean up DesignWare-based drivers by unifying quirks to update Class
    Code and Interrupt Pin and related handling of write-protected
    registers (Hou Zhiqiang)

    - clean up by adding empty generic pcibios_align_resource() and
    pcibios_fixup_bus() and removing empty arch-specific implementations
    (Palmer Dabbelt)

    - request exclusive reset control for several drivers to allow cleanup
    elsewhere (Philipp Zabel)

    - constify various structures (Arvind Yadav, Bhumika Goyal)

    - convert from full_name() to %pOF (Rob Herring)

    - remove unused variables from iProc, HiSi, Altera, Keystone (Shawn
    Lin)

    * tag 'pci-v4.14-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (170 commits)
    PCI: xgene: Clean up whitespace
    PCI: xgene: Define XGENE_PCI_EXP_CAP and use generic PCI_EXP_RTCTL offset
    PCI: xgene: Fix platform_get_irq() error handling
    PCI: xilinx-nwl: Fix platform_get_irq() error handling
    PCI: rockchip: Fix platform_get_irq() error handling
    PCI: altera: Fix platform_get_irq() error handling
    PCI: spear13xx: Fix platform_get_irq() error handling
    PCI: artpec6: Fix platform_get_irq() error handling
    PCI: armada8k: Fix platform_get_irq() error handling
    PCI: dra7xx: Fix platform_get_irq() error handling
    PCI: exynos: Fix platform_get_irq() error handling
    PCI: iproc: Clean up whitespace
    PCI: iproc: Rename PCI_EXP_CAP to IPROC_PCI_EXP_CAP
    PCI: iproc: Add 500ms delay during device shutdown
    PCI: Fix typos and whitespace errors
    PCI: Remove unused "res" variable from pci_resource_io()
    PCI: Correct kernel-doc of pci_vpd_srdt_size(), pci_vpd_srdt_tag()
    PCI/AER: Reformat AER register definitions
    iommu/vt-d: Prevent VMD child devices from being remapping targets
    x86/PCI: Use is_vmd() rather than relying on the domain number
    ...

    Linus Torvalds
     

26 Aug, 2017

1 commit

  • irq_create_affinity_masks() can return NULL on non-SMP systems, when there
    are not enough "free" vectors available to spread, or if memory allocation
    for the CPU masks fails. Only the allocation failure is of interest, and
    even then the system will work just fine except for non-optimally spread
    vectors. Thus remove the warnings.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Bjorn Helgaas
    Acked-by: David S. Miller

    Christoph Hellwig
     

15 Aug, 2017

1 commit

  • Currently, we handle all DMA aliases equally when calculating MSI requester
    IDs for the generic infrastructure. This turns out to be the wrong thing to
    do in the face of pure DMA quirks like those of Marvell SATA cards, where
    in the usual case the last thing seen in the alias walk is the DMA phantom
    function: we end up configuring the MSI doorbell to expect that alias, then
    find we have no interrupts since the MSI writes still come from the 'real'
    RID, thus get filtered out and ignored.

    Improve the alias walk to only account for the topological aliases that
    matter, based on the logic from the Intel IRQ remapping code.

    Signed-off-by: Robin Murphy
    Signed-off-by: Bjorn Helgaas
    Acked-by: Marc Zyngier

    Robin Murphy
     

09 Jul, 2017

1 commit

  • Pull PCI updates from Bjorn Helgaas:

    - add sysfs max_link_speed/width, current_link_speed/width (Wong Vee
    Khee)

    - make host bridge IRQ mapping much more generic (Matthew Minter,
    Lorenzo Pieralisi)

    - convert most drivers to pci_scan_root_bus_bridge() (Lorenzo
    Pieralisi)

    - mutex sriov_configure() (Jakub Kicinski)

    - mutex pci_error_handlers callbacks (Christoph Hellwig)

    - split ->reset_notify() into ->reset_prepare()/reset_done()
    (Christoph Hellwig)

    - support multiple PCIe portdrv interrupts for MSI as well as MSI-X
    (Gabriele Paoloni)

    - allocate MSI/MSI-X vector for Downstream Port Containment (Gabriele
    Paoloni)

    - fix MSI IRQ affinity pre/post/min_vecs issue (Michael Hernandez)

    - test INTx masking during enumeration, not at run-time (Piotr Gregor)

    - avoid using device_may_wakeup() for runtime PM (Rafael J. Wysocki)

    - restore the status of PCI devices across hibernation (Chen Yu)

    - keep parent resources that start at 0x0 (Ard Biesheuvel)

    - enable ECRC only if device supports it (Bjorn Helgaas)

    - restore PRI and PASID state after Function-Level Reset (CQ Tang)

    - skip DPC event if device is not present (Keith Busch)

    - check domain when matching SMBIOS info (Sujith Pandel)

    - mark Intel XXV710 NIC INTx masking as broken (Alex Williamson)

    - avoid AMD SB7xx EHCI USB wakeup defect (Kai-Heng Feng)

    - work around long-standing Macbook Pro poweroff issue (Bjorn Helgaas)

    - add Switchtec "running" status flag (Logan Gunthorpe)

    - fix dra7xx incorrect RW1C IRQ register usage (Arvind Yadav)

    - modify xilinx-nwl IRQ chip for legacy interrupts (Bharat Kumar
    Gogada)

    - move VMD SRCU cleanup after bus, child device removal (Jon Derrick)

    - add Faraday clock handling (Linus Walleij)

    - configure Rockchip MPS and reorganize (Shawn Lin)

    - limit Qualcomm TLP size to 2K (hardware issue) (Srinivas Kandagatla)

    - support Tegra MSI 64-bit addressing (Thierry Reding)

    - use Rockchip normal (not privileged) register bank (Shawn Lin)

    - add HiSilicon Kirin SoC PCIe controller driver (Xiaowei Song)

    - add Sigma Designs Tango SMP8759 PCIe controller driver (Marc
    Gonzalez)

    - add MediaTek PCIe host controller support (Ryder Lee)

    - add Qualcomm IPQ4019 support (John Crispin)

    - add HyperV vPCI protocol v1.2 support (Jork Loeser)

    - add i.MX6 regulator support (Quentin Schulz)

    * tag 'pci-v4.13-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (113 commits)
    PCI: tango: Add Sigma Designs Tango SMP8759 PCIe host bridge support
    PCI: Add DT binding for Sigma Designs Tango PCIe controller
    PCI: rockchip: Use normal register bank for config accessors
    dt-bindings: PCI: Add documentation for MediaTek PCIe
    PCI: Remove __pci_dev_reset() and pci_dev_reset()
    PCI: Split ->reset_notify() method into ->reset_prepare() and ->reset_done()
    PCI: xilinx: Make of_device_ids const
    PCI: xilinx-nwl: Modify IRQ chip for legacy interrupts
    PCI: vmd: Move SRCU cleanup after bus, child device removal
    PCI: vmd: Correct comment: VMD domains start at 0x10000, not 0x1000
    PCI: versatile: Add local struct device pointers
    PCI: tegra: Do not allocate MSI target memory
    PCI: tegra: Support MSI 64-bit addressing
    PCI: rockchip: Use local struct device pointer consistently
    PCI: rockchip: Check for clk_prepare_enable() errors during resume
    MAINTAINERS: Remove Wenrui Li as Rockchip PCIe driver maintainer
    PCI: rockchip: Configure RC's MPS setting
    PCI: rockchip: Reconfigure configuration space header type
    PCI: rockchip: Split out rockchip_pcie_cfg_configuration_accesses()
    PCI: rockchip: Move configuration accesses into rockchip_pcie_cfg_atu()
    ...

    Linus Torvalds
     

23 Jun, 2017

1 commit


23 May, 2017

1 commit

  • min_vecs is the minimum amount of vectors needed to operate in MSI-X mode
    which may just include the vectors that don't need affinity.

    Disabling affinity settings causes the qla2xxx driver scsi_add_host() to fail
    when blk_mq is enabled as the blk_mq_pci_map_queues() expects affinity masks
    on each vector.

    Fixes: dfef358bd1be ("PCI/MSI: Don't apply affinity if there aren't enough vectors left")
    Signed-off-by: Michael Hernandez
    Signed-off-by: Himanshu Madhani
    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Christoph Hellwig
    Cc: stable@vger.kernel.org # v4.10+

    Michael Hernandez
     

09 May, 2017

1 commit

  • Pull PCI updates from Bjorn Helgaas:

    - add framework for supporting PCIe devices in Endpoint mode (Kishon
    Vijay Abraham I)

    - use non-postable PCI config space mappings when possible (Lorenzo
    Pieralisi)

    - clean up and unify mmap of PCI BARs (David Woodhouse)

    - export and unify Function Level Reset support (Christoph Hellwig)

    - avoid FLR for Intel 82579 NICs (Sasha Neftin)

    - add pci_request_irq() and pci_free_irq() helpers (Christoph Hellwig)

    - short-circuit config access failures for disconnected devices (Keith
    Busch)

    - remove D3 sleep delay when possible (Adrian Hunter)

    - freeze PME scan before suspending devices (Lukas Wunner)

    - stop disabling MSI/MSI-X in pci_device_shutdown() (Prarit Bhargava)

    - disable boot interrupt quirk for ASUS M2N-LR (Stefan Assmann)

    - add arch-specific alignment control to improve device passthrough by
    avoiding multiple BARs in a page (Yongji Xie)

    - add sysfs sriov_drivers_autoprobe to control VF driver binding
    (Bodong Wang)

    - allow slots below PCI-to-PCIe "reverse bridges" (Bjorn Helgaas)

    - fix crashes when unbinding host controllers that don't support
    removal (Brian Norris)

    - add driver for MicroSemi Switchtec management interface (Logan
    Gunthorpe)

    - add driver for Faraday Technology FTPCI100 host bridge (Linus
    Walleij)

    - add i.MX7D support (Andrey Smirnov)

    - use generic MSI support for Aardvark (Thomas Petazzoni)

    - make Rockchip driver modular (Brian Norris)

    - advertise 128-byte Read Completion Boundary support for Rockchip
    (Shawn Lin)

    - advertise PCI_EXP_LNKSTA_SLC for Rockchip root port (Shawn Lin)

    - convert atomic_t to refcount_t in HV driver (Elena Reshetova)

    - add CPU IRQ affinity in HV driver (K. Y. Srinivasan)

    - fix PCI bus removal in HV driver (Long Li)

    - add support for ThunderX2 DMA alias topology (Jayachandran C)

    - add ThunderX pass2.x 2nd node MCFG quirk (Tomasz Nowicki)

    - add ITE 8893 bridge DMA alias quirk (Jarod Wilson)

    - restrict Cavium ACS quirk only to CN81xx/CN83xx/CN88xx devices
    (Manish Jaggi)

    * tag 'pci-v4.12-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (146 commits)
    PCI: Don't allow unbinding host controllers that aren't prepared
    ARM: DRA7: clockdomain: Change the CLKTRCTRL of CM_PCIE_CLKSTCTRL to SW_WKUP
    MAINTAINERS: Add PCI Endpoint maintainer
    Documentation: PCI: Add userguide for PCI endpoint test function
    tools: PCI: Add sample test script to invoke pcitest
    tools: PCI: Add a userspace tool to test PCI endpoint
    Documentation: misc-devices: Add Documentation for pci-endpoint-test driver
    misc: Add host side PCI driver for PCI test function device
    PCI: Add device IDs for DRA74x and DRA72x
    dt-bindings: PCI: dra7xx: Add DT bindings to enable unaligned access
    PCI: dwc: dra7xx: Workaround for errata id i870
    dt-bindings: PCI: dra7xx: Add DT bindings for PCI dra7xx EP mode
    PCI: dwc: dra7xx: Add EP mode support
    PCI: dwc: dra7xx: Facilitate wrapper and MSI interrupts to be enabled independently
    dt-bindings: PCI: Add DT bindings for PCI designware EP mode
    PCI: dwc: designware: Add EP mode support
    Documentation: PCI: Add binding documentation for pci-test endpoint function
    ixgbe: Use pcie_flr() instead of duplicating it
    IB/hfi1: Use pcie_flr() instead of duplicating it
    PCI: imx6: Fix spelling mistake: "contol" -> "control"
    ...

    Linus Torvalds
     

28 Apr, 2017

1 commit

  • * pci/msi:
    PCI/MSI: Use dev_printk() when possible
    of/pci: Remove unused MSI controller helpers
    PCI: mvebu: Remove useless MSI enabling code
    PCI: aardvark: Move to MSI handling using generic MSI support
    PCI/MSI: Make pci_msi_shutdown() and pci_msix_shutdown() static
    PCI/MSI: Stop disabling MSI/MSI-X in pci_device_shutdown()

    Bjorn Helgaas
     

11 Apr, 2017

1 commit


30 Mar, 2017

1 commit

  • Check the device connected state prior to executing device shutdown
    operations or writing MSI messages so that tear down on disconnected
    devices completes quicker.

    Tested-by: Krishna Dhulipala
    Signed-off-by: Keith Busch
    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Wei Zhang

    Keith Busch
     

24 Mar, 2017

1 commit

  • Use dev_printk() when possible. This makes messages more consistent with
    other device-related messages and, in some cases, adds useful information.
    This changes messages like this:

    Unable to allocate affinity masks, ignoring

    to this:

    pci 0000:01:00.0: can't allocate MSI affinity masks for 4 vectors

    Signed-off-by: Bjorn Helgaas

    Bjorn Helgaas
     

10 Mar, 2017

1 commit


02 Mar, 2017

1 commit


24 Feb, 2017

1 commit

  • Pull PCI updates from Bjorn Helgaas:

    - add ASPM L1 substate support

    - enable PCIe Extended Tags when supported

    - configure PCIe MPS settings on iProc, Versatile, X-Gene, and Xilinx

    - increase VPD access timeout

    - add ACS quirks for Intel Union Point, Qualcomm QDF2400 and QDF2432

    - use new pci_irq_alloc_vectors() in more drivers

    - fix MSI affinity memory leak

    - remove unused MSI interfaces and update documentation

    - remove unused AER .link_reset() callback

    - avoid pci_lock / p->pi_lock deadlock seen with perf

    - serialize sysfs enable/disable num_vfs operations

    - move DesignWare IP from drivers/pci/host/ to drivers/pci/dwc/ and
    refactor so we can support both hosts and endpoints

    - add DT ECAM-like support for HiSilicon Hip06/Hip07 controllers

    - add Rockchip system power management support

    - add Thunder-X cn81xx and cn83xx support

    - add Exynos 5440 PCIe PHY support

    * tag 'pci-v4.11-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (93 commits)
    PCI: dwc: Remove dependency of designware on CONFIG_PCI
    PCI: dwc: Add CONFIG_PCIE_DW_HOST to enable PCI dwc host
    PCI: dwc: Split pcie-designware.c into host and core files
    PCI: dwc: designware: Fix style errors in pcie-designware.c
    PCI: dwc: designware: Parse "num-lanes" property in dw_pcie_setup_rc()
    PCI: dwc: all: Split struct pcie_port into host-only and core structures
    PCI: dwc: designware: Get device pointer at the start of dw_pcie_host_init()
    PCI: dwc: all: Rename cfg_read/cfg_write to read/write
    PCI: dwc: all: Use platform_set_drvdata() to save private data
    PCI: dwc: designware: Move register defines to designware header file
    PCI: dwc: Use PTR_ERR_OR_ZERO to simplify code
    PCI: dra7xx: Group PHY API invocations
    PCI: dra7xx: Enable MSI and legacy interrupts simultaneously
    PCI: dra7xx: Add support to force RC to work in GEN1 mode
    PCI: dra7xx: Simplify probe code with devm_gpiod_get_optional()
    PCI: Move DesignWare IP support to new drivers/pci/dwc/ directory
    PCI: exynos: Support the PHY generic framework
    Documentation: binding: Modify the exynos5440 PCIe binding
    phy: phy-exynos-pcie: Add support for Exynos PCIe PHY
    Documentation: samsung-phy: Add exynos-pcie-phy binding
    ...

    Linus Torvalds
     

18 Feb, 2017

1 commit

  • During device setup, msix_setup_entries() and msi_setup_entry() allocate
    msi_desc by calling alloc_msi_entry(). alloc_msi_entry() can also allocate
    a affinity cpumask. During device teardown free_msi_irqs() is called and
    the msi_desc is freed, but the affinity cpumask is leaked.

    Fix it by calling free_msi_entry() which frees both the msi_desc and the
    affinity cpumask.

    [bhelgaas: aa48b6f70886 ("genirq/MSI: Move alloc_msi_entry() from PCI into
    generic MSI code") moved alloc_msi_entry() from drivers/pci/msi.c to
    kernel/irq/msi.c and added a new corresponding free_msi_entry() interface.

    After aa48b6f70886, pci/msi.c used alloc_msi_entry(), but did its own
    kfree() instead of using free_msi_entry(). 28f4b04143c5 ("genirq/msi: Add
    cpumask allocation to alloc_msi_entry") added affinity to both
    alloc_msi_entry() and free_msi_entry(), but pci/msi.c didn't use
    free_msi_entry(), resulting in this leak.]

    Fixes: aa48b6f70886 ("genirq/MSI: Move alloc_msi_entry() from PCI into generic MSI code")
    Signed-off-by: Prarit Bhargava
    Signed-off-by: Bjorn Helgaas
    CC: Myron Stowe

    Prarit Bhargava
     

11 Feb, 2017

5 commits


03 Feb, 2017

1 commit

  • Bart reported a problem wіth an out of bounds access in the low-level IRQ
    affinity code, which we root caused to the qla2xxx driver assigning all its
    MSI-X vectors to the pre and post vectors, and not having any left for the
    actually spread IRQs.

    Fix this issue by not asking for affinity assignment when there are no
    vectors to assign left.

    Fixes: 402723ad5c62 ("PCI/MSI: Provide pci_alloc_irq_vectors_affinity()")
    Link: https://lkml.kernel.org/r/1485359225.3093.3.camel@sandisk.com
    Reported-by: Bart Van Assche
    Tested-by: Bart Van Assche
    Signed-off-by: Christoph Hellwig
    Signed-off-by: Bjorn Helgaas

    Christoph Hellwig