From cb4b537baacfc179af09877d1533fb3f50e5df53 Mon Sep 17 00:00:00 2001 From: Dj <43033058+DjDeveloperr@users.noreply.github.com> Date: Thu, 26 Nov 2026 02:47:42 -0500 Subject: [PATCH] PCI: apple: retire the J713 tunneled port when its stop and undo both fail When the noirq suspend of the J713 tunneled port fails partway, it puts the port back before refusing the sleep. If the dock left during the stop, that undo fails too, and the kernel panicked. End it as the T6050 stop and the resume already do: mark the port as failed and its hierarchy disconnected before the functions below resume and read their config space, and refuse the sleep. Config space stays closed, the tunnel teardown that follows removes the hierarchy and stops the port, and the ACIO host still ends the DART transaction. Fixes: 37c6514184e9 ("PCI: apple: stop and restart the J713 tunneled port for a deep sleep") Signed-off-by: Dj <43033058+DjDeveloperr@users.noreply.github.com> --- drivers/pci/controller/pcie-apple-cio.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/pcie-apple-cio.c b/drivers/pci/controller/pcie-apple-cio.c index 717cea2ca891e..53e44433da616 100644 --- a/drivers/pci/controller/pcie-apple-cio.c +++ b/drivers/pci/controller/pcie-apple-cio.c @@ -441,7 +441,18 @@ static int apple_pcie_cio_suspend(struct apple_pcie *pcie) unwind: /* PM does not resume a device whose own suspend callback failed. */ recover = apple_pcie_cio_resume(pcie); - if (recover) - panic("Apple PCIe-C: suspend %d, recovery %d; DMA remains closed", ret, recover); + if (recover) { + /* + * A dock that left during the stop does not come back for the undo + * either. Retire the port as after a surprise removal before the + * functions below resume: they are marked disconnected, config + * space stays closed, the port is stopped when the tunnel goes, + * and the sleep is refused. + */ + dev_err(pcie->dev, "CIO PCIe-C not back after the failed stop (%d, undo %d): retired as after an unplug\n", + ret, recover); + pcie->resume_failed = true; + apple_pcie_tunnel_hierarchy_gone(pcie->dev); + } return ret; }