Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

PCI: dwc: Return -EIO from dw_pcie_wait_for_link() if device is not active

There are cases where the PCIe device would be physically connected to the
bus, but the device firmware might not be active. So the LTSSM will
get stuck in POLL.{Active/Compliance} states.

This behavior is common with endpoint devices controlled by the PCI
Endpoint framework, where the device will wait for the user to start its
operation through configfs.

For those cases, print the relevant log and return -EIO to indicate that
the device is present, but not active. This will allow the callers to skip
the failure as the device might become active in the future.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Reviewed-by: Niklas Cassel <cassel@kernel.org>
Link: https://patch.msgid.link/20260120-pci-dwc-suspend-rework-v4-2-2f32d5082549@oss.qualcomm.com

authored by

Manivannan Sadhasivam and committed by
Manivannan Sadhasivam
01d16b8a 1bcf245c

+13 -2
+13 -2
drivers/pci/controller/dwc/pcie-designware.c
··· 696 696 * dw_pcie_wait_for_link - Wait for the PCIe link to be up 697 697 * @pci: DWC instance 698 698 * 699 - * Returns: 0 if link is up, -ENODEV if device is not found, -ETIMEDOUT if the 700 - * link fails to come up for other reasons. 699 + * Returns: 0 if link is up, -ENODEV if device is not found, -EIO if the device 700 + * is found but not active and -ETIMEDOUT if the link fails to come up for other 701 + * reasons. 701 702 */ 702 703 int dw_pcie_wait_for_link(struct dw_pcie *pci) 703 704 { ··· 723 722 ltssm == DW_PCIE_LTSSM_DETECT_ACT) { 724 723 dev_info(pci->dev, "Device not found\n"); 725 724 return -ENODEV; 725 + 726 + /* 727 + * If the link is in POLL.{Active/Compliance} state, then the 728 + * device is found to be connected to the bus, but it is not 729 + * active i.e., the device firmware might not yet initialized. 730 + */ 731 + } else if (ltssm == DW_PCIE_LTSSM_POLL_ACTIVE || 732 + ltssm == DW_PCIE_LTSSM_POLL_COMPLIANCE) { 733 + dev_info(pci->dev, "Device found, but not active\n"); 734 + return -EIO; 726 735 } 727 736 728 737 dev_info(pci->dev, "Phy link never came up\n");