Last edited 5 months ago

How to activate PCIe ASPM


1. Article purpose

The purpose of this article is to explain how to activate the PCIe ASPM.

ASPM (active-state power management) is a mechanism to progressively reduce power consumption thanks to the L0s/L1 substates.

  • L0s (standby) only turns off the controller transmit lane, but the link remains active.
  • L1 the link becomes inactive, and a link recovery is needed to reactivate the link.

Linux allows three configuration mode for ASPM

  • Default: Use default settings specified by the firmware on the system.
  • Powersave: Sets ASPM to save power, regardless of the cost due to link recovery latency.
  • Performance: Sets ASPM to avoid PCIE link entering ASPM during idle times.

2. How to activate the power saving mode

To change the PCIe ASPM to power save mode, first check that the PCIe endpoint capability supports ASPM:

root@stm32mp2:~# lspci -vv -s 03:00.0 | grep ASPM
LnkCap: Port #0, Speed 5GT/s, Width x1, ASPM L0s L1, Exit Latency L0s <4us, L1 unlimited
ClockPM+ Surprise- LLActRep- BwNot- ASPMOptComp-
LnkCtl: ASPM Disabled; RCB 64 bytes, Disabled- CommClk+

It is possible to dynamically change the policy either from the /sys/fs:

root@stm32mp2:~# echo powersave > /sys/module/pcie_aspm/parameters/policy

Or using the boot flag:

pcie_aspm.policy=powersave
root@stm32mp2:~# lspci -vv -s 03:00.0 | grep ASPM
LnkCap: Port #0, Speed 5GT/s, Width x1, ASPM L0s L1, Exit Latency L0s <4us, L1 unlimited
ClockPM+ Surprise- LLActRep- BwNot- ASPMOptComp-
LnkCtl: ASPM L0s L1 Enabled; RCB 64 bytes, Disabled- CommClk+

Default config can be changed with:

CONFIG_PCIEASPM_POWERSAVE=y