On Wed, Sep 27, 2023 at 4:12 PM Kamil Paral <kparal@xxxxxxxxxx> wrote: > > On Wed, Sep 27, 2023 at 3:53 PM Mika Westerberg > <mika.westerberg@xxxxxxxxxxxxxxx> wrote: > > If you apply the patch from here: > > > > https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git/commit/?h=pm&id=6786c2941fe1788035f99c98c932672138b3fbc5 > > > > Does the problem go away with the disconnect case too (and so that you > > have "secure" enabled)? > > Thanks, I'll test it, but I can't do it this week. I'll reply next week. Hello Mika, sorry for taking me so long. The URL above gives me a "Bad commit reference" error, but I found a patch mentioned in a different thread, so I used that one, and I hope it's the correct one :-) It's quoted below. With the patch applied, I can confirm that disconnecting and reconnecting the cable during suspend is no longer a problem. I tested both "user" and "secure" Thunderbolt security levels. The resume is fast in all cases, and I've found no issues. Thanks for working on it! The patch I used: > --- > drivers/pci/pci-driver.c | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) > > diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c > index a79c110c7e51..51ec9e7e784f 100644 > --- a/drivers/pci/pci-driver.c > +++ b/drivers/pci/pci-driver.c > @@ -572,7 +572,19 @@ static void pci_pm_default_resume_early(struct pci_dev *pci_dev) > > static void pci_pm_bridge_power_up_actions(struct pci_dev *pci_dev) > { > - pci_bridge_wait_for_secondary_bus(pci_dev, "resume"); > + int ret; > + > + ret = pci_bridge_wait_for_secondary_bus(pci_dev, "resume"); > + if (ret) { > + /* > + * The downstream link failed to come up, so mark the > + * devices below as disconnected to make sure we don't > + * attempt to resume them. > + */ > + pci_walk_bus(pci_dev->subordinate, pci_dev_set_disconnected, > + NULL); > + return; > + } > > /* > * When powering on a bridge from D3cold, the whole hierarchy may be > --