• Mika Westerberg's avatar
    PCI/PM: Assume ports without DLL Link Active train links in 100 ms · ec411e02
    Mika Westerberg authored
    Kai-Heng Feng reported that it takes a long time (> 1 s) to resume
    Thunderbolt-connected devices from both runtime suspend and system sleep
    (s2idle).
    
    This was because some Downstream Ports that support > 5 GT/s do not also
    support Data Link Layer Link Active reporting.  Per PCIe r5.0 sec 6.6.1:
    
      With a Downstream Port that supports Link speeds greater than 5.0 GT/s,
      software must wait a minimum of 100 ms after Link training completes
      before sending a Configuration Request to the device immediately below
      that Port. Software can determine when Link training completes by polling
      the Data Link Layer Link Active bit or by setting up an associated
      interrupt (see Section 6.7.3.3).
    
    Sec 7.5.3.6 requires such Ports to support DLL Link Active reporting, but
    at least the Intel JHL6240 Thunderbolt 3 Bridge [8086:15c0] and the Intel
    JHL7540 Thunderbolt 3 Bridge [8086:15ea] do not.
    
    Previously we tried to wait for Link training to complete, but since there
    was no DLL Link Active reporting, all we could do was wait the worst-case
    1000 ms, then another 100 ms.
    
    Instead of using the supported speeds to determine whether to wait for Link
    training, check whether the port supports DLL Link Active reporting.  The
    Ports in question do not, so we'll wait only the 100 ms required for Ports
    that support Link speeds <= 5 GT/s.
    
    This of course assumes these Ports always train the Link within 100 ms even
    if they are operating at > 5 GT/s, which is not required by the spec.
    
    [bhelgaas: commit log, comment]
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=206837
    Link: https://lore.kernel.org/r/20200514133043.27429-1-mika.westerberg@linux.intel.comReported-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
    Tested-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
    Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
    Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
    ec411e02
pci.c 173 KB