-
Notifications
You must be signed in to change notification settings - Fork 31
Added CTI, TGU, and Node Access DEBUG Suites #307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| metadata: | ||
| name: CTI-Enable-Disable | ||
| description: "Verifies that all Coresight CTI devices can be successfully enabled and disabled via sysfs." | ||
|
|
||
| os: | ||
| - linux | ||
| devices: | ||
| - qcm6490 | ||
| - qcs9100 | ||
| scope: | ||
| - coresight | ||
| - kernel | ||
| timeout: 60 | ||
|
|
||
| run: | ||
| steps: | ||
| - REPO_PATH=$PWD | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Append || true |
||
| - cd Runner/suites/Kernel/DEBUG/CTI-Enable-Disable | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Append || true |
||
| - ./run.sh || true | ||
| - $REPO_PATH/Runner/utils/send-to-lava.sh CTI-Enable-Disable.res || true | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # Coresight CTI Enable/Disable Test | ||
|
|
||
| ## Overview | ||
| 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. | ||
|
|
||
| ## Execution Logic | ||
| 1. **Preparation**: | ||
| * Disables `stm0`, `tmc_etr0`, and `tmc_etf0` to ensure a clean state. | ||
| * Enables `tmc_etf0` (Embedded Trace FIFO) as a sink, as some CTI configurations may require an active sink. | ||
| 2. **Discovery**: Scans `/sys/bus/coresight/devices/` for any directory containing `cti`. | ||
| 3. **Iteration**: For each CTI device: | ||
| * **Enable**: Writes `1` to the `enable` file. | ||
| * **Verify**: Reads the `enable` file; expects `1`. | ||
| * **Disable**: Writes `0` to the `enable` file. | ||
| * **Verify**: Reads the `enable` file; expects `0`. | ||
| 4. **Cleanup**: Resets all devices to disabled state. | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please add the sample output while executing the run.sh and steps to run the file. please see other README for the same |
||
| ## Output | ||
| * Logs for every device toggle attempt. | ||
| * `CTI-Enable-Disable.res` containing the final Pass/Fail status. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| #!/bin/sh | ||
|
|
||
| # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" | ||
| INIT_ENV="" | ||
| SEARCH="$SCRIPT_DIR" | ||
| while [ "$SEARCH" != "/" ]; do | ||
| if [ -f "$SEARCH/init_env" ]; then | ||
| INIT_ENV="$SEARCH/init_env" | ||
| break | ||
| fi | ||
| SEARCH=$(dirname "$SEARCH") | ||
| done | ||
|
|
||
| if [ -z "$INIT_ENV" ]; then | ||
| echo "[ERROR] Could not find init_env" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ -z "$__INIT_ENV_LOADED" ]; then | ||
| # shellcheck disable=SC1090 | ||
| . "$INIT_ENV" | ||
| fi | ||
|
|
||
| # shellcheck disable=SC1090,SC1091 | ||
| . "$TOOLS/functestlib.sh" | ||
|
|
||
| TESTNAME="CTI-Enable-Disable" | ||
| if command -v find_test_case_by_name >/dev/null 2>&1; then | ||
| test_path=$(find_test_case_by_name "$TESTNAME") | ||
| cd "$test_path" || exit 1 | ||
| else | ||
| cd "$SCRIPT_DIR" || exit 1 | ||
| fi | ||
|
|
||
| res_file="./$TESTNAME.res" | ||
| rm -f "$res_file" | ||
| touch "$res_file" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this really required? |
||
|
|
||
| log_info "-----------------------------------------------------------------------------------------" | ||
| log_info "-------------------Starting $TESTNAME Testcase----------------------------" | ||
|
|
||
| CS_BASE="/sys/bus/coresight/devices" | ||
| FAIL_COUNT=0 | ||
|
|
||
|
|
||
| reset_devices() { | ||
| log_info "Resetting Coresight devices..." | ||
| if [ -f "$CS_BASE/tmc_etf0/enable_sink" ]; then | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what if any or all of the paths are not present? Can you handle that aswell? |
||
| echo 0 > "$CS_BASE/tmc_etf0/enable_sink" 2>/dev/null | ||
| fi | ||
| if [ -f "$CS_BASE/tmc_etr0/enable_sink" ]; then | ||
| echo 0 > "$CS_BASE/tmc_etr0/enable_sink" 2>/dev/null | ||
| fi | ||
| if [ -f "$CS_BASE/stm0/enable_source" ]; then | ||
| echo 0 > "$CS_BASE/stm0/enable_source" 2>/dev/null | ||
| fi | ||
| } | ||
|
|
||
|
|
||
| if [ ! -d "$CS_BASE" ]; then | ||
| log_fail "Coresight directory not found: $CS_BASE" | ||
| echo "Coresight directory not found" >> "$res_file" | ||
| exit 1 | ||
| fi | ||
|
|
||
| reset_devices | ||
|
|
||
| if [ -f "$CS_BASE/tmc_etf0/enable_sink" ]; then | ||
| echo 1 > "$CS_BASE/tmc_etf0/enable_sink" | ||
| else | ||
| log_warn "tmc_etf0 not found, proceeding without it..." | ||
| fi | ||
|
|
||
| CTI_LIST="" | ||
| for _dev in "$CS_BASE"/cti*; do | ||
| [ -e "$_dev" ] || continue | ||
| CTI_LIST="$CTI_LIST $(basename "$_dev")" | ||
| done | ||
| CTI_LIST="${CTI_LIST# }" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is this required? |
||
|
|
||
| if [ -z "$CTI_LIST" ]; then | ||
| log_fail "No CTI devices found." | ||
| FAIL_COUNT=$((FAIL_COUNT + 1)) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we exit and mark fail if there are no CTI devices? |
||
| else | ||
| for cti in $CTI_LIST; do | ||
| dev_path="$CS_BASE/$cti" | ||
|
|
||
| if [ ! -f "$dev_path/enable" ]; then | ||
| log_warn "Skipping $cti: 'enable' node not found" | ||
| continue | ||
| fi | ||
|
|
||
| log_info "Testing Device: $cti" | ||
|
|
||
| if ! echo 1 > "$dev_path/enable"; then | ||
| log_fail "$cti: Failed to write 1 to enable" | ||
| FAIL_COUNT=$((FAIL_COUNT + 1)) | ||
| continue | ||
| fi | ||
|
|
||
| res=$(cat "$dev_path/enable") | ||
| if [ "$res" -eq 1 ]; then | ||
| log_pass "$cti Enabled Successfully" | ||
| else | ||
| log_fail "$cti Failed to Enable (Value: $res)" | ||
| FAIL_COUNT=$((FAIL_COUNT + 1)) | ||
| fi | ||
|
|
||
| if ! echo 0 > "$dev_path/enable"; then | ||
| log_fail "$cti: Failed to write 0 to enable" | ||
| FAIL_COUNT=$((FAIL_COUNT + 1)) | ||
| continue | ||
| fi | ||
|
|
||
| res=$(cat "$dev_path/enable") | ||
| if [ "$res" -eq 0 ]; then | ||
| log_pass "$cti Disabled Successfully" | ||
| else | ||
| log_fail "$cti Failed to Disable (Value: $res)" | ||
| FAIL_COUNT=$((FAIL_COUNT + 1)) | ||
| fi | ||
| done | ||
| fi | ||
|
|
||
| reset_devices | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is wrong, you will have to reset to state to the values before reset_devices is called |
||
|
|
||
| if [ "$FAIL_COUNT" -eq 0 ]; then | ||
| log_pass "CTI Enable/Disable Test Completed Successfully" | ||
| echo "$TESTNAME PASS" >> "$res_file" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please give > instead of >> |
||
| else | ||
| log_fail "CTI Enable/Disable Test Failed ($FAIL_COUNT errors)" | ||
| echo "$TESTNAME FAIL" >> "$res_file" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please give > instead of >> |
||
| fi | ||
|
|
||
| # log_info "-------------------$TESTNAME Testcase Finished----------------------------" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| metadata: | ||
| name: CTI-Trigger-Map | ||
| description: "Validates Coresight Cross Trigger Interface (CTI) by mapping and unmapping triggers to channels." | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Below are needed aswell |
||
|
|
||
| os: | ||
| - linux | ||
| devices: | ||
| - qcm6490 | ||
| - qcs9100 | ||
| scope: | ||
| - coresight | ||
| - kernel | ||
| timeout: 120 | ||
|
|
||
| run: | ||
| steps: | ||
| - REPO_PATH=$PWD | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Append || true |
||
| - cd Runner/suites/Kernel/DEBUG/CTI-Test | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Append || true |
||
| - ./run.sh || true | ||
| - $REPO_PATH/Runner/utils/send-to-lava.sh CTI-Test.res || true | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # CTI Test | ||
|
|
||
| ## Overview | ||
| 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). | ||
|
|
||
| ## Execution Logic | ||
| 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. | ||
| 2. **Discovery**: Finds all CTI devices in `/sys/bus/coresight/devices/`. | ||
| 3. **Mode Detection**: Checks for the existence of `enable` sysfs node to determine if the driver uses the Modern or Legacy sysfs interface. | ||
| 4. **Configuration Parsing**: Reads the `devid` (Modern) or `show_info` (Legacy) to calculate the maximum number of triggers and channels supported by the hardware. | ||
| 5. **Test Loop**: | ||
| * Iterates through a subset of triggers (randomized within valid range). | ||
| * Iterates through valid channels. | ||
| * **Attach**: writes `channel trigger` to `trigin_attach` / `trigout_attach`. | ||
| * **Verify**: Reads back via `chan_xtrigs_sel` and `chan_xtrigs_in`/`out` to confirm mapping. | ||
| * **Detach**: Unmaps the trigger and confirms the entry is cleared. | ||
| 6. **Cleanup**: Restores the original LPM sleep setting. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please add the sample output while executing the run.sh and steps to run the file. please see other README for the same |
||
|
|
||
| ## Output | ||
| * Logs identifying which CTI device, trigger, and channel are being tested. | ||
| * `CTI-Trigger-Map.res` containing the final Pass/Fail status. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Below are needed aswell
name: <>
format: "Lava-Test Test Definition 1.0"
description: <>
maintainer: