<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/pci/msi.c, branch linux-5.5.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.5.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.5.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2019-11-26T19:10:29Z</updated>
<entry>
<title>PCI/MSI: Fix incorrect MSI-X masking on resume</title>
<updated>2019-11-26T19:10:29Z</updated>
<author>
<name>Jian-Hong Pan</name>
</author>
<published>2019-10-08T03:42:39Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e045fa29e89383c717e308609edd19d2fd29e1be'/>
<id>urn:sha1:e045fa29e89383c717e308609edd19d2fd29e1be</id>
<content type='text'>
When a driver enables MSI-X, msix_program_entries() reads the MSI-X Vector
Control register for each vector and saves it in desc-&gt;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-&gt;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-&gt;masked)   &lt;-- entire u32 word
            __pci_msix_desc_mask_irq(desc, flag)
              mask_bits = desc-&gt;masked &amp; ~PCI_MSIX_ENTRY_CTRL_MASKBIT
              if (flag)       &lt;-- testing entire u32, not just bit 0
                mask_bits |= PCI_MSIX_ENTRY_CTRL_MASKBIT
              writel(mask_bits, desc_addr + PCI_MSIX_ENTRY_VECTOR_CTRL)

This means that after resume, MSI-X vectors were masked when they shouldn't
be, which leads to timeouts like this:

  nvme nvme0: I/O 978 QID 3 timeout, completion polled

On resume, set the Mask bit only when the saved Mask bit from suspend was
set.

