Re: rtsx_pci not restoring ASPM state after suspend/resume

From: Bjorn Helgaas
Date: Mon Jul 27 2020 - 10:14:56 EST

On Sat, Jul 25, 2020 at 09:27:11PM +0100, James Ettle wrote:
> On Fri, 2020-07-24 at 18:13 -0500, Bjorn Helgaas wrote:
> >
> > Maybe we should simplify this a little bit more. James, if you don't
> > touch ASPM config at all, either manually or via udev, does the ASPM
> > configuration stay the same across suspend/resume?
> Yes, it stays the same. Explicitly:
> With the udev rule disabled, immediately following clean boot from
> power-off (and no additional tinkering), ASPM is OFF to the best of my
> knowledge:
> - link/l1_aspm in sysfs is 0 for PCI devices 0000:01:00.[01];
> - the processor sleeps no deeper than package C3.
> The situation above is the same following a suspend/resume cycle --
> both in terms of sysfs, and observed package C-state occupancy.
> [Tested on kernel 5.7.10, but the behaviour is the same as prior
> kernels.]

I don't know the connection between ASPM and package C-states, so I
need to simplify this even more. All I want to do right now is verify
that if we don't have any outside influences on the ASPM configuration
(eg, no manual changes and no udev rules), it stays the same across

In, we saw that
ASPM L0s was disabled before suspend but was enabled after resume.
That should not happen.

You're looking at the sysfs link/l1_aspm file, which tells us what the
PCI core thinks the state is, but I'm not confident that's accurate,
especially because the driver fiddles with the state behind the back
of the PCI core. So let's read the ASPM state directly from the
hardware like this:

sudo lspci -vvs 00:1d.0 | egrep "^0|Lnk|L1|LTR|snoop"
sudo lspci -vvs 01:00 | egrep "^0|Lnk|L1|LTR|snoop"

Can you try that before and after suspend/resume?