PCI/ASPM: Update save_state when configuration changes
authorVidya Sagar <vidyas@nvidia.com>
Fri, 23 Feb 2024 19:36:24 +0000 (13:36 -0600)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 12 Mar 2024 17:09:12 +0000 (12:09 -0500)
commit6d4266675279b38c301243f3a4fac4a511b03246
treee834f95941d0bea1ac6c5ce7b6c1da067cec31d1
parent64dbb2d707444f691539fb12aacf81797786c10b
PCI/ASPM: Update save_state when configuration changes

Many PCIe device drivers save the configuration state of their device
during probe and restore it when their .slot_reset() hook is called during
PCIe error recovery.

If the ASPM configuration is changed after the driver's probe is called and
before an error event occurs, .slot_reset() restores the ASPM configuration
to what it was at the time of probe, not to what it was just before the
occurrence of the error event.  This leads to a mismatch in ASPM
configuration between the device and its upstream device.

Update the saved configuration of the device when the ASPM configuration
changes.

Link: https://lore.kernel.org/r/20240222174436.3565146-1-vidyas@nvidia.com
Signed-off-by: Vidya Sagar <vidyas@nvidia.com>
[bhelgaas: commit log, rebase to pci/aspm, rename to
pci_update_aspm_saved_state() since it updates only LNKCTL, update only
ASPMC and CLKREQ_EN in LNKCTL]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Reviewed-by: David E. Box <david.e.box@linux.intel.com>
drivers/pci/pcie/aspm.c