This should remove the need for 19ea025e1d28 ("nvme: Add quirk for Kingston
NVME SSD running FW E8FK11.T").

[bhelgaas: commit log, move fix to __pci_msix_desc_mask_irq()]
Link: https://bugzilla.kernel.org/show_bug.cgi?id=204887
Link: https://lore.kernel.org/r/20191008034238.2503-1-jian-hong@endlessm.com
Fixes: f2440d9acbe8 ("PCI MSI: Refactor interrupt masking code")
Signed-off-by: Jian-Hong Pan &lt;jian-hong@endlessm.com&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Cc: stable@vger.kernel.org
</content>
</entry>
<entry>
<title>PCI/MSI: Move power state check out of pci_msi_supported()</title>
<updated>2019-11-26T19:10:28Z</updated>
<author>
<name>Bjorn Helgaas</name>
</author>
<published>2019-10-14T21:17:05Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=901c4ddbe277a766fd081ffbbd526d7b4bdbacdf'/>
<id>urn:sha1:901c4ddbe277a766fd081ffbbd526d7b4bdbacdf</id>
<content type='text'>
27e20603c54b ("PCI/MSI: Move D0 check into pci_msi_check_device()")
moved the power state check into pci_msi_check_device(), which was
subsequently renamed to pci_msi_supported().  This didn't change the
behavior, since both callers checked the power state.

However, it doesn't fit the current "pci_msi_supported()" name, which
should return what the device is capable of, independent of the power
state.

Move the power state check back into the callers for readability.  No
functional change intended.

Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Reviewed-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>PCI/MSI: Remove unused pci_irq_get_node()</title>
<updated>2019-11-26T19:10:27Z</updated>
<author>
<name>Greg Kroah-Hartman</name>
</author>
<published>2019-10-14T10:04:52Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d41b0e64d206f8948212b4d0f30c330db95c9636'/>
<id>urn:sha1:d41b0e64d206f8948212b4d0f30c330db95c9636</id>
<content type='text'>
The function pci_irq_get_node() is not used by anyone in the tree, so just
delete it.

Link: https://lore.kernel.org/r/20191014100452.GA6699@kroah.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Reviewed-by: Andrew Murray &lt;andrew.murray@arm.com&gt;
</content>
</entry>
<entry>
<title>Merge tag 'ntb-5.3' of git://github.com/jonmason/ntb</title>
<updated>2019-07-21T16:46:59Z</updated>
<author>
<name>Linus Torvalds</name>
</author>
<published>2019-07-21T16:46:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=bec5545edef658f81cd9721dbe8fbebeb3c7534d'/>
<id>urn:sha1:bec5545edef658f81cd9721dbe8fbebeb3c7534d</id>
<content type='text'>
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-&gt;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
  ...
</content>
</entry>
<entry>
<title>PCI: Fix typos and whitespace errors</title>
<updated>2019-07-09T12:24:53Z</updated>
<author>
<name>Bjorn Helgaas</name>
</author>
<published>2019-05-30T13:05:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f6b6aefee70aa5261deec7feab80c249bf58397f'/>
<id>urn:sha1:f6b6aefee70aa5261deec7feab80c249bf58397f</id>
<content type='text'>
Fix typos in drivers/pci.  Comment and whitespace changes only.

Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Reviewed-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Reviewed-by: Randy Dunlap &lt;rdunlap@infradead.org&gt;
</content>
</entry>
<entry>
<title>PCI/MSI: Support allocating virtual MSI interrupts</title>
<updated>2019-06-13T12:59:34Z</updated>
<author>
<name>Logan Gunthorpe</name>
</author>
<published>2019-05-23T22:30:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d7cc609fb679e11dc2b00cbe6c50cbd37ec4bfa2'/>
<id>urn:sha1:d7cc609fb679e11dc2b00cbe6c50cbd37ec4bfa2</id>
<content type='text'>
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 &lt;logang@deltatee.com&gt;
Acked-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Signed-off-by: Jon Mason &lt;jdmason@kudzu.us&gt;
</content>
</entry>
<entry>
<title>PCI: Add pci_dev_id() helper</title>
<updated>2019-04-29T21:12:05Z</updated>
<author>
<name>Heiner Kallweit</name>
</author>
<published>2019-04-24T19:11:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4e544bac8267f65a0bf06aed1bde9964da4812ed'/>
<id>urn:sha1:4e544bac8267f65a0bf06aed1bde9964da4812ed</id>
<content type='text'>
In several places in the kernel we find PCI_DEVID used like this:

  PCI_DEVID(dev-&gt;bus-&gt;number, dev-&gt;devfn)

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

Signed-off-by: Heiner Kallweit &lt;hkallweit1@gmail.com&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
</content>
</entry>
<entry>
<title>PCI/MSI: Remove obsolete sanity checks for multiple interrupt sets</title>
<updated>2019-02-18T10:21:29Z</updated>
<author>
<name>Thomas Gleixner</name>
</author>
<published>2019-02-16T17:13:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4e6b26d23dc1faee318796d5c7f91b5692b1e6be'/>
<id>urn:sha1:4e6b26d23dc1faee318796d5c7f91b5692b1e6be</id>
<content type='text'>
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 &lt;tglx@linutronix.de&gt;
Reviewed-by: Ming Lei &lt;ming.lei@redhat.com&gt;
Acked-by: Marc Zyngier &lt;marc.zyngier@arm.com&gt;
Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Cc: Bjorn Helgaas &lt;helgaas@kernel.org&gt;
Cc: Jens Axboe &lt;axboe@kernel.dk&gt;
Cc: linux-block@vger.kernel.org
Cc: Sagi Grimberg &lt;sagi@grimberg.me&gt;
Cc: linux-nvme@lists.infradead.org
Cc: linux-pci@vger.kernel.org
Cc: Keith Busch &lt;keith.busch@intel.com&gt;
Cc: Sumit Saxena &lt;sumit.saxena@broadcom.com&gt;
Cc: Kashyap Desai &lt;kashyap.desai@broadcom.com&gt;
Cc: Shivasharan Srikanteshwara &lt;shivasharan.srikanteshwara@broadcom.com&gt;
Link: https://lkml.kernel.org/r/20190216172228.778630549@linutronix.de


</content>
</entry>
<entry>
<title>genirq/affinity: Add new callback for (re)calculating interrupt sets</title>
<updated>2019-02-18T10:21:28Z</updated>
<author>
<name>Ming Lei</name>
</author>
<published>2019-02-16T17:13:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c66d4bd110a1f8a68c1a88bfbf866eb50c6464b7'/>
<id>urn:sha1:c66d4bd110a1f8a68c1a88bfbf866eb50c6464b7</id>
<content type='text'>
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 &lt;ming.lei@redhat.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Acked-by: Marc Zyngier &lt;marc.zyngier@arm.com&gt;
Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Cc: Bjorn Helgaas &lt;helgaas@kernel.org&gt;
Cc: Jens Axboe &lt;axboe@kernel.dk&gt;
Cc: linux-block@vger.kernel.org
Cc: Sagi Grimberg &lt;sagi@grimberg.me&gt;
Cc: linux-nvme@lists.infradead.org
Cc: linux-pci@vger.kernel.org
Cc: Keith Busch &lt;keith.busch@intel.com&gt;
Cc: Sumit Saxena &lt;sumit.saxena@broadcom.com&gt;
Cc: Kashyap Desai &lt;kashyap.desai@broadcom.com&gt;
Cc: Shivasharan Srikanteshwara &lt;shivasharan.srikanteshwara@broadcom.com&gt;
Link: https://lkml.kernel.org/r/20190216172228.512444498@linutronix.de


</content>
</entry>
<entry>
<title>PCI/MSI: Return -ENOSPC from pci_alloc_irq_vectors_affinity()</title>
<updated>2019-01-15T23:31:29Z</updated>
<author>
<name>Ming Lei</name>
</author>
<published>2019-01-15T23:31:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=77f88abd4a6f73a1a68dbdc0e3f21575fd508fc3'/>
<id>urn:sha1:77f88abd4a6f73a1a68dbdc0e3f21575fd508fc3</id>
<content type='text'>
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 &lt;ming.lei@redhat.com&gt;
[bhelgaas: changelog]
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Cc: Jens Axboe &lt;axboe@fb.com&gt;
Cc: Keith Busch &lt;keith.busch@intel.com&gt;
Cc: Christoph Hellwig &lt;hch@lst.de&gt;</content>
</entry>
</feed>
