PCI/portdrv: Enable Bandwidth Notification only if port supports it
authorStuart Hayes <stuart.w.hayes@gmail.com>
Wed, 12 May 2021 21:33:14 +0000 (03:03 +0530)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 31 Aug 2021 19:07:01 +0000 (14:07 -0500)
commit00823dcbdd415c868390feaca16f0265101efab4
tree48455f709a60308bb9808eac886fb414cb683eec
parente73f0f0ee7541171d89f2e2491130c7771ba58d3
PCI/portdrv: Enable Bandwidth Notification only if port supports it

Previously we assumed that all Root Ports and Switch Downstream Ports
supported Link Bandwidth Notification.  Per spec, this is only required
for Ports supporting Links wider than x1 and/or multiple Link speeds
(PCIe r5.0, sec 7.5.3.6).

Because we assumed all Ports supported it, we tried to set up a Bandwidth
Notification IRQ, which failed for devices that don't support IRQs at all,
which meant pcieport didn't attach to the Port at all.

Check the Link Bandwidth Notification Capability bit and enable the service
only when the Port supports it.

[bhelgaas: commit log]
Fixes: e8303bb7a75c ("PCI/LINK: Report degraded links via link bandwidth notification")
Link: https://lore.kernel.org/r/20210512213314.7778-1-stuart.w.hayes@gmail.com
Signed-off-by: Stuart Hayes <stuart.w.hayes@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Lukas Wunner <lukas@wunner.de>
Cc: stable@vger.kernel.org
drivers/pci/pcie/portdrv_core.c