linux/drivers/pci/pcie
Rafael J. Wysocki 05f5747414 PCI/portdrv: Set PCIE_PORT_SERVICE_HP for Root and Downstream Ports only
It is reported that on some systems pciehp binds to an Upstream Port and
attempts to operate it which causes devices below the Port to disappear
from the bus.

This happens because acpiphp sets dev->is_hotplug_bridge for that Port
(after receiving a Device Check notification on it from the platform
firmware via ACPI) during the enumeration of PCI devices.

get_port_device_capability() sees that dev->is_hotplug_bridge is set and
adds PCIE_PORT_SERVICE_HP to Port services (which allows pciehp to bind to
the Port in question) without consulting the PCIe type, which should be
either Root Port or Downstream Port for the hotplug capability to be
present.

Per PCIe r6.0, sec 7.5.3.2, the Slot Implemented bit is only valid for
Downstream Ports (including Root Ports), and PCIe hotplug depends on the
Slot Capabilities / Control / Status registers.

Make get_port_device_capability() more robust by adding a PCIe type check
to it before adding PCIE_PORT_SERVICE_HP to Port services which helps to
avoid the problem.

[bhelgaas: add spec citation]
Suggested-by: Lukas Wunner <lukas@wunner.de>
Link: https://lore.kernel.org/r/4786090.31r3eYUQgx@kreacher
Reported-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Lukas Wunner <lukas@wunner.de>
2022-11-22 13:27:11 -06:00
..
aer_inject.c PCI/AER: Update aer-inject URL 2022-03-02 11:26:17 -06:00
aer.c PCI/AER: Iterate over error counters instead of error strings 2022-07-13 14:45:20 -05:00
aspm.c PCI/ASPM: Correct LTR_L1.2_THRESHOLD computation 2022-10-05 12:12:02 -05:00
dpc.c PCI/DPC: Quirk PIO log size for certain Intel Root Ports 2022-09-27 18:13:18 -05:00
edr.c PCI/EDR: Log only ACPI_NOTIFY_DISCONNECT_RECOVER events 2020-04-24 18:33:29 -05:00
err.c PCI/ERR: Recognize disconnected devices in report_error_detected() 2022-06-08 15:08:40 -05:00
Kconfig PCI: pciehp: Enable by default if USB4 enabled 2022-11-15 09:25:21 -06:00
Makefile PCI/ERR: Reduce compile time for CONFIG_PCIEAER=n 2021-10-16 09:16:59 -05:00
pme.c PCI/PME: Use PCI_POSSIBLE_ERROR() to check config reads 2021-11-18 14:13:18 -06:00
portdrv_core.c PCI/portdrv: Set PCIE_PORT_SERVICE_HP for Root and Downstream Ports only 2022-11-22 13:27:11 -06:00
portdrv_pci.c PCI: portdrv: Set driver_managed_dma 2022-04-28 15:32:20 +02:00
portdrv.h PCI/portdrv: Remove unused pcie_port_bus_{,un}register() declarations 2021-10-15 14:25:18 -05:00
ptm.c PCI/PTM: Reorder functions in logical order 2022-09-12 15:29:52 -05:00
rcec.c PCI/RCEC: Fix RCiEP device to RCEC association 2021-03-10 15:10:46 -06:00