What can I do to enable ASPM?

Hi,

my home server (HP ProDesk 600 G4) doesn’t get lower then C2 even with PCIe Power Management enabled in BIOS:
Screenshot 2024-08-10 at 21.16.00

After enabling ASPM on the M.2 SATA card and the NIC with this script I got following output:

❯ sudo lspci -vv | awk '/ASPM/{print $0}' RS= | grep --color -P '(^[a-z0-9:.]+|ASPM )'

00:01.0 PCI bridge: Intel Corporation 6th-10th Gen Core Processor PCIe Controller (x16) (rev 07) (prog-if 00 [Normal decode])
                LnkCap: Port #2, Speed 8GT/s, Width x16, ASPM L0s L1, Exit Latency L0s <256ns, L1 <8us
                LnkCtl: ASPM L0s L1 Enabled; RCB 64 bytes, LnkDisable- CommClk+
00:1b.0 PCI bridge: Intel Corporation Cannon Lake PCH PCI Express Root Port #21 (rev f0) (prog-if 00 [Normal decode])
                LnkCap: Port #21, Speed 8GT/s, Width x4, ASPM L0s L1, Exit Latency L0s <1us, L1 <16us
                LnkCtl: ASPM L0s L1 Enabled; RCB 64 bytes, LnkDisable- CommClk+
01:00.0 PCI bridge: ASMedia Technology Inc. ASM1187e 7-Port PCIe x1 Gen2 Packet Switch (prog-if 00 [Normal decode])
                LnkCap: Port #0, Speed 5GT/s, Width x1, ASPM L0s L1, Exit Latency L0s <2us, L1 unlimited
                LnkCtl: ASPM L0s L1 Enabled; LnkDisable- CommClk+
02:01.0 PCI bridge: ASMedia Technology Inc. ASM1187e 7-Port PCIe x1 Gen2 Packet Switch (prog-if 00 [Normal decode])
                LnkCap: Port #1, Speed 5GT/s, Width x1, ASPM L0s L1, Exit Latency L0s unlimited, L1 unlimited
                LnkCtl: ASPM L0s L1 Enabled; LnkDisable- CommClk-
02:02.0 PCI bridge: ASMedia Technology Inc. ASM1187e 7-Port PCIe x1 Gen2 Packet Switch (prog-if 00 [Normal decode])
                LnkCap: Port #2, Speed 5GT/s, Width x1, ASPM L0s L1, Exit Latency L0s <2us, L1 unlimited
                LnkCtl: ASPM L0s L1 Enabled; LnkDisable- CommClk+
02:03.0 PCI bridge: ASMedia Technology Inc. ASM1187e 7-Port PCIe x1 Gen2 Packet Switch (prog-if 00 [Normal decode])
                LnkCap: Port #3, Speed 5GT/s, Width x1, ASPM L0s L1, Exit Latency L0s <2us, L1 unlimited
                LnkCtl: ASPM L0s L1 Enabled; LnkDisable- CommClk+
02:04.0 PCI bridge: ASMedia Technology Inc. ASM1187e 7-Port PCIe x1 Gen2 Packet Switch (prog-if 00 [Normal decode])
                LnkCap: Port #4, Speed 5GT/s, Width x4, ASPM L0s L1, Exit Latency L0s <2us, L1 unlimited
                LnkCtl: ASPM L0s L1 Enabled; LnkDisable- CommClk-
02:05.0 PCI bridge: ASMedia Technology Inc. ASM1187e 7-Port PCIe x1 Gen2 Packet Switch (prog-if 00 [Normal decode])
                LnkCap: Port #5, Speed 5GT/s, Width x1, ASPM L0s L1, Exit Latency L0s unlimited, L1 unlimited
                LnkCtl: ASPM L0s L1 Enabled; LnkDisable- CommClk-
02:06.0 PCI bridge: ASMedia Technology Inc. ASM1187e 7-Port PCIe x1 Gen2 Packet Switch (prog-if 00 [Normal decode])
                LnkCap: Port #6, Speed 5GT/s, Width x1, ASPM L0s L1, Exit Latency L0s unlimited, L1 unlimited
                LnkCtl: ASPM L0s L1 Enabled; LnkDisable- CommClk-
02:07.0 PCI bridge: ASMedia Technology Inc. ASM1187e 7-Port PCIe x1 Gen2 Packet Switch (prog-if 00 [Normal decode])
                LnkCap: Port #7, Speed 5GT/s, Width x1, ASPM L0s L1, Exit Latency L0s unlimited, L1 unlimited
                LnkCtl: ASPM L0s L1 Enabled; LnkDisable- CommClk-
04:00.0 Ethernet controller: Intel Corporation Ethernet Controller I225-V (rev 03)
                LnkCap: Port #2, Speed 5GT/s, Width x1, ASPM L1, Exit Latency L1 <4us
                LnkCtl: ASPM L1 Enabled; RCB 64 bytes, LnkDisable- CommClk+
05:00.0 Ethernet controller: Intel Corporation Ethernet Controller I225-V (rev 03)
                LnkCap: Port #3, Speed 5GT/s, Width x1, ASPM L1, Exit Latency L1 <4us
                LnkCtl: ASPM L1 Enabled; RCB 64 bytes, LnkDisable- CommClk+
0a:00.0 SATA controller: ASMedia Technology Inc. ASM1166 Serial ATA Controller (rev 02) (prog-if 01 [AHCI 1.0])
                LnkCap: Port #0, Speed 8GT/s, Width x2, ASPM L0s L1, Exit Latency L0s <4us, L1 <64us
                LnkCtl: ASPM L0s L1 Enabled; RCB 64 bytes, LnkDisable- CommClk+

This doesn’t change the c-state output of powertop at all. Then I’ve found this log message:

❯ dmesg | grep -i aspm
[    0.000000] Command line: BOOT_IMAGE=(hd0,gpt1)//kernels/yiiaqa492p76rapm9h6rc3vm6wiisrig-linux-6.6.44-bzImage init=/nix/store/3k0vp3rffx1mrkiy4qcv075hcibwfivg-nixos-system-regis-24.05.20240806.21cc704/init ip=10.0.0.10::10.0.0.1:255.0.0.0:regis::none pcie_aspm=force acpi_enforce_resources=lax nohibernate loglevel=4
[    0.087074] Kernel command line: BOOT_IMAGE=(hd0,gpt1)//kernels/yiiaqa492p76rapm9h6rc3vm6wiisrig-linux-6.6.44-bzImage init=/nix/store/3k0vp3rffx1mrkiy4qcv075hcibwfivg-nixos-system-regis-24.05.20240806.21cc704/init ip=10.0.0.10::10.0.0.1:255.0.0.0:regis::none pcie_aspm=force acpi_enforce_resources=lax nohibernate loglevel=4
[    0.087118] PCIe ASPM is forcibly enabled
[    0.228504] ACPI FADT declares the system doesn't support PCIe ASPM, so disable it
[    0.319852] acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI HPX-Type3]
[    0.323192] acpi PNP0A08:00: FADT indicates ASPM is unsupported, using BIOS configuration

After a couple hours of research I got a little bit frustrated. I’ve found this blog post about the same problem and the way how the author fixed it. But unfortunately I had to step back at the part of ACPI tables patching because it isn’t described enough for me.

To my question: Is there a “easy” way to patch ACPI tables to enable ASPM?

How about you try to follow this guide and ask for help with anything you get stuck with?