OSDN Git Service

PCI/portdrv: Use shared MSI/MSI-X vector for Bandwidth Management
authorAlex Williamson <alex.williamson@redhat.com>
Mon, 22 Apr 2019 22:43:30 +0000 (16:43 -0600)
committerBjorn Helgaas <bhelgaas@google.com>
Wed, 1 May 2019 20:34:01 +0000 (15:34 -0500)
commit15d2aba7c602cd9005b20ff011b670547b3882c4
treed570281e05772f02049eb37d8c82d97c63bfd497
parentd5bc73f34cc97c4b4b9202cc93182c2515076edf
PCI/portdrv: Use shared MSI/MSI-X vector for Bandwidth Management

The Interrupt Message Number in the PCIe Capabilities register (PCIe r4.0,
sec 7.5.3.2) indicates which MSI/MSI-X vector is shared by interrupts
related to the PCIe Capability, including Link Bandwidth Management and
Link Autonomous Bandwidth Interrupts (Link Control, 7.5.3.7), Command
Completed and Hot-Plug Interrupts (Slot Control, 7.5.3.10), and the PME
Interrupt (Root Control, 7.5.3.12).

pcie_message_numbers() checked whether we want to enable PME or Hot-Plug
interrupts but neglected to check for Link Bandwidth Management, so if we
only wanted the Bandwidth Management interrupts, it decided we didn't need
any vectors at all.  Then pcie_port_enable_irq_vec() tried to reallocate
zero vectors, which failed, resulting in fallback to INTx.

On some systems, e.g., an X79-based workstation, that INTx seems broken or
not handled correctly, so we got spurious IRQ16 interrupts for Bandwidth
Management events.

Change pcie_message_numbers() so that if we want Link Bandwidth Management
interrupts, we use the shared MSI/MSI-X vector from the PCIe Capabilities
register.

Fixes: e8303bb7a75c ("PCI/LINK: Report degraded links via link bandwidth notification")
Link: https://lore.kernel.org/lkml/155597243666.19387.1205950870601742062.stgit@gimli.home
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
[bhelgaas: changelog]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/pcie/portdrv_core.c