On Thu, Sep 24, 2020 at 04:24:37PM +0200, Saheed O. Bolarinwa wrote: > pcie_get_aspm_reg() reads LNKCAP to learn whether the device supports > ASPM L0s and/or L1 and L1 substates. > > If we cache the entire LNKCAP word early enough, we may be able to > use it in other places that read LNKCAP, e.g. pcie_get_speed_cap(), > pcie_get_width_cap(), pcie_init(), etc. > > - Add struct pci_dev.lnkcap (u32) > - Read PCI_EXP_LNKCAP in set_pcie_port_type() and save it > in pci_dev.lnkcap > - Use pdev->lnkcap instead of reading PCI_EXP_LNKCAP I think we need to be a little careful here because there's a note in the spec (PCIe r5.0, sec 7.5.3.6): Note that exit latencies may be influenced by PCI Express reference clock configuration depending upon whether a component uses a common or separate reference clock. So if we change the common clock configuration, e.g., in pcie_aspm_configure_common_clock() or anything else that writes PCI_EXP_LNKCTL_CCC, I think we will need to update pdev->lnkcap.