diff --git a/README.md b/README.md index ab02f83d..736984fb 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/dsa/README.md b/dsa/README.md new file mode 100644 index 00000000..5e112bdb --- /dev/null +++ b/dsa/README.md @@ -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. +``` diff --git a/dsa/dsa_user.sh b/dsa/dsa_user.sh new file mode 100755 index 00000000..dd9ae848 --- /dev/null +++ b/dsa/dsa_user.sh @@ -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 diff --git a/dsa/tests b/dsa/tests new file mode 100755 index 00000000..8c5191e4 --- /dev/null +++ b/dsa/tests @@ -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