Skip to content

Commit 2115e04

Browse files
Added CTI, TGU, and Node Access test suites for QDSS
- CTI-Enable-Disable: tests for enabling/disabling Cross Trigger Interface - CTI-Test: functional validation of CTI trigger channels - Node-Access: verifies QDSS debug node accessibility via sysfs - TGU-Enable-Disable: tests for Trigger Generation Unit enable/disable flow Signed-off-by: Rohan Dutta <rohadutt@qti.qualcomm.com>
1 parent 89e3067 commit 2115e04

12 files changed

Lines changed: 824 additions & 0 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
metadata:
2+
name: CTI-Enable-Disable
3+
description: "Verifies that all Coresight CTI devices can be successfully enabled and disabled via sysfs."
4+
5+
os:
6+
- linux
7+
devices:
8+
- qcm6490
9+
- qcs9100
10+
scope:
11+
- coresight
12+
- kernel
13+
timeout: 60
14+
15+
run:
16+
steps:
17+
- REPO_PATH=$PWD
18+
- cd Runner/suites/Kernel/DEBUG/CTI-Enable-Disable
19+
- ./run.sh || true
20+
- $REPO_PATH/Runner/utils/send-to-lava.sh CTI-Enable-Disable.res || true
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Coresight CTI Enable/Disable Test
2+
3+
## Overview
4+
This test validates the basic toggle functionality of the Coresight Cross Trigger Interface (CTI) drivers. It ensures that every CTI device exposed in sysfs can be turned on and off without errors.
5+
6+
## Execution Logic
7+
1. **Preparation**:
8+
* Disables `stm0`, `tmc_etr0`, and `tmc_etf0` to ensure a clean state.
9+
* Enables `tmc_etf0` (Embedded Trace FIFO) as a sink, as some CTI configurations may require an active sink.
10+
2. **Discovery**: Scans `/sys/bus/coresight/devices/` for any directory containing `cti`.
11+
3. **Iteration**: For each CTI device:
12+
* **Enable**: Writes `1` to the `enable` file.
13+
* **Verify**: Reads the `enable` file; expects `1`.
14+
* **Disable**: Writes `0` to the `enable` file.
15+
* **Verify**: Reads the `enable` file; expects `0`.
16+
4. **Cleanup**: Resets all devices to disabled state.
17+
18+
## Output
19+
* Logs for every device toggle attempt.
20+
* `CTI-Enable-Disable.res` containing the final Pass/Fail status.
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
#!/bin/sh
2+
3+
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
4+
# SPDX-License-Identifier: BSD-3-Clause
5+
6+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
7+
INIT_ENV=""
8+
SEARCH="$SCRIPT_DIR"
9+
while [ "$SEARCH" != "/" ]; do
10+
if [ -f "$SEARCH/init_env" ]; then
11+
INIT_ENV="$SEARCH/init_env"
12+
break
13+
fi
14+
SEARCH=$(dirname "$SEARCH")
15+
done
16+
17+
if [ -z "$INIT_ENV" ]; then
18+
echo "[ERROR] Could not find init_env" >&2
19+
exit 1
20+
fi
21+
22+
if [ -z "$__INIT_ENV_LOADED" ]; then
23+
# shellcheck disable=SC1090
24+
. "$INIT_ENV"
25+
fi
26+
27+
# shellcheck disable=SC1090,SC1091
28+
. "$TOOLS/functestlib.sh"
29+
30+
TESTNAME="CTI-Enable-Disable"
31+
if command -v find_test_case_by_name >/dev/null 2>&1; then
32+
test_path=$(find_test_case_by_name "$TESTNAME")
33+
cd "$test_path" || exit 1
34+
else
35+
cd "$SCRIPT_DIR" || exit 1
36+
fi
37+
38+
res_file="./$TESTNAME.res"
39+
rm -f "$res_file"
40+
touch "$res_file"
41+
42+
log_info "-----------------------------------------------------------------------------------------"
43+
log_info "-------------------Starting $TESTNAME Testcase----------------------------"
44+
45+
CS_BASE="/sys/bus/coresight/devices"
46+
FAIL_COUNT=0
47+
48+
49+
reset_devices() {
50+
log_info "Resetting Coresight devices..."
51+
if [ -f "$CS_BASE/tmc_etf0/enable_sink" ]; then
52+
echo 0 > "$CS_BASE/tmc_etf0/enable_sink" 2>/dev/null
53+
fi
54+
if [ -f "$CS_BASE/tmc_etr0/enable_sink" ]; then
55+
echo 0 > "$CS_BASE/tmc_etr0/enable_sink" 2>/dev/null
56+
fi
57+
if [ -f "$CS_BASE/stm0/enable_source" ]; then
58+
echo 0 > "$CS_BASE/stm0/enable_source" 2>/dev/null
59+
fi
60+
}
61+
62+
63+
if [ ! -d "$CS_BASE" ]; then
64+
log_fail "Coresight directory not found: $CS_BASE"
65+
echo "Coresight directory not found" >> "$res_file"
66+
exit 1
67+
fi
68+
69+
reset_devices
70+
71+
if [ -f "$CS_BASE/tmc_etf0/enable_sink" ]; then
72+
echo 1 > "$CS_BASE/tmc_etf0/enable_sink"
73+
else
74+
log_warn "tmc_etf0 not found, proceeding without it..."
75+
fi
76+
77+
CTI_LIST=""
78+
for _dev in "$CS_BASE"/cti*; do
79+
[ -e "$_dev" ] || continue
80+
CTI_LIST="$CTI_LIST $(basename "$_dev")"
81+
done
82+
CTI_LIST="${CTI_LIST# }"
83+
84+
if [ -z "$CTI_LIST" ]; then
85+
log_fail "No CTI devices found."
86+
FAIL_COUNT=$((FAIL_COUNT + 1))
87+
else
88+
for cti in $CTI_LIST; do
89+
dev_path="$CS_BASE/$cti"
90+
91+
if [ ! -f "$dev_path/enable" ]; then
92+
log_warn "Skipping $cti: 'enable' node not found"
93+
continue
94+
fi
95+
96+
log_info "Testing Device: $cti"
97+
98+
if ! echo 1 > "$dev_path/enable"; then
99+
log_fail "$cti: Failed to write 1 to enable"
100+
FAIL_COUNT=$((FAIL_COUNT + 1))
101+
continue
102+
fi
103+
104+
res=$(cat "$dev_path/enable")
105+
if [ "$res" -eq 1 ]; then
106+
log_pass "$cti Enabled Successfully"
107+
else
108+
log_fail "$cti Failed to Enable (Value: $res)"
109+
FAIL_COUNT=$((FAIL_COUNT + 1))
110+
fi
111+
112+
if ! echo 0 > "$dev_path/enable"; then
113+
log_fail "$cti: Failed to write 0 to enable"
114+
FAIL_COUNT=$((FAIL_COUNT + 1))
115+
continue
116+
fi
117+
118+
res=$(cat "$dev_path/enable")
119+
if [ "$res" -eq 0 ]; then
120+
log_pass "$cti Disabled Successfully"
121+
else
122+
log_fail "$cti Failed to Disable (Value: $res)"
123+
FAIL_COUNT=$((FAIL_COUNT + 1))
124+
fi
125+
done
126+
fi
127+
128+
reset_devices
129+
130+
if [ "$FAIL_COUNT" -eq 0 ]; then
131+
log_pass "CTI Enable/Disable Test Completed Successfully"
132+
echo "$TESTNAME PASS" >> "$res_file"
133+
else
134+
log_fail "CTI Enable/Disable Test Failed ($FAIL_COUNT errors)"
135+
echo "$TESTNAME FAIL" >> "$res_file"
136+
fi
137+
138+
# log_info "-------------------$TESTNAME Testcase Finished----------------------------"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
metadata:
2+
name: CTI-Trigger-Map
3+
description: "Validates Coresight Cross Trigger Interface (CTI) by mapping and unmapping triggers to channels."
4+
5+
os:
6+
- linux
7+
devices:
8+
- qcm6490
9+
- qcs9100
10+
scope:
11+
- coresight
12+
- kernel
13+
timeout: 120
14+
15+
run:
16+
steps:
17+
- REPO_PATH=$PWD
18+
- cd Runner/suites/Kernel/DEBUG/CTI-Test
19+
- ./run.sh || true
20+
- $REPO_PATH/Runner/utils/send-to-lava.sh CTI-Test.res || true
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# CTI Test
2+
3+
## Overview
4+
This test verifies the functionality of the Coresight CTI (Cross Trigger Interface) driver. It ensures that hardware triggers can be successfully mapped (attached) to CTI channels and subsequently unmapped (detached).
5+
6+
## Execution Logic
7+
1. **Sleep Disable**: Temporarily prevents the device from entering low-power modes (`/sys/module/lpm_levels/parameters/sleep_disabled`) to ensure CTI registers are accessible.
8+
2. **Discovery**: Finds all CTI devices in `/sys/bus/coresight/devices/`.
9+
3. **Mode Detection**: Checks for the existence of `enable` sysfs node to determine if the driver uses the Modern or Legacy sysfs interface.
10+
4. **Configuration Parsing**: Reads the `devid` (Modern) or `show_info` (Legacy) to calculate the maximum number of triggers and channels supported by the hardware.
11+
5. **Test Loop**:
12+
* Iterates through a subset of triggers (randomized within valid range).
13+
* Iterates through valid channels.
14+
* **Attach**: writes `channel trigger` to `trigin_attach` / `trigout_attach`.
15+
* **Verify**: Reads back via `chan_xtrigs_sel` and `chan_xtrigs_in`/`out` to confirm mapping.
16+
* **Detach**: Unmaps the trigger and confirms the entry is cleared.
17+
6. **Cleanup**: Restores the original LPM sleep setting.
18+
19+
## Output
20+
* Logs identifying which CTI device, trigger, and channel are being tested.
21+
* `CTI-Trigger-Map.res` containing the final Pass/Fail status.

0 commit comments

Comments
 (0)