On Fri, May 7, 2021 at 12:07 AM Lukas Wunner <lukas@xxxxxxxxx> wrote: > > On Thu, May 06, 2021 at 04:48:42PM -0500, Bjorn Helgaas wrote: > > On Thu, May 06, 2021 at 08:38:20PM +0300, Konstantin Kharlamov wrote: > > > On Macbook 2013 resuming from s2idle results in external monitor no > > > longer being detected, and dmesg having errors like: > > > > > > pcieport 0000:06:00.0: can't change power state from D3hot to D0 (config space inaccessible) > > > > > > and a stacktrace. The reason turned out that the hw that the quirk > > > powers off does not get powered on back on resume. > > > > quirk_apple_poweroff_thunderbolt() was added in 2014 by 1df5172c5c25 > > ("PCI: Suspend/resume quirks for Apple thunderbolt"). It claims > > "power is automatically restored before resume," so there must be > > something special about s2idle that prevents the power-on. > > With s2idle, the machine isn't suspended via ACPI, so the AML code > which powers the controller off isn't executed. The dance to prepare > the controller for power-off consequently isn't necessary but rather > harmful. > > To get the same power savings as with ACPI suspend, the controller > needs to be powered off via runtime suspend. I'm not quite sure why runtime PM needs to be involved. The controller suspend can happen in the system-wide suspend code path directly. > I posted patches for > that back in 2016. I'm using them on my laptop, they need some > polishing and rebasing before I can repost them due to massive > changes that have happened in the thunderbolt driver in the meantime. > Without these patches, the controller sucks 1.5W of power in s2idle. > > > Obviously the *hardware* hasn't changed since 1df5172c5c25. Is s2idle > > something that wasn't tested back then, or is this problem connected > > to an s2idle change since then? Can we identify a commit that > > introduced this problem? That would help with backporting or stable > > tags. > > Yes I believe the quirk predates the introduction of s2idle by a couple > of years. > > > > Signed-off-by: Konstantin Kharlamov <Hi-Angel@xxxxxxxxx> > > Reviewed-by: Lukas Wunner <lukas@xxxxxxxxx> > > The patch looks fine to me. > > Thanks, > > Lukas