Skip to content

Commit 184f700

Browse files
committed
Modified iommu testcase and readme
This test validates the IOMMU (Input-Output Memory Management Unit) support by checking IOMMU configs and checks if the corresponding drivers are loaded instead of just checking the dmesg logs. Signed-off-by: Vamsee Narapareddi <[email protected]>
1 parent 77383a1 commit 184f700

File tree

2 files changed

+80
-4
lines changed

2 files changed

+80
-4
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# IOMMU Validation Test
2+
3+
This test validates the IOMMU (Input-Output Memory Management Unit) support and runtime status on Qualcomm platforms with Yocto builds.
4+
5+
## Overview
6+
7+
The test script performs these functional checks:
8+
9+
1. **Kernel Configuration**:
10+
- Validates presence of `CONFIG_IOMMU_SUPPORT` and `CONFIG_ARM_SMMU*` entries in `/proc/config.gz`.
11+
12+
2. **Driver Loading**:
13+
- Confirms SMMU/IOMMU-related drivers are loaded via `/proc/modules`.
14+
15+
3. **Device Tree Nodes**:
16+
- Verifies IOMMU/SMMU-related nodes in `/proc/device-tree`.
17+
18+
4. **Runtime Verification**:
19+
- Checks `dmesg` for any runtime IOMMU initialization or fault logs.
20+
21+
## How to Run
22+
23+
```sh
24+
source init_env
25+
cd suites/Kernel/FunctionalArea/IOMMU_Validation
26+
./run.sh
27+
```
28+
29+
## Prerequisites
30+
31+
- `dmesg`, `grep`, `zgrep`, `lsmod` must be available
32+
- Root access may be required for complete validation
33+
34+
## Result Format
35+
36+
Test result will be saved in `IOMMU.res` as:
37+
- `IOMMU PASS` – if all validations pass
38+
- `IOMMU FAIL` – if any check fails
39+
40+
## License
41+
42+
SPDX-License-Identifier: BSD-3-Clause-Clear
43+
(C) Qualcomm Technologies, Inc. and/or its subsidiaries.

Runner/suites/Kernel/FunctionalArea/baseport/iommu/run.sh

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,48 @@ log_info "----------------------------------------------------------------------
3939
log_info "-------------------Starting $TESTNAME Testcase----------------------------"
4040
log_info "=== Test Initialization ==="
4141

42-
# Run the command and capture the output
43-
OUTPUT=$(dmesg | grep iommu)
42+
check_runtime_behavior() {
43+
if dmesg | grep -i -q "msm_iommu.*enabled"; then
44+
log_info "Runtime logs show Qualcomm MSM IOMMU is active"
45+
elif dmesg | grep -i -q "iommu.*enabled"; then
46+
log_info "Runtime logs show IOMMU is active"
47+
else
48+
log_fail "No runtime indication of IOMMU being active"
49+
return 1
50+
fi
51+
return 0
52+
}
53+
54+
pass=true
55+
56+
CONFIGS="CONFIG_IOMMU_SUPPORT CONFIG_QCOM_IOMMU CONFIG_ARM_SMMU"
57+
check_kernel_config "$CONFIGS" || {
58+
log_fail "Kernel config validation failed."
59+
echo "$TESTNAME FAIL" > "$res_file"
60+
exit 1
61+
}
62+
LOADED_MODULES="msm_iommu arm_smmu"
63+
check_driver_loaded "$LOADED_MODULES" || {
64+
log_fail "Failed to load required driver modules"
65+
echo "$TESTNAME FAIL" > "$res_file"
66+
exit 1
67+
}
68+
69+
DT_NODES="/proc/device-tree/soc@0/iommu@15000000 /proc/device-tree/soc/iommu@15000000"
70+
check_dt_nodes "$DT_NODES" || {
71+
log_fail "Device tree validation failed."
72+
echo "$TESTNAME FAIL" > "$res_file"
73+
exit 1
74+
}
75+
76+
check_runtime_behavior || pass=false
4477

45-
# Check if the output is null
46-
if [ -z "$OUTPUT" ]; then
78+
if $pass; then
4779
log_pass "$TESTNAME : Test Passed"
4880
echo "$TESTNAME PASS" > "$res_file"
4981
else
5082
log_fail "$TESTNAME : Test Failed"
5183
echo "$TESTNAME FAIL" > "$res_file"
5284
fi
85+
5386
log_info "-------------------Completed $TESTNAME Testcase----------------------------"

0 commit comments

Comments
 (0)