PCI/ASPM: Save LTR Capability for suspend/resume
authorBjorn Helgaas <bhelgaas@google.com>
Wed, 9 Jan 2019 14:22:08 +0000 (08:22 -0600)
committerBjorn Helgaas <helgaas@kernel.org>
Mon, 11 Feb 2019 23:34:45 +0000 (17:34 -0600)
commitdbbfadf2319005cf528b0f15f12a05d4e4644303
treed4aa42833078d55a9475f89d1f273ba2fc2a937a
parent10ecc818ea7319b5d0d2b4e1aa6a77323e776f76
PCI/ASPM: Save LTR Capability for suspend/resume

Latency Tolerance Reporting (LTR) allows Endpoints and Switch Upstream
Ports to report their latency requirements to upstream components.  If ASPM
L1 PM substates are enabled, the LTR information helps determine when a
Link enters L1.2 [1].

Software must set the maximum latency values in the LTR Capability based on
characteristics of the platform, then set LTR Mechanism Enable in the
Device Control 2 register in the PCIe Capability.  The device can then use
LTR to report its latency tolerance.

If the device reports a maximum latency value of zero, that means the
device requires the highest possible performance and the ASPM L1.2 substate
is effectively disabled.

We put devices in D3 for suspend, and we assume their internal state is
lost.  On resume, previously we did not restore the LTR Capability, but we
did restore the LTR Mechanism Enable bit, so devices would request the
highest possible performance and ASPM L1.2 wouldn't be used.

[1] PCIe r4.0, sec 5.5.1
Link: https://bugzilla.kernel.org/show_bug.cgi?id=201469
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/pci.c