Skip to content

Conversation

@seankingyang
Copy link
Contributor

@seankingyang seankingyang commented Oct 17, 2025

Description

Wait for PR #2166 merge or this github action will failed in unit test.

This PR adds a new test script pcie_test.py to validate PCIe device configurations on Ubuntu systems (x86 and ARM64).

  • New script providers/base/bin/pcie_test.py that uses lspci to verify:
    • PCIe link speed and width match device capabilities
    • ASPM (Active State Power Management) state matches hardware support
  • List all PCIe devices with resource discovery command

Documentation

$ sudo ./pcie_test.py -h
usage: pcie_test.py [-h] [--debug] {resource,check_speed,check_aspm} ...

A script to test PCIe link state against hardware capability.

positional arguments:
  {resource,check_speed,check_aspm}
                        Available commands
    resource            List all PCIe devices.
    check_speed         Check the link speed and width of a specific PCIe device.
    check_aspm          Check the ASPM state of a specific PCIe device.

options:
  -h, --help            show this help message and exit
  --debug               Turn on debug level output for extra info during test run.

Usage examples:

# List all PCIe devices
pcie_test.py resource

# Check link speed (skip if unsupported)
pcie_test.py check_speed -s 00:00.0

# Check link speed with strict mode
pcie_test.py check_speed -s 00:00.0 --force

# Check ASPM state
pcie_test.py check_aspm -s 01:00.0

# Check ASPM with strict mode
pcie_test.py check_aspm -s 01:00.0 --force

# Enable debug logging
pcie_test.py --debug check_speed -s 00:00.0

Tests

List all PCIe devices:

$ sudo ./pcie_test.py resource
Discovering PCIe resources...                                                                                                                                                                 
pcie_num: 0000:00:00.0
pcie_name: Host bridge: Intel Corporation 11th Gen Core Processor Host Bridge/DRAM Registers (rev 01)                                                                                         
                                                                                                                                                                                              
pcie_num: 0000:00:02.0                                                                         
pcie_name: VGA compatible controller: Intel Corporation TigerLake-LP GT2 [Iris Xe Graphics] (rev 01)                                                                                          
                                                                                               
pcie_num: 0000:00:04.0                                                                                                                                                                        
pcie_name: Signal processing controller: Intel Corporation TigerLake-LP Dynamic Tuning Processor Participant (rev 01)                                                                                                                                                        
                                                                                                                                                                                              
pcie_num: 0000:00:0e.0                                                                         
pcie_name: RAID bus controller: Intel Corporation Volume Management Device NVMe RAID Controller
<.... skip ...>

Check link speed:

# Can't get the LnkCap w/ and w/o --force
$ sudo ./pcie_test.py --debug check_speed -s 0000:00:00.0; echo $?
INFO     LnkCap/LnkSta not found for device 0000:00:00.0. Skipping link check.
0
$ sudo ./pcie_test.py --debug check_speed -s 0000:00:00.0  --force ; echo $?
ERROR    LnkCap/LnkSta not found for device 0000:00:00.0 (--force enabled).
1

# Speed match between LnkCap and LnkSta
$ sudo ./pcie_test.py --debug check_speed -s 10000:e1:00.0 ; echo $?
DEBUG    LnkCap:        Port #0, Speed 8GT/s, Width x4, ASPM L1, Exit Latency L1 <8us
DEBUG    LnkSta:        Speed 8GT/s (ok), Width x4 (ok)
INFO     Expect: Speed 8GT/s, Width x4
INFO     Actually: Speed 8GT/s, Width x4
INFO     Those two are match
0
$ sudo ./pcie_test.py --debug check_speed -s 10000:e1:00.0 --force ; echo $?
DEBUG    LnkCap:        Port #0, Speed 8GT/s, Width x4, ASPM L1, Exit Latency L1 <8us
DEBUG    LnkSta:        Speed 8GT/s (ok), Width x4 (ok)
INFO     Expect: Speed 8GT/s, Width x4
INFO     Actually: Speed 8GT/s, Width x4
INFO     Those two are match
0

# Speed not match between LnkCap and LnkSta
$ sudo ./pcie_test.py --debug check_speed -s 0000:00:06.0; echo $?
DEBUG    LnkCap:        Port #1, Speed 16GT/s, Width x4, ASPM not supported
DEBUG    LnkSta:        Speed 8GT/s (downgraded), Width x4 (ok)
INFO     Expect: Speed 16GT/s, Width x4
INFO     Actually: Speed 8GT/s, Width x4
ERROR    Those two are not match.
1
$ sudo ./pcie_test.py --debug check_speed -s 0000:00:06.0 --force; echo $?
DEBUG    LnkCap:        Port #1, Speed 16GT/s, Width x4, ASPM not supported
DEBUG    LnkSta:        Speed 8GT/s (downgraded), Width x4 (ok)
INFO     Expect: Speed 16GT/s, Width x4
INFO     Actually: Speed 8GT/s, Width x4
ERROR    Those two are not match.
1

Check ASPM state:

# Can't get the LnkCap w/ and w/o --force
$ sudo ./pcie_test.py check_aspm -s 0000:00:00.0 ; echo $?
INFO     LnkCap not found for device 0000:00:00.0. Cannot check ASPM. Skipping.
0
$ sudo ./pcie_test.py check_aspm -s 0000:00:00.0 --force ; echo $?
ERROR    LnkCap not found for device 0000:00:00.0. Cannot check ASPM (--force enabled).
1

# ASPM enable
$ sudo ./pcie_test.py check_aspm -s 10000:e1:00.0 ; echo $?
INFO     ASPM is supported by hardware for device 10000:e1:00.0.
INFO     LnkCap: LnkCap:        Port #0, Speed 8GT/s, Width x4, ASPM L1, Exit Latency L1 <8us
INFO     LnkCtl: LnkCtl:        ASPM L1 Enabled; RCB 64 bytes, Disabled- CommClk+
INFO     Pass: ASPM is supported and enabled (or not explicitly disabled).
0
$ sudo ./pcie_test.py check_aspm -s 10000:e1:00.0 --force ; echo $?
INFO     ASPM is supported by hardware for device 10000:e1:00.0.
INFO     LnkCap: LnkCap:        Port #0, Speed 8GT/s, Width x4, ASPM L1, Exit Latency L1 <8us
INFO     LnkCtl: LnkCtl:        ASPM L1 Enabled; RCB 64 bytes, Disabled- CommClk+
INFO     Pass: ASPM is supported and enabled (or not explicitly disabled).
0

# ASPM disable
$ sudo ./pcie_test.py check_aspm -s 0000:00:06.0 ; echo $?
INFO     ASPM is supported by hardware for device 0000:00:06.0.
INFO     LnkCap: LnkCap:        Port #1, Speed 16GT/s, Width x4, ASPM not supported
INFO     LnkCtl: LnkCtl:        ASPM Disabled; RCB 64 bytes, Disabled- CommClk+
ERROR    Fail: ASPM is supported by hardware but is disabled in LnkCtl.
1
$ sudo ./pcie_test.py check_aspm -s 0000:00:06.0 --force ; echo $?
INFO     ASPM is supported by hardware for device 0000:00:06.0.
INFO     LnkCap: LnkCap:        Port #1, Speed 16GT/s, Width x4, ASPM not supported
INFO     LnkCtl: LnkCtl:        ASPM Disabled; RCB 64 bytes, Disabled- CommClk+
ERROR    Fail: ASPM is supported by hardware but is disabled in LnkCtl.
1

@codecov
Copy link

codecov bot commented Oct 20, 2025

Codecov Report

❌ Patch coverage is 97.25275% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.43%. Comparing base (523ed1e) to head (fc00c41).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
providers/base/bin/pcie_test.py 97.25% 0 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2162      +/-   ##
==========================================
+ Coverage   53.24%   53.43%   +0.18%     
==========================================
  Files         399      400       +1     
  Lines       42810    42992     +182     
  Branches     7906     7944      +38     
==========================================
+ Hits        22796    22973     +177     
  Misses      19209    19209              
- Partials      805      810       +5     
Flag Coverage Δ
provider-base 30.57% <97.25%> (+0.74%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant