Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
metadata:
name: ethernet-inventory-validation
format: "Lava-Test Test Definition 1.0"
description: "Inventory physical Ethernet interfaces, MAC drivers, PHY identity, device-tree identity, queue topology, and platform bindings without changing network configuration."
description: "Inventory Ethernet interfaces, drivers, PHY and queue topology, including runtime-gated QPS615 readiness, without changing network configuration."
os:
- linux
scope:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,38 @@ For each interface, the testcase reports and validates:

The testcase does not bring interfaces up, run DHCP, change link settings, or transmit traffic.

When the runtime PCI topology contains a QPS615 switch (`1179:0623`), the
testcase also correlates downstream TC956x driver functions with exported
Ethernet interfaces and verifies that `TC956X_Firmware_PCIeBridge.bin` remains
available from a standard firmware root. Images without QPS615 retain the
generic Ethernet inventory behavior.

For each expected Toshiba `1179:0220` Ethernet function, the live log and TSV
include its PCI modalias, bound driver, exported netdevs, and availability of
the running-kernel `tc956x_pcie_eth` module. They also report whether that
module registered its `tc956x_pci-eth` PCI driver and expose the current
`tc956x_eth_ports_bdf` value, PCI driver-autoprobe state, per-function driver
override, runtime power state, and runtime OF node as diagnostic evidence. The
driver's all-zero BDF array selects its built-in defaults and is not itself a
failure. An enumerated Ethernet function that remains unbound is a real
Ethernet failure only when its runtime OF node declares a platform Ethernet
port through the current `phy-reset-gpios` property or the legacy
`qcom,phy-rst-gpio` property. Bare embedded PCI functions can be enumerated for
IOMMU/topology description even when no MAC/PHY port is provisioned, and are
reported as SKIP. The PCIe suite continues to evaluate switch topology and
firmware independently.

This classification follows the Qualcomm Linux PCIe and Ethernet guides: the
QPS615 MAC driver and kernel configuration are enabled by default, and the
supported Ethernet interfaces are expected to activate during startup once the
QPS615 driver is loaded and the PCIe link is established. Link carrier and the
optional AQR PHY are not required by this inventory-only testcase.

References:

