From 4d9991273baa0cbb5cf9518abb736d7046a17d04 Mon Sep 17 00:00:00 2001 From: Joshua Warren <816217+joshuaswarren@users.noreply.github.com> Date: Thu, 12 Nov 2026 19:11:10 +0000 Subject: [PATCH] PCI: apple: accept an endpoint in D3hot for the adopted-link s2idle check apple_pcie_check_d0 refused every endpoint that was not in D0. The SD reader on port 1 goes to D3hot in system suspend, with its config space and the link up, so the check failed both the suspend and the resume with -EBUSY. Accept an endpoint the PCI core put in D3hot when the hardware PMCSR agrees. The case is for an endpoint only: a root port or switch port keeps the D0 requirement. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com> --- drivers/pci/controller/pcie-apple.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/pcie-apple.c b/drivers/pci/controller/pcie-apple.c index 8e20a36cc575e..1cb3d6b10fb46 100644 --- a/drivers/pci/controller/pcie-apple.c +++ b/drivers/pci/controller/pcie-apple.c @@ -6733,6 +6733,8 @@ static bool apple_pcie_below_kernel_trained_port(struct pci_dev *pdev) * * Check hardware PMCSR rather than current_state: the PCI core may mark a * driverless root port PCI_UNKNOWN even though its hardware remains in D0. + * An endpoint the core itself put in D3hot (the SD reader on port 1: its + * config space and link stay up) is accepted when the hardware agrees. */ static int apple_pcie_check_d0(struct pci_dev *pdev, void *data) { @@ -6754,7 +6756,10 @@ static int apple_pcie_check_d0(struct pci_dev *pdev, void *data) *error = -ENODEV; } else if (pdev->pm_cap && (pci_read_config_word(pdev, pdev->pm_cap + PCI_PM_CTRL, &value) || - (value & PCI_PM_CTRL_STATE_MASK) != PCI_D0)) { + ((value & PCI_PM_CTRL_STATE_MASK) != PCI_D0 && + !(!pci_is_bridge(pdev) && + (value & PCI_PM_CTRL_STATE_MASK) == PCI_D3hot && + pdev->current_state == PCI_D3hot)))) { *error = -EBUSY; } if (*error)