Linux PCI subsystem development
 help / color / mirror / Atom feed
* [PATCH 0/3] PCI/ASPM: keep software state and hardware in sync
@ 2026-11-27  2:11 Yaxiong Tian
  2026-11-27  2:13 ` [PATCH 1/3] PCI/ASPM: Only update ASPM and CLKREQ bits in the saved LNKCTL Yaxiong Tian
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Yaxiong Tian @ 2026-11-27  2:11 UTC (permalink / raw)
  To: bhelgaas, mani, krishna.chundru, ilpo.jarvinen, lukas,
	sathyanarayanan.kuppuswamy, david.e.box, vidyas
  Cc: linux-pci, Yaxiong Tian

Three places where the ASPM core ends up recording one state while the
hardware is in another.  They are independent patches, but all three are
about the same invariant: link->aspm_enabled and the saved LNKCTL must
match what is programmed in the device.

1/3 Only update ASPM and CLKREQ bits in the saved LNKCTL

    pci_update_aspm_saved_state() rebuilt the whole saved LNKCTL from a
    value read back from hardware.  When that read failed, or returned
    PCI_ERROR_RESPONSE, the snapshot became zeroes or all ones, and
    pci_restore_pcie_state() wrote that back: ASPMC and CCC were lost in
    the first case, ASPMC was forced to L0s+L1 in the second.

2/3 Update saved LNKCTL for every function of the link

    pcie_config_aspm_link() programs LNKCTL on every function of the
    downstream component, but refreshed only function 0's snapshot.  A
    driver calling pci_restore_state() from slot_reset() put the other
    functions back to a stale ASPMC value, leaving the functions of one
    link disagreeing.

3/3 Disable ASPM left on by firmware after a HEADER quirk

    A HEADER quirk that clears the cached L0s/L1 support makes
    pcie_aspm_cap_init() return before reading LNKCTL.  Firmware may have
    enabled ASPM on that link, and because link->aspm_enabled stays zero,
    every later request finds the link "already disabled" and leaves the
    hardware alone.  Mark all states enabled and disabled before
    returning, as the blacklist path has always done, so the next
    pcie_config_aspm_path() clears LNKCTL.ASPMC.

The first two were found by inspection while porting the L0s/L1 caching
series; the third is a regression from 30579eebba6a, which is in v6.18.
None of them has been reproduced on hardware; the analysis is from the
code paths quoted in each commit message.

Yaxiong Tian (3):
  PCI/ASPM: Only update ASPM and CLKREQ bits in the saved LNKCTL
  PCI/ASPM: Update saved LNKCTL for every function of the link
  PCI/ASPM: Disable ASPM left on by firmware after a HEADER quirk

 drivers/pci/pcie/aspm.c | 42 ++++++++++++++++++++++++++++++++---------
 1 file changed, 33 insertions(+), 9 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-11-27  2:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27  2:11 [PATCH 0/3] PCI/ASPM: keep software state and hardware in sync Yaxiong Tian
2026-11-27  2:13 ` [PATCH 1/3] PCI/ASPM: Only update ASPM and CLKREQ bits in the saved LNKCTL Yaxiong Tian
2026-11-27  2:13 ` [PATCH 2/3] PCI/ASPM: Update saved LNKCTL for every function of the link Yaxiong Tian
2026-11-27  2:13 ` [PATCH 3/3] PCI/ASPM: Disable ASPM left on by firmware after a HEADER quirk Yaxiong Tian
2026-11-27  2:32   ` sashiko-bot
2026-11-27  2:33 ` [PATCH 0/3] PCI/ASPM: keep software state and hardware in sync sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox