[PATCH v3 0/4] PCI: pciehp: Do not turn off slot if presence comes up after link

From: Alexandru Gagniuc
Date: Fri Apr 19 2019 - 14:20:28 EST


According to the old PCIe spec, PDS would always have to come up with
or before DLLLA. For various reasons, not all OEMs followed this
requirement. As a result, in PCIe 4.0(*), there is a new way to disable
in-band presence reporting, such that PDS always reports the status of
the out-of-band presence (if implemented).

For us, this means it is legal to get a Card Present event after the
link is active, and the driver was loaded. This causes an erroneous
removal of the device driver, followed by immediate re-probing.

In a fully PCIe-compliant world, we could leave inband presence
enabled and not require any software changes. However, certain OEMs
simply disable inband presence without implementing the requisite
query and control bits. I present two solutions to resolve this.

The first and last patch in the series are required. Of the remaining
two, only one is required to complete the series. Since we don't yet have
a go/no-go on which method to use, both solutions are included:
- 2/4: Try to wait for PDS _before_ loading the driver
- 3/4: Load as usual, and recognize the delayed PDS event as such

(*) ECN was approved in Nov 2018, and is normative spec text. A lot of
the leaked PCIe 4.0 specs do not have this change.

Changes since v2:
* Dropped [RFC] from title
* Addressed style issue found by Lukas

Alexandru Gagniuc (4):
PCI: hotplug: Add support for disabling in-band presence
PCI: pciehp: Do not turn off slot if presence comes up after link
PCI: hotplug: Wait for PDS when in-band presence is disabled
PCI: hotplug: Add quirk For Dell nvme pcie switches

drivers/pci/hotplug/pciehp.h | 1 +
drivers/pci/hotplug/pciehp_ctrl.c | 24 ++++++++++++++
drivers/pci/hotplug/pciehp_hpc.c | 52 ++++++++++++++++++++++++++++++-
include/linux/pci.h | 1 +
include/uapi/linux/pci_regs.h | 2 ++
5 files changed, 79 insertions(+), 1 deletion(-)

--
2.20.1