- [Qualcomm Linux PCIe guide](https://docs.qualcomm.com/doc/80-70023-8/topic/pcie.html#pcie-software-support-feature-for-qps615)
- [Qualcomm Linux Ethernet bring-up guide](https://docs.qualcomm.com/bundle/publicresource/80-70023-26/topics/bring_up-ethernet.md)

## Prerequisites and infrastructure

- No cable, peer, DHCP service, or Internet connection is required.
Expand Down Expand Up @@ -52,9 +84,21 @@ Example:

## Result

```text
Ethernet_Inventory_Validation.res
Ethernet_Inventory_Validation.results.tsv
Check the final result and per-check summary:

```sh
cat Ethernet_Inventory_Validation.res
cat Ethernet_Inventory_Validation.results.tsv
```

The testcase passes when at least one physical Ethernet interface is enumerated with a bound driver and valid RX/TX queue entries. Optional OF and PHY properties are reported as SKIP when the corresponding bus or driver does not expose them.

On QPS615 systems, inspect the correlated PCIe, driver, and netdev evidence:

```sh
cat qps615_runtime/qps615_switches.log
cat qps615_runtime/qps615_runtime.tsv
```

The QPS615 files are empty or contain no switch records when the capability is
not present. That does not change the generic Ethernet result path.
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ if ! CHECK_DEPS_NO_EXIT=1 check_dependencies \
grep \
cat \
find \
head \
readlink \
uname; then

Expand All @@ -123,26 +124,93 @@ fi

log_info "Platform Details: machine='${PLATFORM_MACHINE:-unknown}' target='${PLATFORM_TARGET:-unknown}' kernel='$(uname -r 2>/dev/null || echo unknown)' arch='$(uname -m 2>/dev/null || echo unknown)'"

QPS615_RESULT_DIR="./qps615_runtime"
ethv_qps615_collect_runtime "$QPS615_RESULT_DIR"
qps615_status=$?

case "$qps615_status" in
0|1)
if [ -n "$QPS615_TOPOLOGY_FAILURE_REASON" ]; then
ethv_record_result \
"$RESULT_TABLE" \
"QPS615 PCIe topology and firmware" \
"FAIL" \
"$QPS615_TOPOLOGY_FAILURE_REASON"
else
ethv_record_result \
"$RESULT_TABLE" \
"QPS615 PCIe topology and firmware" \
"PASS" \
"bridge_functions=$QPS615_SWITCH_COUNT downstream=$QPS615_DOWNSTREAM_COUNT firmware=$QPS615_FIRMWARE_PATH"
fi

if [ -n "$QPS615_ETHERNET_FAILURE_REASON" ]; then
ethv_record_result \
"$RESULT_TABLE" \
"QPS615 Ethernet endpoint readiness" \
"FAIL" \
"$QPS615_ETHERNET_FAILURE_REASON"
elif [ -n "$QPS615_ETHERNET_SKIP_REASON" ]; then
ethv_record_result \
"$RESULT_TABLE" \
"QPS615 Ethernet endpoint readiness" \
"SKIP" \
"$QPS615_ETHERNET_SKIP_REASON"
else
ethv_record_result \
"$RESULT_TABLE" \
"QPS615 Ethernet endpoint readiness" \
"PASS" \
"devices=$QPS615_ETHERNET_DEVICE_COUNT declared_ports=$QPS615_ETHERNET_DECLARED_COUNT bound_declared_ports=$QPS615_DECLARED_DRIVER_DEVICE_COUNT declared_port_netdevs=$QPS615_DECLARED_NETDEV_COUNT module_state=$QPS615_MODULE_STATE pci_driver_state=$QPS615_PCI_DRIVER_STATE module_path=${QPS615_MODULE_PATH:-built-in-or-unexposed}"
fi
;;
2)
log_info "QPS615 PCIe switch is not present, preserving generic Ethernet inventory validation"
;;
*)
ethv_record_result \
"$RESULT_TABLE" \
"QPS615 runtime collection" \
"FAIL" \
"runtime topology collection could not complete"
;;
esac

if [ -n "$ETH_INTERFACE" ]; then
ETH_IFACES="$ETH_INTERFACE"
else
ETH_IFACES="$(ethv_get_physical_interfaces)"
fi

if [ -z "$ETH_IFACES" ]; then
ethv_record_result \
"$RESULT_TABLE" \
"Physical Ethernet inventory" \
"SKIP" \
"no physical Ethernet interfaces are currently enumerated"

ethv_print_summary "$RESULT_TABLE" "Ethernet Inventory Summary"
echo "$TESTNAME SKIP" >"$RES_FILE"
exit 0
case "$qps615_status" in
0)
if [ -n "$QPS615_ETHERNET_SKIP_REASON" ]; then
ethv_record_result \
"$RESULT_TABLE" \
"Physical Ethernet inventory" \
"SKIP" \
"no runtime-provisioned Ethernet interface is present"
else
ethv_record_result \
"$RESULT_TABLE" \
"Physical Ethernet inventory" \
"FAIL" \
"QPS615 reported $QPS615_NETDEV_COUNT netdev(s), but physical Ethernet discovery returned none"
fi
;;
2)
ethv_record_result \
"$RESULT_TABLE" \
"Physical Ethernet inventory" \
"SKIP" \
"no physical Ethernet interfaces are currently enumerated"
;;
esac
else
log_info "Detected physical Ethernet interfaces: $(printf '%s' "$ETH_IFACES" | tr '\n' ' ')"
fi

log_info "Detected physical Ethernet interfaces: $(printf '%s' "$ETH_IFACES" | tr '\n' ' ')"

for iface in $ETH_IFACES; do
driver="$(ethv_get_driver "$iface")"
module="$(ethv_get_driver_module "$iface")"
Expand Down Expand Up @@ -242,7 +310,7 @@ log_info "---- Ethernet-related kernel messages ----"
if command -v get_kernel_log >/dev/null 2>&1; then
get_kernel_log 2>/dev/null \
| grep -iE \
'ethqos|stmmac|dwmac|gmac|emac|phylink|mdio|sgmii|hsgmii|2500base|rgmii|qca808|marvell|aquantia|aqr|dp83867|ptp' \
'ethqos|stmmac|dwmac|gmac|emac|tc956|qps615|phylink|mdio|sgmii|hsgmii|2500base|rgmii|qca808|marvell|aquantia|aqr|dp83867|ptp' \
| tail -n 200 \
| while IFS= read -r line; do
[ -n "$line" ] && log_info "[eth-kernel] $line"
Expand Down
6 changes: 4 additions & 2 deletions Runner/suites/Kernel/Baseport/PCIe/PCIe.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
metadata:
name: pcio
format: "Lava-Test Test Definition 1.0"
description: "Test basic PCIe features"
description: "Test basic PCIe features and capability-gated QPS615 topology and firmware readiness, with downstream Ethernet diagnostics"
os:
- linux
scope:
- functional

params:
PCIE_DMESG_STRICT: "0"

run:
steps:
- REPO_PATH=$PWD
- cd Runner/suites/Kernel/Baseport/PCIe
- ./run.sh || true
- $REPO_PATH/Runner/utils/send-to-lava.sh PCIe.res || true

116 changes: 84 additions & 32 deletions Runner/suites/Kernel/Baseport/PCIe/README.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,99 @@
# PCIe Validation Test
© Qualcomm Technologies, Inc. and/or its subsidiaries.
SPDX-License-Identifier: BSD-3-Clause## Overview
Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
SPDX-License-Identifier: BSD-3-Clause

## Overview

This test case validates the PCIe interface on the target device by checking for the presence of key PCIe attributes using the `lspci -vvv` command. It ensures that the PCIe subsystem is correctly enumerated and functional

### The test checks for:

- Presence of **Device Tree Node**
- Availability of **PCIe Capabilities**
- Binding of a **Kernel Driver**
- Per-device negotiated and maximum link speed and width
- MSI/MSI-X runtime IRQ exposure
- Runtime power state
- PCIe controller, link-training, and uncorrected AER kernel errors

Unused PCIe bridge ports may legitimately report zero negotiated width. They
are identified as inactive bridge ports, while a zero-width non-bridge
endpoint remains a failure.

These checks help confirm that the PCIe root port is properly initialized and ready for use

When an enumerated Toshiba `1179:0623` switch identifies QPS615 hardware, the
suite also validates the discovered downstream PCIe topology, TC956x Ethernet
function enumeration, and the image-provided
`TC956X_Firmware_PCIeBridge.bin`. Driver and netdev readiness are logged for
diagnosis but are owned by `Ethernet_Inventory_Validation`, so an Ethernet
driver packaging or binding failure does not incorrectly fail the generic PCIe
contract. Systems without QPS615 continue through the existing generic checks.

The split follows the documented startup sequence. The QPS615 switch power,
I2C initialization, firmware, PCIe link, and bridge enumeration establish the
PCIe capability. The downstream `1179:0220` functions, `tc956x_pci-eth` driver
binding, and exported netdevs establish Ethernet readiness. This keeps a
downstream MAC/PHY problem visible without misclassifying it as a failed PCIe
switch topology.

References:

- [Qualcomm Linux PCIe guide](https://docs.qualcomm.com/doc/80-70023-8/topic/pcie.html#pcie-software-support-feature-for-qps615)
- [Qualcomm Linux Ethernet bring-up guide](https://docs.qualcomm.com/bundle/publicresource/80-70023-26/topics/bring_up-ethernet.md)

## Usage
### Instructions:
1. **Copy the test suite to the target device** using `scp` or any preferred method.
2. **Navigate to the test directory** on the target device.
3. **Run the test script** using the test runner or directly.
---
### Quick Example
```bash
git clone <this-repo>
cd <this-repo>
scp -r common Runner user@target_device_ip:<path-on-device>
ssh user@target_device_ip
cd <path-on-device>/Runner && ./run-test.sh PCIe

Run the suite directly on the target:

```sh
cd Runner/suites/Kernel/Baseport/PCIe
./run.sh
```

It can also be launched through the repository runner:

```sh
cd Runner
./run-test.sh PCIe
```
---
### Prerequisites

## Prerequisites

1. `lspci` must be available on the target device
2. PCIe interface must be exposed and initialized
3. Root access may be required depending on system configuration
---

## Result Format
Test result will be saved in `PCIe.res` as:
## Output
A .res file is generated in the same directory:
`PCIe PASS` OR `PCIe FAIL`
## Sample Log

Check the final result:

```sh
cat PCIe.res
```

The file contains `PCIe PASS`, `PCIe FAIL`, or `PCIe SKIP`.

On QPS615 systems, inspect the retained topology evidence:

```sh
cat qps615_runtime/qps615_switches.log
cat qps615_runtime/qps615_runtime.tsv
find /lib/firmware /usr/lib/firmware \
-name 'TC956X_Firmware_PCIeBridge.bin*' -print 2>/dev/null
```

Generic PCIe runtime and kernel-health evidence is retained in:

```sh
cat pcie_runtime/pcie_runtime.tsv
cat pcie_runtime/dmesg_errors.log
```

Kernel-log findings are advisory by default because the boot log can contain
history from unused ports or previously detached endpoints. To make matching
PCIe controller, link, or uncorrected AER errors fail the suite:

```sh
PCIE_DMESG_STRICT=1 ./run.sh
```
[INFO] 1980-01-06 00:43:54 - -----------------------------------------------------------------------------------------
[INFO] 1980-01-06 00:43:54 - -------------------Starting PCIe Testcase----------------------------
[INFO] 1980-01-06 00:43:54 - === Test Initialization ===
[INFO] 1980-01-06 00:43:54 - Checking if required tools are available
[INFO] 1980-01-06 00:43:54 - Running PCIe
[INFO] 1980-01-06 00:43:54 - DT node is present
[INFO] 1980-01-06 00:43:54 - Yes, 'Capabilities:' is found
[INFO] 1980-01-06 00:43:54 - Driver is loaded
[PASS] 1980-01-06 00:43:54 - PCIe : Test Passed
```
Loading
Loading