Skip to content
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

Add dsa1.0 test cases #192

Merged
merged 2 commits into from
Feb 29, 2024
Merged
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ More details please refer to following.
* [ufs](ufs/README.md)
* [workload-xsave](workload-xsave/README.md)
* [AMX](state-components-validation-utilities/amx/README.md)
* [DSA](dsa/README.md)

# Compile from sources
## Compile the whole project (NOT recommended)
Expand Down
37 changes: 37 additions & 0 deletions dsa/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# DSA(Data Streaming Accelerator) Test Cases

## Description
```
Intel DSA is a high-performance data copy and transformation accelerator that
will be integrated in SPR, targeted for optimizing streaming data movement and
transformation operations common with applications for high-performance storage,
networking, persistent memory, and various data processing applications. IAA is
a similar accelerator which is more focused on data encryption and decryption.
DSA and IAA share the same Linux Kernel driver “IDXD”
```

## Usage
```
IDXD is the DSA driver name and enabled after kernel 5.19, it is better to do tests
newer than that.

./dsa_user.sh -t check_dsa_driver
IDXD driver is for both dsa and iaa, check if the driver is loaded.
./dsa_user.sh -t check_dsa0_device
After the driver is loaded, devices are enabled under /sys/bus/dsa/devices.
./dsa_user.sh -t check_shared_mode
If SVM(Shared Virtual Memory) is supported, the pasid_enabled is 1. If it is 0,
the shared mode is not confgurable.
```

## Expected result
```
All test results should show pass, no fail.
```

## accel-config
```
accel-config - configure and control DSA(data streaminng accelerator) subsystem
devices. The git repo is https://github.com/intel/idxd-config.git.
accel-config -h and accel-config --list-cmds introduce how to use the tool.
```
85 changes: 85 additions & 0 deletions dsa/dsa_user.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (c) 2023 Intel Corporation
# Description: Test script for Data Streaming Accelerator(DSA)

cd "$(dirname "$0")" 2>/dev/null && source ../.env

: "${CASE_NAME:="check_dsa_driver"}"

usage() {
cat <<__EOF
usage: ./${0##*/} [-t TESTCASE_ID] [-H]
-t TEST CASE ID
-H show this
__EOF
}

# Check if idxd driver is loaded
# Return: 0 for true, otherwise false
check_dsa_driver() {
if lsmod | grep -q "idxd"; then
test_print_trc "dsa: idxd driver is loaded [PASS]"
else
die "dsa: idxd driver is not loaded [FAIL]"
fi
}

# Check if there is dsa device dsa0
check_dsa0_device() {
if [ -d "/sys/bus/dsa/devices/dsa0" ]; then
test_print_trc "dsa: there is dsa0 device [PASS]"
else
die "dsa: no dsa0 device [FAIL]"
fi
}

# check if pasid is supported
check_shared_mode() {
[ ! -f "/sys/bus/dsa/devices/dsa0/pasid_enabled" ] && echo "No SVM support" && exit 1
pasid_en=$(cat /sys/bus/dsa/devices/dsa0/pasid_enabled)
if [ "$pasid_en" -eq 1 ]; then
test_print_trc "dsa: shared mode is enabled [PASS]"
else
die "dsa: shared mode is not enabled [FAIL]"
fi
}

dsa_test() {
case $TEST_SCENARIO in
check_dsa_driver)
check_dsa_driver
;;
check_dsa0_device)
check_dsa0_device
;;
check_shared_mode)
check_shared_mode
;;
*)
block_test "Invalid NAME:$NAME for test number."
;;
esac
return 0
}

while getopts :t:H arg; do
case $arg in
t)
TEST_SCENARIO=$OPTARG
;;
H)
usage && exit 0
;;
\?)
usage
die "Invalid Option -$OPTARG"
;;
:)
usage
die "Option -$OPTARG requires an argument."
;;
esac
done

dsa_test
7 changes: 7 additions & 0 deletions dsa/tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file collects the DSA feature tests on
# Intel® Architecture-based platforms.

# DSA basic tests, it works on SPR(Sapphire Rapids) platform and future server
dsa_user.sh -t check_dsa_driver
dsa_user.sh -t check_dsa0_device
dsa_user.sh -t check_shared_mode
Loading