From 0e803b1be7d57ded4f3d9d5e204e1f5763d58d48 Mon Sep 17 00:00:00 2001 From: Xudong Hao Date: Mon, 5 Aug 2024 10:07:36 +0800 Subject: [PATCH] Add 24 TDX test cases and 24 No-TD test cases Various vcpus and memory configure to boot VM Signed-off-by: Xudong Hao --- BM/README.md | 1 - BM/amx/Makefile | 25 - BM/amx/tests | 69 --- BM/cet/tests | 0 BM/common/common.sh | 30 - BM/common/general_test.sh | 10 +- BM/cstate/powermgr_cstate_tests.sh | 218 +------ BM/cstate/tests-client | 0 BM/cstate/tests-server | 12 +- BM/dsa/tests | 0 BM/guest-test/qemu.config.json | 2 +- BM/ifs/ifs_common.sh | 2 +- BM/ifs/test_ifs.sh | 499 --------------- BM/ifs/tests | 3 - BM/isst/intel_sst.sh | 83 --- BM/isst/tests | 10 +- BM/pcie/README.md | 16 - BM/pcie/pcie_check.sh | 343 ---------- BM/pcie/tests | 8 - BM/pstate/intel_pstate_tests.sh | 13 - BM/pstate/tests | 0 BM/rapl/tests-client | 0 BM/rapl/tests-server | 0 BM/runtests | 44 +- BM/runtests.py | 76 +-- BM/sdsi/sdsi_fms_list | 0 BM/sdsi/tests | 0 BM/splitlock/tests | 0 BM/tdx-compliance/README.md | 29 +- BM/tdx-compliance/tdx-compliance-cpuid.h | 18 +- BM/tdx-compliance/tdx-compliance-msr.h | 2 +- BM/tdx-compliance/tdx-compliance.c | 146 +---- BM/tdx-compliance/tdx-compliance.h | 4 - BM/tdx-compliance/testallcase.sh | 0 BM/tdx-compliance/tests-trigger-cpuid.sh | 10 - BM/tdx-osv-sanity/2.1.1.4-tests | 0 BM/thermal/tests | 0 BM/tools/pcie/pcie_check.c | 5 +- BM/topology/cpu_topology.sh | 10 - BM/tpm/.gitignore | 2 - BM/tpm/README.md | 61 -- BM/tpm/test_async.sh | 13 - BM/tpm/test_smoke.sh | 12 - BM/tpm/test_space.sh | 12 - BM/tpm/tests | 9 - BM/tpm/tpm2.py | 755 ----------------------- BM/tpm/tpm2_tests.py | 339 ---------- BM/tpmi/tests | 0 BM/tpmi/tpmi_fms_list | 0 BM/ufs/tests | 0 BM/ufs/ufs_fms_list | 0 BM/umip/tests | 0 KVM/qemu/boot_check.cfg | 46 ++ KVM/qemu/tests/boot_check.py | 36 ++ scenario/emr-oa/tests-amx | 72 +-- scenario/emr-oa/tests-cstate | 0 scenario/emr-oa/tests-ifs | 3 - scenario/emr-oe/tests-amx | 72 +-- scenario/emr-oe/tests-cstate | 0 scenario/emr-oe/tests-dsa1 | 40 ++ scenario/emr-oe/tests-iax | 28 +- scenario/emr-oe/tests-ifs | 3 - scenario/emr-oe/tests-pstate | 0 scenario/emr-oe/tests-rapl | 0 scenario/emr-oe/tests-topology | 12 +- scenario/gnr-oe/tests-amx | 69 --- scenario/gnr-oe/tests-cstate | 0 scenario/gnr-oe/tests-ifs | 3 - scenario/gnr-oe/tests-isst | 0 scenario/gnr-oe/tests-pstate | 0 scenario/gnr-oe/tests-rapl | 0 scenario/gnr-oe/tests-sdsi | 0 scenario/gnr-oe/tests-topology | 0 scenario/gnr-oe/tests-tpmi | 0 scenario/gnr-oe/tests-ufs | 0 75 files changed, 313 insertions(+), 2962 deletions(-) delete mode 100644 BM/amx/Makefile delete mode 100644 BM/amx/tests mode change 100644 => 100755 BM/cet/tests mode change 100644 => 100755 BM/cstate/tests-client mode change 100644 => 100755 BM/cstate/tests-server mode change 100644 => 100755 BM/dsa/tests delete mode 100755 BM/ifs/test_ifs.sh mode change 100644 => 100755 BM/isst/tests delete mode 100644 BM/pcie/README.md delete mode 100644 BM/pcie/pcie_check.sh delete mode 100644 BM/pcie/tests mode change 100644 => 100755 BM/pstate/tests mode change 100644 => 100755 BM/rapl/tests-client mode change 100644 => 100755 BM/rapl/tests-server mode change 100644 => 100755 BM/sdsi/sdsi_fms_list mode change 100644 => 100755 BM/sdsi/tests mode change 100644 => 100755 BM/splitlock/tests mode change 100755 => 100644 BM/tdx-compliance/testallcase.sh delete mode 100755 BM/tdx-compliance/tests-trigger-cpuid.sh mode change 100644 => 100755 BM/tdx-osv-sanity/2.1.1.4-tests mode change 100644 => 100755 BM/thermal/tests delete mode 100644 BM/tpm/.gitignore delete mode 100644 BM/tpm/README.md delete mode 100755 BM/tpm/test_async.sh delete mode 100755 BM/tpm/test_smoke.sh delete mode 100755 BM/tpm/test_space.sh delete mode 100644 BM/tpm/tests delete mode 100755 BM/tpm/tpm2.py delete mode 100755 BM/tpm/tpm2_tests.py mode change 100644 => 100755 BM/tpmi/tests mode change 100644 => 100755 BM/tpmi/tpmi_fms_list mode change 100644 => 100755 BM/ufs/tests mode change 100644 => 100755 BM/ufs/ufs_fms_list mode change 100644 => 100755 BM/umip/tests create mode 100644 KVM/qemu/boot_check.cfg create mode 100644 KVM/qemu/tests/boot_check.py mode change 100644 => 100755 scenario/emr-oa/tests-cstate mode change 100644 => 100755 scenario/emr-oa/tests-ifs mode change 100644 => 100755 scenario/emr-oe/tests-cstate mode change 100644 => 100755 scenario/emr-oe/tests-ifs mode change 100644 => 100755 scenario/emr-oe/tests-pstate mode change 100644 => 100755 scenario/emr-oe/tests-rapl mode change 100644 => 120000 scenario/emr-oe/tests-topology delete mode 100644 scenario/gnr-oe/tests-amx mode change 100644 => 100755 scenario/gnr-oe/tests-cstate mode change 100644 => 100755 scenario/gnr-oe/tests-ifs mode change 100644 => 100755 scenario/gnr-oe/tests-isst mode change 100644 => 100755 scenario/gnr-oe/tests-pstate mode change 100644 => 100755 scenario/gnr-oe/tests-rapl mode change 100644 => 100755 scenario/gnr-oe/tests-sdsi mode change 100644 => 100755 scenario/gnr-oe/tests-topology mode change 100644 => 100755 scenario/gnr-oe/tests-tpmi mode change 100644 => 100755 scenario/gnr-oe/tests-ufs diff --git a/BM/README.md b/BM/README.md index 6f1e2d4a..45246368 100644 --- a/BM/README.md +++ b/BM/README.md @@ -23,7 +23,6 @@ * [tdx-guest](tdx-guest/README.md) * [tdx-osv-sanity](tdx-osv-sanity/README.md) (TODO) * [telemetry](telemetry/README.md) - * [tpm](tpm/README.md) * [Intel_TH(Trace Hub)](th/README.md) * [thermal](thermal/README.md) * [topology](topology/README.md) diff --git a/BM/amx/Makefile b/BM/amx/Makefile deleted file mode 100644 index 0fb72d68..00000000 --- a/BM/amx/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -# Copyright (c) 2022 Intel Corporation. - -SUBDIRS = $(shell ls -d */) - -PROXY := - -all: - @for dir in $(SUBDIRS); do \ - if [ -f "$$dir/Makefile" ]; then \ - cd $$dir && \ - make || { \ - cd ..; \ - continue; \ - }; \ - cd ..; \ - fi \ - done - -clean: - @for dir in $(SUBDIRS); do \ - if [ -f "$$dir/Makefile" ]; then \ - make -C $$dir clean || continue; \ - fi \ - done diff --git a/BM/amx/tests b/BM/amx/tests deleted file mode 100644 index 07c03f34..00000000 --- a/BM/amx/tests +++ /dev/null @@ -1,69 +0,0 @@ -# This file collects the AMX(Advanced Matrix eXtension) related instruction tests on -# Intel® Architecture-based platforms. -# @hw_dep: cpuid_check 7 0 0 0 d 24 @ CPU doesn't support AMX-TILE - CPUID.(7.0).EDX[24] -# @hw_dep: cpuid_check 7 0 0 0 d 25 @ CPU doesn't support AMX-INT8 - CPUID.(7.0).EDX[25] -# @hw_dep: cpuid_check 7 0 0 0 d 22 @ CPU doesn't support AMX-BF16 - CPUID.(7.0).EDX[22] -# @hw_dep: cpuid_check 7 0 1 0 a 21 @ CPU doesn't support AMX-FP16 - CPUID.(7.1).EAX[21] -# @hw_dep: cpuid_check d 0 1 0 a 4 @ CPU doesn't support AMX XFD - CPUID.(d.1).EAX[4] -# @other_warn: echo 'int main() { asm volatile("tdpfp16ps %tmm2, %tmm1, %tmm0"); return 0; }' | gcc -x c -o /dev/null - \ -# @ gcc no support AMX_FP16 ins., refer to README for compile option, amx_fp16 related tests can't be executed - -# Usage:./tmul [OPTIONS] -# -b, --break-reason [1 - 5] -# 0: break by nothing -# 1: break by yield -# 2: break by sleep -# 3: break by trap -# 4: break by signal -# 5: break by futex -# -t, --thread-count [Should not be less than 1] -# -c, --cycle-number [Should not be less than 1] -# -i, --instruction-type [0:TDPBF16PS 1:TDPBSSD 2:TDPBSUD 3:TDPBUSD 4:TDPBUUD 5:TDPFP16PS] - -# functional tests -tmul -b 0 -t 10 -c 10 -i 0 -tmul -b 1 -t 10 -c 10 -i 0 -tmul -b 2 -t 10 -c 10 -i 0 -tmul -b 3 -t 10 -c 10 -i 0 -tmul -b 4 -t 10 -c 100000 -i 0 -tmul -b 5 -t 10 -c 10 -i 0 -tmul -b 0 -t 10 -c 10 -i 1 -tmul -b 1 -t 10 -c 10 -i 1 -tmul -b 2 -t 10 -c 10 -i 1 -tmul -b 3 -t 10 -c 10 -i 1 -tmul -b 4 -t 10 -c 100000 -i 1 -tmul -b 5 -t 10 -c 10 -i 1 -tmul -b 0 -t 10 -c 10 -i 2 -tmul -b 1 -t 10 -c 10 -i 2 -tmul -b 2 -t 10 -c 10 -i 2 -tmul -b 3 -t 10 -c 10 -i 2 -tmul -b 4 -t 10 -c 100000 -i 2 -tmul -b 5 -t 10 -c 10 -i 2 -tmul -b 0 -t 10 -c 10 -i 3 -tmul -b 1 -t 10 -c 10 -i 3 -tmul -b 2 -t 10 -c 10 -i 3 -tmul -b 3 -t 10 -c 10 -i 3 -tmul -b 4 -t 10 -c 100000 -i 3 -tmul -b 5 -t 10 -c 10 -i 3 -tmul -b 0 -t 10 -c 10 -i 4 -tmul -b 1 -t 10 -c 10 -i 4 -tmul -b 2 -t 10 -c 10 -i 4 -tmul -b 3 -t 10 -c 10 -i 4 -tmul -b 4 -t 10 -c 100000 -i 4 -tmul -b 5 -t 10 -c 10 -i 4 -# amx_fp16 instruction based tests -tmul -b 0 -t 10 -c 10 -i 5 -tmul -b 1 -t 10 -c 10 -i 5 -tmul -b 2 -t 10 -c 10 -i 5 -tmul -b 3 -t 10 -c 10 -i 5 -tmul -b 4 -t 10 -c 100000 -i 5 -tmul -b 5 -t 10 -c 10 -i 5 - -# stress tests -tmul -b 1 -t 10000 -c 10 -i 0 -tmul -b 1 -t 10000 -c 10 -i 1 -tmul -b 1 -t 10000 -c 10 -i 2 -tmul -b 1 -t 10000 -c 10 -i 3 -tmul -b 1 -t 10000 -c 10 -i 4 -# amx_fp16 instruction based tests -tmul -b 1 -t 10000 -c 10 -i 5 \ No newline at end of file diff --git a/BM/cet/tests b/BM/cet/tests old mode 100644 new mode 100755 diff --git a/BM/common/common.sh b/BM/common/common.sh index f8c67c7f..9ed14485 100755 --- a/BM/common/common.sh +++ b/BM/common/common.sh @@ -158,14 +158,6 @@ block_test() { exit 2 } -skip_test() { - caller_info="${BASH_SOURCE[1]##*/}:${BASH_LINENO[0]}:${FUNCNAME[1]}()" - test_print_wrg "skip_test() is called by $caller_info" - test_print_wrg "SKIPPING TEST: $*" - exec_teardown - exit 0 -} - # Wrapper function to mark a test as not applicable, # it accepts a string to explain why the test is not # applicable. exec_teardown is called before exiting with 32. @@ -661,25 +653,3 @@ check_turbostat_ver() { 2024 version from the latest upstream kernel source located at: tools/power/x86/turbostat" fi } - -# Check module existence. If not, try to load module -# Arguments: $1 module name -# Output: 0 for module exists or loaded succss; 1 for module loaded failure -check_module() { - local module_name=$1 - - module_exist=$(lsmod | grep -w "$module_name") - if [[ -n "$module_exist" ]]; then - test_print_trc "Module $module_name is already loaded" - else - modprobe $module_name - if [ $? -eq 0 ]; then - test_print_trc "Module $module_name is loaded" - else - block_test "Module $module_name cannot be loaded" - return 1 - fi - fi - - return 0 -} diff --git a/BM/common/general_test.sh b/BM/common/general_test.sh index 19516fb2..f922dd01 100755 --- a/BM/common/general_test.sh +++ b/BM/common/general_test.sh @@ -11,12 +11,9 @@ cd "$(dirname "$0")" 2>/dev/null && source ../.env usage() { cat <<__EOF usage: ./${0##*/} [-t TEST_TYPE][-k KCONFIG or keywrod][-p parm][-h] - -t Test type, i.e., kconfig | fms | dmesg | turbostat | module + -t Test type like KCONFIG, FMS -k KCONFIG name like CONFIG_XXX or keyword - -p PARM for test - option for dmesg check - fms list file for fms check - module name for module check + -p PARM like y, null -h show This __EOF } @@ -42,9 +39,6 @@ general_test() { turbostat) check_turbostat_ver ;; - module) - check_module "$PARM" - ;; *) die "Invalid TYPE:$TYPE" ;; diff --git a/BM/cstate/powermgr_cstate_tests.sh b/BM/cstate/powermgr_cstate_tests.sh index 68fb2427..c3d35b62 100755 --- a/BM/cstate/powermgr_cstate_tests.sh +++ b/BM/cstate/powermgr_cstate_tests.sh @@ -42,63 +42,6 @@ else block_test "msr-tools is required to run CSTATE cases." fi -# stress tool is required to run cstate cases -if which stress 1>/dev/null 2>&1; then - stress --help 1>/dev/null || block_test "Failed to run stress tool, -please check stress tool error message." -else - block_test "stress tool is required to run cstate cases, -please get it from latest upstream kernel-tools." -fi - -# This function is used to kill stress process if it is still running. -# We do this to release cpu resource. -do_kill_pid() { - [[ $# -ne 1 ]] && die "You must supply 1 parameter" - local upid="$1" - upid=$(ps -e | awk '{if($1~/'"$upid"'/) print $1}') - [[ -n "$upid" ]] && do_cmd "kill -9 $upid" -} - -# Function to check tuned.service is enabled or disabled -# This may impact the cpu frequency when a workload is running -check_tuned_service() { - # Check the status of tuned.service using systemctl - if systemctl is-enabled --quiet tuned.service; then - test_print_trc "tuned.service is enabled, which may change the performance profile and impact the CPU frequency,\ -please consider disabling it with the command: 'sudo systemctl disable tuned.service', then reboot the system." - else - test_print_trc "tuned.service is disabled, so it will not impact the CPU frequency." - fi -} - -# Function to check if there is any package and core power limitation being asserted -# When CPU Frequency is lower than the expected value. -power_limit_check() { - pkg_power_limitation_log=$(rdmsr -p 1 0x1b1 -f 11:11 2>/dev/null) - test_print_trc "The power limitation log from package thermal status 0x1b1 bit 11 is: \ -$pkg_power_limitation_log" - - core_power_limitation_log=$(rdmsr -p 1 0x19c -f 11:11 2>/dev/null) - test_print_trc "The power limitation log from IA32 thermal status 0x19c bit 11 is: \ -$core_power_limitation_log" - - hwp_cap_value=$(rdmsr -a 0x771) - test_print_trc "MSR HWP Capabilities shows: $hwp_cap_value" - - hwp_req_value=$(rdmsr -a 0x774) - test_print_trc "MSR HWP Request shows: $hwp_req_value" - - core_perf_limit_reason=$(rdmsr -a 0x64f 2>/dev/null) - test_print_trc "The core perf limit reasons msr 0x64f value is: $core_perf_limit_reason" - - if [ "${pkg_power_limitation_log}" == "1" ] && [ "${core_power_limitation_log}" == "1" ]; then - return 0 - else - return 1 - fi -} - # Function to verify if Intel_idle driver refer to BIOS _CST table test_cstate_table_name() { local cstate_name="" @@ -391,12 +334,12 @@ perf_client_cstate_list() { test_print_trc "turbostat tool output: $tc_out" tc_out_cstate_list=$(echo "$tc_out" | grep -E "^POLL") - perf_cstates=$(perf list | grep cstate | grep "Kernel PMU event") + perf_cstates=$(perf list | grep cstate) [[ -n "$perf_cstates" ]] || block_test "Did not get cstate events by perf list" test_print_trc "perf list shows cstate events: $perf_cstates" - perf_core_cstate_num=$(perf list | grep "Kernel PMU event" | grep -c cstate_core) + perf_core_cstate_num=$(perf list | grep -c cstate_core) for ((i = 1; i <= perf_core_cstate_num; i++)); do - perf_core_cstate=$(perf list | grep "Kernel PMU event" | grep cstate_core | sed -n "$i, 1p") + perf_core_cstate=$(perf list | grep cstate_core | sed -n "$i, 1p") if [[ $perf_core_cstate =~ c1 ]] && [[ $tc_out_cstate_list =~ CPU%c1 ]]; then test_print_trc "$perf_core_cstate is supported and aligned with turbostat" elif [[ $perf_core_cstate =~ c6 ]] && [[ $tc_out_cstate_list =~ CPU%c6 ]]; then @@ -408,9 +351,9 @@ perf_client_cstate_list() { fi done - perf_pkg_cstate_num=$(perf list | grep "Kernel PMU event" | grep -c cstate_pkg) + perf_pkg_cstate_num=$(perf list | grep -c cstate_pkg) for ((i = 1; i <= perf_pkg_cstate_num; i++)); do - perf_pkg_cstate=$(perf list | grep "Kernel PMU event" | grep cstate_pkg | sed -n "$i, 1p") + perf_pkg_cstate=$(perf list | grep cstate_pkg | sed -n "$i, 1p") if [[ $perf_pkg_cstate =~ c2 ]] && [[ $tc_out_cstate_list =~ Pkg%pc2 ]]; then test_print_trc "$perf_pkg_cstate is supported and aligned with turbostat" elif [[ $perf_pkg_cstate =~ c3 ]] && [[ $tc_out_cstate_list =~ Pkg%pc3 ]]; then @@ -455,12 +398,12 @@ perf_server_cstate_list() { test_print_trc "turbostat tool output: $tc_out" tc_out_cstate_list=$(echo "$tc_out" | grep -E "^POLL") - perf_cstates=$(perf list | grep cstate | grep "Kernel PMU event") + perf_cstates=$(perf list | grep cstate) [[ -n "$perf_cstates" ]] || block_test "Did not get cstate events by perf list" test_print_trc "perf list shows cstate events: $perf_cstates" - perf_core_cstate_num=$(perf list | grep "Kernel PMU event" | grep -c cstate_core) + perf_core_cstate_num=$(perf list | grep -c cstate_core) for ((i = 1; i <= perf_core_cstate_num; i++)); do - perf_core_cstate=$(perf list | grep "Kernel PMU event" | grep cstate_core | sed -n "$i, 1p") + perf_core_cstate=$(perf list | grep cstate_core | sed -n "$i, 1p") if [[ $perf_core_cstate =~ c1 ]] && [[ $tc_out_cstate_list =~ CPU%c1 ]]; then test_print_trc "$perf_core_cstate is supported and aligned with turbostat" elif [[ $perf_core_cstate =~ c6 ]] && [[ $tc_out_cstate_list =~ CPU%c6 ]]; then @@ -470,9 +413,9 @@ perf_server_cstate_list() { fi done - perf_pkg_cstate_num=$(perf list | grep "Kernel PMU event" | grep -c cstate_pkg) + perf_pkg_cstate_num=$(perf list | grep -c cstate_pkg) for ((i = 1; i <= perf_pkg_cstate_num; i++)); do - perf_pkg_cstate=$(perf list | grep "Kernel PMU event" | grep cstate_pkg | sed -n "$i, 1p") + perf_pkg_cstate=$(perf list | grep cstate_pkg | sed -n "$i, 1p") if [[ $perf_pkg_cstate =~ c2 ]] && [[ $tc_out_cstate_list =~ Pkg%pc2 ]]; then test_print_trc "$perf_pkg_cstate is supported and aligned with turbostat" elif [[ $perf_pkg_cstate =~ c6 ]] && [[ $tc_out_cstate_list =~ Pkg%pc6 ]]; then @@ -487,8 +430,8 @@ perf_server_cstate_list() { perf_server_cstat_update() { local cstate_name=$1 - perf_cstates=$(perf list | grep "Kernel PMU event" | grep "$cstate_name" 2>&1) - perf_cstates_num=$(perf list | grep "Kernel PMU event" | grep -c "$cstate_name" 2>&1) + perf_cstates=$(perf list | grep "$cstate_name" 2>&1) + perf_cstates_num=$(perf list | grep -c "$cstate_name" 2>&1) [[ -n $perf_cstates ]] || block_test "Did not get $cstate_name event by perf list" # Sleep 20 seconds to capture the cstate counter update @@ -754,131 +697,6 @@ ccstate_res_offline_online() { fi } -# Function to check one CPU turbo freqency when other CPUs are in active idle state -verify_single_cpu_freq() { - local stress_pid="" - local cpu_stat="" - local max_freq="" - local current_freq="" - local delta=0 - local turbo_on="" - local cpu_no_turbo_mode="/sys/devices/system/cpu/intel_pstate/no_turbo" - - # Get the CPUs num and the deepest idle cstate number - cpus_num=$(lscpu | grep "On-line CPU(s) list" | awk '{print $NF}' | awk -F "-" '{print $2}') - states=($(grep . /sys/devices/system/cpu/cpu0/cpuidle/state*/name | awk -F "/" '{print $(NF-1)}')) - - length=${#states[@]} - - turbo_on=$(cat "$cpu_no_turbo_mode") - - test_print_trc "Executing stress -c 1 -t 90 & in background" - taskset -c 1 stress -c 1 -t 90 & - stress_pid=$! - - cpu_stat_debug=$(turbostat -i 1 sleep 1 2>&1) - test_print_trc "Turbostat debug output is:" - test_print_trc "$cpu_stat_debug" - cpu_stat=$(turbostat -q -i 1 sleep 1 2>&1) - test_print_trc "Turbostat output is:" - test_print_trc "$cpu_stat" - - if [[ "$turbo_on" -eq 0 ]]; then - max_freq=$(echo "$cpu_stat_debug" | - grep "MHz max turbo" | tail -n 1 | awk '{print $5}') - test_print_trc "Max_freq_turbo_On: $max_freq" - else - max_freq=$(echo "$cpu_stat_debug" | - grep "base frequency" | - awk '{print $5}') - test_print_trc "Max_freq_turbo_off: $max_freq" - fi - - current_freq=$(echo "$cpu_stat" | - awk '{for(k=0;++k<=NF;)a[k]=a[k]?a[k] FS $k:$k} END{for(k=0;k++ grep . /sys/devices/system/cpu/cpu$j/cpuidle/state$i/disable" - done - done - - if [[ $(echo "$delta > 100" | bc) -eq 1 ]]; then - if power_limit_check; then - test_print_trc "The package and core power limitation is asserted." - test_print_trc "$current_freq is lower than $max_freq with power limitation assert" - else - test_print_trc "The package and core power limitation is NOT assert." - check_tuned_service - die "$current_freq is lower than $max_freq without power limitation assert" - fi - else - test_print_trc "checking single cpu freq when other CPUs are in idle: PASS" - fi -} - -# Function to verify the turbo frequency of a single CPU -# when all CPUs are in P0, L1, C1, or C1E states -turbo_freq_when_idle() { - local cpu_num="" - local idle_state=$1 - - # Get the CPUs num and the deepest idle cstate number - cpus_num=$(lscpu | grep "On-line CPU(s) list" | awk '{print $NF}' | awk -F "-" '{print $2}') - states=($(grep . /sys/devices/system/cpu/cpu0/cpuidle/state*/name | awk -F "/" '{print $(NF-1)}')) - - length=${#states[@]} - test_print_trc "The deepest core cstate num is: $length" - - # Enable the idle state for all the CPUs - # If test idle state is POLL/C1/C1E, then disable all the other deeper idle cstate - if [[ "$idle_state" == POLL ]]; then - for ((i = 1; i < length; i++)); do - for ((j = 0; j < cpus_num; j++)); do - do_cmd "echo 1 > grep . /sys/devices/system/cpu/cpu$j/cpuidle/state$i/disable" - done - done - elif [[ "$idle_state" == C1 ]]; then - for ((i = 2; i < length; i++)); do - for ((j = 0; j < cpus_num; j++)); do - do_cmd "echo 1 > grep . /sys/devices/system/cpu/cpu$j/cpuidle/state$i/disable" - done - done - elif [[ "$idle_state" == C1E ]]; then - if grep -q 'C1E' /sys/devices/system/cpu/cpu0/cpuidle/state*/name; then - for ((i = 3; i < length; i++)); do - for ((j = 0; j < cpus_num; j++)); do - do_cmd "echo 1 > grep . /sys/devices/system/cpu/cpu$j/cpuidle/state$i/disable" - done - done - else - block_test "The C1E state is not present" - fi - fi - - # Run a 100% stress workload exclusively on CPU0 and verify the turbo frequency - # If the turbo frequency does not meet the expected value - # Then determine whether a thermal limitation has been reached - verify_single_cpu_freq -} - # Function to do CPU offline and online short stress cpu_off_on_stress() { local cycle=$1 @@ -990,18 +808,6 @@ core_cstate_test() { verify_ccstate_res_offline_online) ccstate_res_offline_online 0x10 0x660 0x3fd ;; - verify_turbo_freq_in_default) - verify_single_cpu_freq - ;; - verify_turbo_freq_in_poll) - turbo_freq_when_idle POLL - ;; - verify_turbo_freq_in_c1) - turbo_freq_when_idle C1 - ;; - verify_turbo_freq_in_c1e) - turbo_freq_when_idle C1E - ;; verify_cpu_offline_online_stress) cpu_off_on_stress 5 ;; diff --git a/BM/cstate/tests-client b/BM/cstate/tests-client old mode 100644 new mode 100755 diff --git a/BM/cstate/tests-server b/BM/cstate/tests-server old mode 100644 new mode 100755 index 44fe8817..29341319 --- a/BM/cstate/tests-server +++ b/BM/cstate/tests-server @@ -4,13 +4,12 @@ # @other_dep: # @other_warn: which turbostat 2>/dev/null @ turbostat tool is required # @other_warn: which perf 2>/dev/null @ perf tool is required, please install perf.x86_64 package -# @other_warn: which rdmsr 2>/dev/null @ rdmsr tool is required, please install msr-tools -# @other_warn: which stress 2>/dev/null @ stress tool is required, please install stress.x86_64 or stress-ng.x86_64 powermgr_cstate_tests.sh -t verify_cstate_name powermgr_cstate_tests.sh -t verify_server_all_cores_cstate6 powermgr_cstate_tests.sh -t verify_server_all_cpus_mc6 powermgr_cstate_tests.sh -t verify_server_core_cstate6_residency +powermgr_cstate_tests.sh -t verify_residency_latency_override powermgr_cstate_tests.sh -t verify_server_cstate_list powermgr_cstate_tests.sh -t verify_server_perf_core_cstat_update powermgr_cstate_tests.sh -t verify_server_perf_pkg_cstat_update @@ -18,15 +17,6 @@ powermgr_cstate_tests.sh -t verify_server_perf_module_cstat_update powermgr_cstate_tests.sh -t verify_server_pc2_entry powermgr_cstate_tests.sh -t verify_server_pc6_entry powermgr_cstate_tests.sh -t verify_server_pc6_residency -# Below case is to verify the PC6 entry or not after CPUs offline powermgr_cstate_tests.sh -t verify_offline_cpu_deepest_pc -# Below case is to verify the CC1 and CC6 residency after CPUs offline and online powermgr_cstate_tests.sh -t verify_ccstate_res_offline_online -# Below case are to verify whether a single CPU can reach the turbo frequecy -# When other CPUs are all in POLL or C1 or C1E -powermgr_cstate_tests.sh -t verify_turbo_freq_in_default -powermgr_cstate_tests.sh -t verify_turbo_freq_in_poll -powermgr_cstate_tests.sh -t verify_turbo_freq_in_c1 -powermgr_cstate_tests.sh -t verify_turbo_freq_in_c1e -# Below case is verify the CPUs offline and online stress powermgr_cstate_tests.sh -t verify_cpu_offline_online_stress diff --git a/BM/dsa/tests b/BM/dsa/tests old mode 100644 new mode 100755 diff --git a/BM/guest-test/qemu.config.json b/BM/guest-test/qemu.config.json index d0f5c818..e022229a 100644 --- a/BM/guest-test/qemu.config.json +++ b/BM/guest-test/qemu.config.json @@ -12,7 +12,7 @@ "vm": { "cfg_1": "-accel kvm -no-reboot -nographic -vga none -device virtio-net-pci,netdev=mynet0,mac=DE:AD:BE:EF:AB:CD,romfile= ", "cfg_2": "-chardev stdio,id=mux,mux=on,signal=off -device virtio-serial,romfile= -device virtconsole,chardev=mux ", - "cfg_3": "-serial chardev:mux -monitor chardev:mux -monitor pty -machine q35,hpet=off -nodefaults ", + "cfg_3": "-serial chardev:mux -monitor chardev:mux -monitor pty -no-hpet -nodefaults ", "cfg_var_1": "-name process=$VM_TYPEVM_$PORT,debug-threads=on ", "cfg_var_2": "-cpu host,host-phys-bits,pmu=$PMU ", "cfg_var_3": "-smp cpus=$VCPU,sockets=$SOCKETS ", diff --git a/BM/ifs/ifs_common.sh b/BM/ifs/ifs_common.sh index 88214a98..c22d8204 100755 --- a/BM/ifs/ifs_common.sh +++ b/BM/ifs/ifs_common.sh @@ -876,7 +876,7 @@ ifs_array_cpu_fullload_scan() { local cpu="" for cpu in $cpus; do - cpu_full_load "$cpu" & + cpu_full_load "$cpu" # Wait the cpu load 100% sleep 1 echo "$cpu" > "$IFS_PATH"/"$RUN_TEST" diff --git a/BM/ifs/test_ifs.sh b/BM/ifs/test_ifs.sh deleted file mode 100755 index f9374c82..00000000 --- a/BM/ifs/test_ifs.sh +++ /dev/null @@ -1,499 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 -# -# Test the functionality of the Intel IFS(In Field Scan) driver. -# -# It's from Linux Kernel v6.11-rc1 kself-tests: -# tools/testing/selftests/drivers/platform/x86/intel/ifs/test_ifs.sh -# -# Original Author: Pengfei Xu -# - -# Matched with kselftest framework: tools/testing/selftests/kselftest.h -readonly KSFT_PASS=0 -readonly KSFT_FAIL=1 -readonly KSFT_XFAIL=2 -readonly KSFT_SKIP=4 - -readonly CPU_SYSFS="/sys/devices/system/cpu" -readonly CPU_OFFLINE_SYSFS="${CPU_SYSFS}/offline" -readonly IMG_PATH="/lib/firmware/intel/ifs_0" -readonly IFS_SCAN_MODE="0" -readonly IFS_ARRAY_BIST_SCAN_MODE="1" -readonly IFS_PATH="/sys/devices/virtual/misc/intel_ifs" -readonly IFS_SCAN_SYSFS_PATH="${IFS_PATH}_${IFS_SCAN_MODE}" -readonly IFS_ARRAY_BIST_SYSFS_PATH="${IFS_PATH}_${IFS_ARRAY_BIST_SCAN_MODE}" -readonly RUN_TEST="run_test" -readonly STATUS="status" -readonly DETAILS="details" -readonly STATUS_PASS="pass" -readonly PASS="PASS" -readonly FAIL="FAIL" -readonly INFO="INFO" -readonly XFAIL="XFAIL" -readonly SKIP="SKIP" -readonly IFS_NAME="intel_ifs" -readonly ALL="all" -readonly SIBLINGS="siblings" - -# Matches arch/x86/include/asm/intel-family.h and -# drivers/platform/x86/intel/ifs/core.c requirement as follows -readonly SAPPHIRERAPIDS_X="8f" -readonly EMERALDRAPIDS_X="cf" - -readonly INTEL_FAM6="06" - -LOOP_TIMES=3 -FML="" -MODEL="" -STEPPING="" -CPU_FMS="" -TRUE="true" -FALSE="false" -RESULT=$KSFT_PASS -IMAGE_NAME="" -INTERVAL_TIME=1 -OFFLINE_CPUS="" -# For IFS cleanup tags -ORIGIN_IFS_LOADED="" -IFS_IMAGE_NEED_RESTORE=$FALSE -IFS_LOG="/tmp/ifs_logs.$$" -RANDOM_CPU="" -DEFAULT_IMG_ID="" - -append_log() -{ - echo -e "$1" | tee -a "$IFS_LOG" -} - -online_offline_cpu_list() -{ - local on_off=$1 - local target_cpus=$2 - local cpu="" - local cpu_start="" - local cpu_end="" - local i="" - - if [[ -n "$target_cpus" ]]; then - for cpu in $(echo "$target_cpus" | tr ',' ' '); do - if [[ "$cpu" == *"-"* ]]; then - cpu_start="" - cpu_end="" - i="" - cpu_start=$(echo "$cpu" | cut -d "-" -f 1) - cpu_end=$(echo "$cpu" | cut -d "-" -f 2) - for((i=cpu_start;i<=cpu_end;i++)); do - append_log "[$INFO] echo $on_off > \ -${CPU_SYSFS}/cpu${i}/online" - echo "$on_off" > "$CPU_SYSFS"/cpu"$i"/online - done - else - set_target_cpu "$on_off" "$cpu" - fi - done - fi -} - -ifs_scan_result_summary() -{ - local failed_info pass_num skip_num fail_num - - if [[ -e "$IFS_LOG" ]]; then - failed_info=$(grep ^"\[${FAIL}\]" "$IFS_LOG") - fail_num=$(grep -c ^"\[${FAIL}\]" "$IFS_LOG") - skip_num=$(grep -c ^"\[${SKIP}\]" "$IFS_LOG") - pass_num=$(grep -c ^"\[${PASS}\]" "$IFS_LOG") - - if [[ "$fail_num" -ne 0 ]]; then - RESULT=$KSFT_FAIL - echo "[$INFO] IFS test failure summary:" - echo "$failed_info" - elif [[ "$skip_num" -ne 0 ]]; then - RESULT=$KSFT_SKIP - fi - echo "[$INFO] IFS test pass:$pass_num, skip:$skip_num, fail:$fail_num" - else - echo "[$INFO] No file $IFS_LOG for IFS scan summary" - fi -} - -ifs_cleanup() -{ - echo "[$INFO] Restore environment after IFS test" - - # Restore ifs origin image if origin image backup step is needed - [[ "$IFS_IMAGE_NEED_RESTORE" == "$TRUE" ]] && { - mv -f "$IMG_PATH"/"$IMAGE_NAME"_origin "$IMG_PATH"/"$IMAGE_NAME" - } - - # Restore the CPUs to the state before testing - [[ -z "$OFFLINE_CPUS" ]] || online_offline_cpu_list "0" "$OFFLINE_CPUS" - - lsmod | grep -q "$IFS_NAME" && [[ "$ORIGIN_IFS_LOADED" == "$FALSE" ]] && { - echo "[$INFO] modprobe -r $IFS_NAME" - modprobe -r "$IFS_NAME" - } - - ifs_scan_result_summary - [[ -e "$IFS_LOG" ]] && rm -rf "$IFS_LOG" - - echo "[RESULT] IFS test exit with $RESULT" - exit "$RESULT" -} - -do_cmd() -{ - local cmd=$* - local ret="" - - append_log "[$INFO] $cmd" - eval "$cmd" - ret=$? - if [[ $ret -ne 0 ]]; then - append_log "[$FAIL] $cmd failed. Return code is $ret" - RESULT=$KSFT_XFAIL - ifs_cleanup - fi -} - -test_exit() -{ - local info=$1 - RESULT=$2 - - declare -A EXIT_MAP - EXIT_MAP[$KSFT_PASS]=$PASS - EXIT_MAP[$KSFT_FAIL]=$FAIL - EXIT_MAP[$KSFT_XFAIL]=$XFAIL - EXIT_MAP[$KSFT_SKIP]=$SKIP - - append_log "[${EXIT_MAP[$RESULT]}] $info" - ifs_cleanup -} - -online_all_cpus() -{ - local off_cpus="" - - OFFLINE_CPUS=$(cat "$CPU_OFFLINE_SYSFS") - online_offline_cpu_list "1" "$OFFLINE_CPUS" - - off_cpus=$(cat "$CPU_OFFLINE_SYSFS") - if [[ -z "$off_cpus" ]]; then - append_log "[$INFO] All CPUs are online." - else - append_log "[$XFAIL] There is offline cpu:$off_cpus after online all cpu!" - RESULT=$KSFT_XFAIL - ifs_cleanup - fi -} - -get_cpu_fms() -{ - FML=$(grep -m 1 "family" /proc/cpuinfo | awk -F ":" '{printf "%02x",$2;}') - MODEL=$(grep -m 1 "model" /proc/cpuinfo | awk -F ":" '{printf "%02x",$2;}') - STEPPING=$(grep -m 1 "stepping" /proc/cpuinfo | awk -F ":" '{printf "%02x",$2;}') - CPU_FMS="${FML}-${MODEL}-${STEPPING}" -} - -check_cpu_ifs_support_interval_time() -{ - get_cpu_fms - - if [[ "$FML" != "$INTEL_FAM6" ]]; then - test_exit "CPU family:$FML does not support IFS" "$KSFT_SKIP" - fi - - # Ucode has time interval requirement for IFS scan on same CPU as follows: - case $MODEL in - "$SAPPHIRERAPIDS_X") - INTERVAL_TIME=180; - ;; - "$EMERALDRAPIDS_X") - INTERVAL_TIME=30; - ;; - *) - # Set default interval time for other platforms - INTERVAL_TIME=1; - append_log "[$INFO] CPU FML:$FML model:0x$MODEL, default: 1s interval time" - ;; - esac -} - -check_ifs_loaded() -{ - local ifs_info="" - - ifs_info=$(lsmod | grep "$IFS_NAME") - if [[ -z "$ifs_info" ]]; then - append_log "[$INFO] modprobe $IFS_NAME" - modprobe "$IFS_NAME" || { - test_exit "Check if CONFIG_INTEL_IFS is set to m or \ -platform doesn't support ifs" "$KSFT_SKIP" - } - ifs_info=$(lsmod | grep "$IFS_NAME") - [[ -n "$ifs_info" ]] || test_exit "No ifs module listed by lsmod" "$KSFT_FAIL" - fi -} - -test_ifs_scan_entry() -{ - local ifs_info="" - - ifs_info=$(lsmod | grep "$IFS_NAME") - - if [[ -z "$ifs_info" ]]; then - ORIGIN_IFS_LOADED="$FALSE" - check_ifs_loaded - else - ORIGIN_IFS_LOADED="$TRUE" - append_log "[$INFO] Module $IFS_NAME is already loaded" - fi - - if [[ -d "$IFS_SCAN_SYSFS_PATH" ]]; then - append_log "[$PASS] IFS sysfs $IFS_SCAN_SYSFS_PATH entry is created\n" - else - test_exit "No sysfs entry in $IFS_SCAN_SYSFS_PATH" "$KSFT_FAIL" - fi -} - -load_image() -{ - local image_id=$1 - local image_info="" - local ret="" - - check_ifs_loaded - if [[ -e "${IMG_PATH}/${IMAGE_NAME}" ]]; then - append_log "[$INFO] echo 0x$image_id > ${IFS_SCAN_SYSFS_PATH}/current_batch" - echo "0x$image_id" > "$IFS_SCAN_SYSFS_PATH"/current_batch 2>/dev/null - ret=$? - [[ "$ret" -eq 0 ]] || { - append_log "[$FAIL] Load ifs image $image_id failed with ret:$ret\n" - return "$ret" - } - image_info=$(cat ${IFS_SCAN_SYSFS_PATH}/current_batch) - if [[ "$image_info" == 0x"$image_id" ]]; then - append_log "[$PASS] load IFS current_batch:$image_info" - else - append_log "[$FAIL] current_batch:$image_info is not expected:$image_id" - return "$KSFT_FAIL" - fi - else - append_log "[$FAIL] No IFS image file ${IMG_PATH}/${IMAGE_NAME}"\ - return "$KSFT_FAIL" - fi - return 0 -} - -test_load_origin_ifs_image() -{ - local image_id=$1 - - IMAGE_NAME="${CPU_FMS}-${image_id}.scan" - - load_image "$image_id" || return $? - return 0 -} - -test_load_bad_ifs_image() -{ - local image_id=$1 - - IMAGE_NAME="${CPU_FMS}-${image_id}.scan" - - do_cmd "mv -f ${IMG_PATH}/${IMAGE_NAME} ${IMG_PATH}/${IMAGE_NAME}_origin" - - # Set IFS_IMAGE_NEED_RESTORE to true before corrupt the origin ifs image file - IFS_IMAGE_NEED_RESTORE=$TRUE - do_cmd "dd if=/dev/urandom of=${IMG_PATH}/${IMAGE_NAME} bs=1K count=6 2>/dev/null" - - # Use the specified judgment for negative testing - append_log "[$INFO] echo 0x$image_id > ${IFS_SCAN_SYSFS_PATH}/current_batch" - echo "0x$image_id" > "$IFS_SCAN_SYSFS_PATH"/current_batch 2>/dev/null - ret=$? - if [[ "$ret" -ne 0 ]]; then - append_log "[$PASS] Load invalid ifs image failed with ret:$ret not 0 as expected" - else - append_log "[$FAIL] Load invalid ifs image ret:$ret unexpectedly" - fi - - do_cmd "mv -f ${IMG_PATH}/${IMAGE_NAME}_origin ${IMG_PATH}/${IMAGE_NAME}" - IFS_IMAGE_NEED_RESTORE=$FALSE -} - -test_bad_and_origin_ifs_image() -{ - local image_id=$1 - - append_log "[$INFO] Test loading bad and then loading original IFS image:" - test_load_origin_ifs_image "$image_id" || return $? - test_load_bad_ifs_image "$image_id" - # Load origin image again and make sure it's worked - test_load_origin_ifs_image "$image_id" || return $? - append_log "[$INFO] Loading invalid IFS image and then loading initial image passed.\n" -} - -ifs_test_cpu() -{ - local ifs_mode=$1 - local cpu_num=$2 - local image_id status details ret result result_info - - echo "$cpu_num" > "$IFS_PATH"_"$ifs_mode"/"$RUN_TEST" - ret=$? - - status=$(cat "${IFS_PATH}_${ifs_mode}/${STATUS}") - details=$(cat "${IFS_PATH}_${ifs_mode}/${DETAILS}") - - if [[ "$ret" -eq 0 && "$status" == "$STATUS_PASS" ]]; then - result="$PASS" - else - result="$FAIL" - fi - - cpu_num=$(cat "${CPU_SYSFS}/cpu${cpu_num}/topology/thread_siblings_list") - - # There is no image file for IFS ARRAY BIST scan - if [[ -e "${IFS_PATH}_${ifs_mode}/current_batch" ]]; then - image_id=$(cat "${IFS_PATH}_${ifs_mode}/current_batch") - result_info=$(printf "[%s] ifs_%1d cpu(s):%s, current_batch:0x%02x, \ -ret:%2d, status:%s, details:0x%016x" \ - "$result" "$ifs_mode" "$cpu_num" "$image_id" "$ret" \ - "$status" "$details") - else - result_info=$(printf "[%s] ifs_%1d cpu(s):%s, ret:%2d, status:%s, details:0x%016x" \ - "$result" "$ifs_mode" "$cpu_num" "$ret" "$status" "$details") - fi - - append_log "$result_info" -} - -ifs_test_cpus() -{ - local cpus_type=$1 - local ifs_mode=$2 - local image_id=$3 - local cpu_max_num="" - local cpu_num="" - - case "$cpus_type" in - "$ALL") - cpu_max_num=$(($(nproc) - 1)) - cpus=$(seq 0 $cpu_max_num) - ;; - "$SIBLINGS") - cpus=$(cat ${CPU_SYSFS}/cpu*/topology/thread_siblings_list \ - | sed -e 's/,.*//' \ - | sed -e 's/-.*//' \ - | sort -n \ - | uniq) - ;; - *) - test_exit "Invalid cpus_type:$cpus_type" "$KSFT_XFAIL" - ;; - esac - - for cpu_num in $cpus; do - ifs_test_cpu "$ifs_mode" "$cpu_num" - done - - if [[ -z "$image_id" ]]; then - append_log "[$INFO] ifs_$ifs_mode test $cpus_type cpus completed\n" - else - append_log "[$INFO] ifs_$ifs_mode $cpus_type cpus with $CPU_FMS-$image_id.scan \ -completed\n" - fi -} - -test_ifs_same_cpu_loop() -{ - local ifs_mode=$1 - local cpu_num=$2 - local loop_times=$3 - - append_log "[$INFO] Test ifs mode $ifs_mode on CPU:$cpu_num for $loop_times rounds:" - [[ "$ifs_mode" == "$IFS_SCAN_MODE" ]] && { - load_image "$DEFAULT_IMG_ID" || return $? - } - for (( i=1; i<=loop_times; i++ )); do - append_log "[$INFO] Loop iteration: $i in total of $loop_times" - # Only IFS scan needs the interval time - if [[ "$ifs_mode" == "$IFS_SCAN_MODE" ]]; then - do_cmd "sleep $INTERVAL_TIME" - elif [[ "$ifs_mode" == "$IFS_ARRAY_BIST_SCAN_MODE" ]]; then - true - else - test_exit "Invalid ifs_mode:$ifs_mode" "$KSFT_XFAIL" - fi - - ifs_test_cpu "$ifs_mode" "$cpu_num" - done - append_log "[$INFO] $loop_times rounds of ifs_$ifs_mode test on CPU:$cpu_num completed.\n" -} - -test_ifs_scan_available_imgs() -{ - local image_ids="" - local image_id="" - - append_log "[$INFO] Test ifs scan with available images:" - image_ids=$(find "$IMG_PATH" -maxdepth 1 -name "${CPU_FMS}-[0-9a-fA-F][0-9a-fA-F].scan" \ - 2>/dev/null \ - | sort \ - | awk -F "-" '{print $NF}' \ - | cut -d "." -f 1) - - for image_id in $image_ids; do - load_image "$image_id" || return $? - - ifs_test_cpus "$SIBLINGS" "$IFS_SCAN_MODE" "$image_id" - # IFS scan requires time interval for the scan on the same CPU - do_cmd "sleep $INTERVAL_TIME" - done -} - -prepare_ifs_test_env() -{ - local max_cpu="" - - check_cpu_ifs_support_interval_time - - online_all_cpus - max_cpu=$(($(nproc) - 1)) - RANDOM_CPU=$(shuf -i 0-$max_cpu -n 1) - - DEFAULT_IMG_ID=$(find $IMG_PATH -maxdepth 1 -name "${CPU_FMS}-[0-9a-fA-F][0-9a-fA-F].scan" \ - 2>/dev/null \ - | sort \ - | head -n 1 \ - | awk -F "-" '{print $NF}' \ - | cut -d "." -f 1) -} - -test_ifs() -{ - prepare_ifs_test_env - - test_ifs_scan_entry - - if [[ -z "$DEFAULT_IMG_ID" ]]; then - append_log "[$SKIP] No proper ${IMG_PATH}/${CPU_FMS}-*.scan, skip ifs_0 scan" - else - test_bad_and_origin_ifs_image "$DEFAULT_IMG_ID" - test_ifs_scan_available_imgs - test_ifs_same_cpu_loop "$IFS_SCAN_MODE" "$RANDOM_CPU" "$LOOP_TIMES" - fi - - if [[ -d "$IFS_ARRAY_BIST_SYSFS_PATH" ]]; then - ifs_test_cpus "$SIBLINGS" "$IFS_ARRAY_BIST_SCAN_MODE" - test_ifs_same_cpu_loop "$IFS_ARRAY_BIST_SCAN_MODE" "$RANDOM_CPU" "$LOOP_TIMES" - else - append_log "[$SKIP] No $IFS_ARRAY_BIST_SYSFS_PATH, skip IFS ARRAY BIST scan" - fi -} - -trap ifs_cleanup SIGTERM SIGINT -test_ifs -ifs_cleanup diff --git a/BM/ifs/tests b/BM/ifs/tests index a552101c..5deacedb 100755 --- a/BM/ifs/tests +++ b/BM/ifs/tests @@ -18,6 +18,3 @@ ifs_tests.sh -m 1 -p ran -n ifs_array_off_sib -t 10 ifs_tests.sh -m 1 -p ran -n ifs_array_offran -t 5 ifs_tests.sh -m 1 -p ran -n ifs_array_cpuran_fullload -t 10 ifs_tests.sh -m 1 -p ran -b 1 -n ifs_loop -t 500 - -# Test ifs_0 all available image scan and ifs_1 scan -test_ifs.sh diff --git a/BM/isst/intel_sst.sh b/BM/isst/intel_sst.sh index 73c4af51..6f901a97 100755 --- a/BM/isst/intel_sst.sh +++ b/BM/isst/intel_sst.sh @@ -77,18 +77,6 @@ isst_legacy_driver_interface() { done } -# Function to check tuned.service is enabled or disabled -# This may impact the cpu frequency when a workload is running -check_tuned_service() { - # Check the status of tuned.service using systemctl - if systemctl is-enabled --quiet tuned.service; then - test_print_trc "tuned.service is enabled, which may change the performance profile and impact the CPU frequency,\ -please consider disabling it with the command: 'sudo systemctl disable tuned.service', then reboot the system." - else - test_print_trc "tuned.service is disabled, so it will not impact the CPU frequency." - fi -} - power_limit_check() { pkg_power_limitation_log=$(rdmsr -p 1 0x1b1 -f 11:11 2>/dev/null) test_print_trc "The power limitation log from package thermal status 0x1b1 bit 11 is: \ @@ -228,62 +216,6 @@ isst_pp_level_change() { do_cmd "intel-speed-select -o pp.out perf-profile set-config-level -l 0 -o" } -# Function to do different supported perf profile levels change by cgroup v2 solution -# Input: -# $1: select different perf profile level -isst_pp_level_change_cgroup() { - local level_id=$1 - do_cmd "intel-speed-select -o pp.out perf-profile get-config-current-level" - test_print_trc "The system perf profile config current level info:" - do_cmd "cat pp.out" - - cur_level=$(grep get-config-current_level pp.out | awk -F ":" '{print $2}') - cur_level_num=$(grep get-config-current_level pp.out | awk -F ":" '{print $2}' | wc -l) - - test_print_trc "Will change the config level from $cur_level to $level_id:" - do_cmd "intel-speed-select -o pp.out -g perf-profile set-config-level -l $level_id" - test_print_trc "The system perf profile config level change log:" - do_cmd "cat pp.out" - - set_tdp_level_status=$(grep set_tdp_level pp.out | awk -F ":" '{print $2}') - set_tdp_level_status_num=$(grep set_tdp_level pp.out | awk -F ":" '{print $2}' | wc -l) - - for ((i = 1; i <= set_tdp_level_status_num; i++)); do - j=$(("$i" - 1)) - set_tdp_level_status_by_num=$(echo "$set_tdp_level_status" | sed -n "$i, 1p") - if [ "$set_tdp_level_status_by_num" = success ]; then - test_print_trc "The system package $j set tdp level status is $set_tdp_level_status_by_num" - test_print_trc "The system package $j set tdp level success." - else - test_print_trc "The system package $j set tdp level status is $set_tdp_level_status_by_num" - die "The system package $j set tdp level fails" - fi - done - - test_print_trc "Confirm the changed config current level:" - do_cmd "intel-speed-select -o pp.out perf-profile get-config-current-level" - test_print_trc "The system perf profile config current level info:" - do_cmd "cat pp.out" - - cur_level=$(grep get-config-current_level pp.out | awk -F ":" '{print $2}') - cur_level_num=$(grep get-config-current_level pp.out | awk -F ":" '{print $2}' | wc -l) - - for ((i = 1; i <= cur_level_num; i++)); do - j=$(("$i" - 1)) - cur_level_by_num=$(echo "$cur_level" | sed -n "$i, 1p") - if [ "$cur_level_by_num" -eq "$level_id" ]; then - test_print_trc "The system package $j config current level: $cur_level_by_num" - test_print_trc "The system package $j config current level is $level_id after successfully setting" - else - test_print_trc "The system package $j config current level: $cur_level_by_num" - die "The system package $j set tdp level fails" - fi - done - - test_print_trc "Recover the config level to the default setting: 0" - do_cmd "intel-speed-select -o pp.out -g perf-profile set-config-level -l 0" -} - # Function to check the base frequency alignment between sysfs and isst tool for each profile level # Input: # $1: select different perf profile level @@ -624,7 +556,6 @@ isst_bf_baseline_test() { with power limitation log observed." else test_print_trc "The package and core power limitation is not assert." - check_tuned_service die "The CPUs base freq is 100Mhz larger than expected base_freq without power limitation assert." fi else @@ -753,7 +684,6 @@ isst_bf_freq_test() { test_print_trc "The 2nd and 3rd CPUs of package$j did not reach ISST HP base freq when power limitation assert." else test_print_trc "The package$j and core power limitation is not assert." - check_tuned_service die "The 2nd and 3rd CPUs of package$j did not reach ISST HP base freq without power limitation assert." fi else @@ -874,7 +804,6 @@ isst_tf_freq_test() { die "The test CPUs did not reach ISST HP turbo freq when power limitation assert." else test_print_trc "The package and core power limitation is not assert." - check_tuned_service die "The test CPUs did not reach ISST HP turbo freq without power limitation assert." fi else @@ -908,18 +837,6 @@ isst_test() { isst_pp_config_level4_config) isst_pp_level_change 4 ;; - isst_pp_config_level1_config_cgroup) - isst_pp_level_change_cgroup 1 - ;; - isst_pp_config_level2_config_cgroup) - isst_pp_level_change_cgroup 2 - ;; - isst_pp_config_level3_config_cgroup) - isst_pp_level_change_cgroup 3 - ;; - isst_pp_config_level4_config_cgroup) - isst_pp_level_change_cgroup 4 - ;; isst_base_freq_pp_level1_change) isst_base_freq_pp_level_change 1 ;; diff --git a/BM/isst/tests b/BM/isst/tests old mode 100644 new mode 100755 index 2171942b..3df7035f --- a/BM/isst/tests +++ b/BM/isst/tests @@ -1,6 +1,6 @@ -# This file collects the isst cases for Intel® server platforms +# This file collects the isst cases for Intel® server platforms # here assume the platform supports SST perf profile level 0,3,4 -# user can adjust the case lists based on the actual SUT SST +# user can adjust the case lists based on the actual SUT SST # perf profile level support status # @hw_dep: # @other_dep: @@ -12,14 +12,8 @@ intel_sst.sh -t isst_pp_config_enable_status intel_sst.sh -t isst_legacy_driver_sysfs intel_sst.sh -t isst_cap intel_sst.sh -t isst_unlock_status -intel_sst.sh -t isst_pp_config_level1_config -intel_sst.sh -t isst_pp_config_level2_config intel_sst.sh -t isst_pp_config_level3_config intel_sst.sh -t isst_pp_config_level4_config -intel_sst.sh -t isst_pp_config_level1_config_cgroup -intel_sst.sh -t isst_pp_config_level2_config_cgroup -intel_sst.sh -t isst_pp_config_level3_config_cgroup -intel_sst.sh -t isst_pp_config_level4_config_cgroup intel_sst.sh -t isst_base_freq_pp_level3_change intel_sst.sh -t isst_base_freq_pp_level4_change intel_sst.sh -t isst_cp_enable_prop_type diff --git a/BM/pcie/README.md b/BM/pcie/README.md deleted file mode 100644 index 96e39f44..00000000 --- a/BM/pcie/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# pcie related tests description - -## case implemented by pcie_check.sh and pcie_check.c for general PCIe capability check -### for simplicity, only check PCIe Cap Structure (7.5.3 in spec) Max Speed, Current Speed, Supported Speed, Target Speed - - PCIe root port (PCI bridge) Gen4 capability test, apply for PCIe Gen4 platform - ``` - ./pcie_check.sh gen4 - ``` - - PCIe root port (PCI bridge) Gen5 capability test, apply for PCIe Gen5 platform - ``` - ./pcie_check.sh gen5 - ``` - - PCIe root port (PCI bridge) Gen6 capability test, apply for PCIe Gen4 platform - ``` - ./pcie_check.sh gen6 - ``` diff --git a/BM/pcie/pcie_check.sh b/BM/pcie/pcie_check.sh deleted file mode 100644 index 47230ab5..00000000 --- a/BM/pcie/pcie_check.sh +++ /dev/null @@ -1,343 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0-only -# Copyright (c) 2024 Intel Corporation - -# Author: Hongyu Ning -# -# History: 28, Jun., 2024 - Hongyu Ning - creation - - -# @desc This script do basic pcie capability check with lspci and -# BM/tools/pcie/pcie_check.c -# pcie Gen4, Gen5 and Gen6 covered -# ref spec: PCI-SIG PCI Express® Base Specification Revision 6.0.1 on 29 August 2022 - -###################### Variables ###################### -SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )" -echo "$SCRIPT_DIR" - -###################### Functions ###################### -# function to check if PCI bridge exists -pci_bridge_device_check() { - local pci_bridge_device - local dev - pci_bridge_device=$(lspci -nnv | grep -wE "PCI bridge" | awk '{print $1}') - pci_bridge_device=$(echo -e $pci_bridge_device) - IFS=" " read -ra pci_bridge_array <<< "$pci_bridge_device" - for dev in "${pci_bridge_array[@]}" - do - if [[ -z "$dev" ]]; then - die "No PCI bridge device found" - fi - test_print_trc "PCI bridge device found: $dev" - done -} - -# function on convert decimal into binary based on input digits argument -# example: decimal_to_binary 5 4, covert decimal 5 into binary of 4 digits -decimal_to_binary() { - local decimal - local digits - decimal=$1 - digits=$2 - digits=$((digits+1)) - echo "obase=2; $decimal" | bc | tail -c "$digits" -} - -# function on PCIe Max Link Speed check, support gen4, gen5 and gen6 -# with arguments of gen4, gen5 or gen6 -pci_max_link_speed() { - local gen - local dev - local reg - gen=$1 - dev="${2#[0-9][0-9][0-9][0-9]:}" - # check Link Capabilities Register section 7.5.3.6 in spec - reg=$(pcie_check i 10 c 4 | grep "$dev") - if [[ "$gen" = "gen5" ]]; then - if [[ "$reg" -eq 4 ]]; then - test_print_trc "PCI bridge: $dev, PCIe Max Link Speed is: 32GT/s" - else - reg=$(decimal_to_binary "$reg" 4) - test_print_wrn "PCI bridge: $dev, PCIe Max Link Speed registers value $reg" - fi - echo 32 - elif [[ "$gen" = "gen6" ]]; then - if [[ "$reg" -eq 5 ]]; then - test_print_trc "PCI bridge: $dev, PCIe Max Link Speed is: 64GT/s" - else - reg=$(decimal_to_binary "$reg" 4) - test_print_wrn "PCI bridge: $dev, PCIe Max Link Speed registers value $reg" - fi - echo 64 - elif [[ "$gen" = "gen4" ]]; then - if [[ "$reg" -eq 3 ]]; then - test_print_trc "PCI bridge: $dev, PCIe Max Link Speed is: 16GT/s" - else - reg=$(decimal_to_binary "$reg" 4) - test_print_wrn "PCI bridge: $dev, PCIe Max Link Speed registers value $reg" - fi - echo 16 - else - die "PCIe Max Link Speed check failed, invalid gen argument $gen" - fi -} - -# function on PCIe Current Link Speed check, support gen4, gen5 and gen6 -# with arguments of gen4, gen5 or gen6 -pci_current_link_speed() { - local gen - local dev - local reg - gen=$1 - dev="${2#[0-9][0-9][0-9][0-9]:}" - # check Link Status Register section 7.5.3.8 in spec - reg=$(pcie_check i 10 12 4 | grep "$dev") - if [[ "$gen" = "gen5" ]]; then - if [[ "$reg" -eq 4 ]]; then - test_print_trc "PCI bridge: $dev, PCIe Current Link Speed is: 32GT/s" - echo 32 - elif [[ "$reg" -eq 3 ]]; then - test_print_wrn "PCI bridge: $dev, PCIe Current Link Speed is: 16GT/s (downgraded)" - echo 16 - elif [[ "$reg" -eq 2 ]]; then - test_print_wrn "PCI bridge: $dev, PCIe Current Link Speed is: 8GT/s (downgraded)" - echo 8 - elif [[ "$reg" -eq 1 ]]; then - test_print_wrn "PCI bridge: $dev, PCIe Current Link Speed is: 5GT/s (downgraded)" - echo 5 - elif [[ "$reg" -eq 0 ]]; then - test_print_wrn "PCI bridge: $dev, PCIe Current Link Speed is: 2.5GT/s (downgraded)" - echo 2.5 - else - reg=$(decimal_to_binary "$reg" 4) - test_print_wrn "PCI bridge: $dev, PCIe Current Link Speed registers value $reg" - echo 0 - fi - elif [[ "$gen" = "gen6" ]]; then - if [[ "$reg" -eq 5 ]]; then - test_print_trc "PCI bridge: $dev, PCIe Current Link Speed is: 64GT/s" - echo 64 - elif [[ "$reg" -eq 4 ]]; then - test_print_wrn "PCI bridge: $dev, PCIe Current Link Speed is: 32GT/s (downgraded)" - echo 32 - elif [[ "$reg" -eq 3 ]]; then - test_print_wrn "PCI bridge: $dev, PCIe Current Link Speed is: 16GT/s (downgraded)" - echo 16 - elif [[ "$reg" -eq 2 ]]; then - test_print_wrn "PCI bridge: $dev, PCIe Current Link Speed is: 8GT/s (downgraded)" - echo 8 - elif [[ "$reg" -eq 1 ]]; then - test_print_wrn "PCI bridge: $dev, PCIe Current Link Speed is: 5GT/s (downgraded)" - echo 5 - elif [[ "$reg" -eq 0 ]]; then - test_print_wrn "PCI bridge: $dev, PCIe Current Link Speed is: 2.5GT/s (downgraded)" - echo 2.5 - else - reg=$(decimal_to_binary "$reg" 4) - test_print_wrn "PCI bridge: $dev, PCIe Current Link Speed registers value $reg" - echo 0 - fi - elif [[ "$gen" = "gen4" ]]; then - if [[ "$reg" -eq 3 ]]; then - test_print_trc "PCI bridge: $dev, PCIe Current Link Speed is: 16GT/s" - echo 16 - elif [[ "$reg" -eq 2 ]]; then - test_print_wrn "PCI bridge: $dev, PCIe Current Link Speed is: 8GT/s (downgraded)" - echo 8 - elif [[ "$reg" -eq 1 ]]; then - test_print_wrn "PCI bridge: $dev, PCIe Current Link Speed is: 5GT/s (downgraded)" - echo 5 - elif [[ "$reg" -eq 0 ]]; then - test_print_wrn "PCI bridge: $dev, PCIe Current Link Speed is: 2.5GT/s (downgraded)" - echo 2.5 - else - reg=$(decimal_to_binary "$reg" 4) - test_print_wrn "PCI bridge: $dev, PCIe Current Link Speed registers value $reg" - echo 0 - fi - else - die "PCIe Current Link Speed check failed, invalid gen argument $gen" - fi -} - -# function on PCIe Supported Link Speed check, support gen4, gen5 and gen6 -# with arguments of gen4, gen5 or gen6 -pci_supported_link_speed() { - local gen - local dev - local reg - gen=$1 - dev="${2#[0-9][0-9][0-9][0-9]:}" - # check Link Capabilities 2 Register section - # 8 bits vector, bit 0 is reserved, so need to remove it - reg=$(pcie_check i 10 2c 8 | grep "$dev") - reg=$(decimal_to_binary "$reg" 8) - reg=${reg%[0-1]} - if [[ "$gen" = "gen5" ]]; then - if [[ "$reg" -eq 31 ]]; then - test_print_trc "PCI bridge: $dev, PCIe Supported Link Speeds: 2.5-32GT/s" - echo "2.5-32GT/s" - elif [[ "$reg" -eq 15 ]]; then - test_print_trc "PCI bridge: $dev, PCIe Supported Link Speeds: 2.5-16GT/s" - echo "2.5-16GT/s" - elif [[ "$reg" -eq 7 ]]; then - test_print_trc "PCI bridge: $dev, PCIe Supported Link Speeds: 2.5-8GT/s" - echo "2.5-8GT/s" - elif [[ "$reg" -eq 3 ]]; then - test_print_trc "PCI bridge: $dev, PCIe Supported Link Speeds: 2.5-5GT/s" - echo "2.5-5GT/s" - elif [[ "$reg" -eq 1 ]]; then - test_print_trc "PCI bridge: $dev, PCIe Supported Link Speeds: 2.5GT/s" - echo "2.5GT/s" - else - test_print_wrn "PCI bridge: $dev, PCIe Supported Link Speeds registers value $reg" - echo "0" - fi - elif [[ "$gen" = "gen6" ]]; then - if [[ "$reg" -eq 63 ]]; then - test_print_trc "PCI bridge: $dev, PCIe Supported Link Speeds: 2.5-64GT/s" - echo "2.5-64GT/s" - elif [[ "$reg" -eq 31 ]]; then - test_print_trc "PCI bridge: $dev, PCIe Supported Link Speeds: 2.5-32GT/s" - echo "2.5-32GT/s" - elif [[ "$reg" -eq 15 ]]; then - test_print_trc "PCI bridge: $dev, PCIe Supported Link Speeds: 2.5-16GT/s" - echo "2.5-16GT/s" - elif [[ "$reg" -eq 7 ]]; then - test_print_trc "PCI bridge: $dev, PCIe Supported Link Speeds: 2.5-8GT/s" - echo "2.5-8GT/s" - elif [[ "$reg" -eq 3 ]]; then - test_print_trc "PCI bridge: $dev, PCIe Supported Link Speeds: 2.5-5GT/s" - echo "2.5-5GT/s" - elif [[ "$reg" -eq 1 ]]; then - test_print_trc "PCI bridge: $dev, PCIe Supported Link Speeds: 2.5GT/s" - echo "2.5GT/s" - else - test_print_wrn "PCI bridge: $dev, PCIe Supported Link Speeds registers value $reg" - echo "0" - fi - elif [[ "$gen" = "gen4" ]]; then - if [[ "$reg" -eq 15 ]]; then - test_print_trc "PCI bridge: $dev, PCIe Supported Link Speeds: 2.5-16GT/s" - echo "2.5-16GT/s" - elif [[ "$reg" -eq 7 ]]; then - test_print_trc "PCI bridge: $dev, PCIe Supported Link Speeds: 2.5-8GT/s" - echo "2.5-8GT/s" - elif [[ "$reg" -eq 3 ]]; then - test_print_trc "PCI bridge: $dev, PCIe Supported Link Speeds: 2.5-5GT/s" - echo "2.5-5GT/s" - elif [[ "$reg" -eq 1 ]]; then - test_print_trc "PCI bridge: $dev, PCIe Supported Link Speeds: 2.5GT/s" - echo "2.5GT/s" - else - test_print_wrn "PCI bridge: $dev, PCIe Supported Link Speeds registers value $reg" - echo "0" - fi - else - die "PCIe Supported Link Speed check failed, invalid gen argument $gen" - fi -} - -# function on PCIe Target Link Speed check, support gen4, gen5 and gen6 -# with arguments of gen4, gen5 or gen6 -pci_target_link_speed() { - local gen - local dev - local reg - gen=$1 - dev="${2#[0-9][0-9][0-9][0-9]:}" - # check Link Control 2 Register section - reg=$(pcie_check i 10 30 4 | grep "$dev") - if [[ "$gen" = "gen5" ]]; then - if [[ "$reg" -eq 4 ]]; then - test_print_trc "PCI bridge: $dev, PCIe Target Link Speed is: 32GT/s" - echo 32 - else - reg=$(decimal_to_binary "$reg" 4) - test_print_wrn "PCI bridge: $dev, PCIe Target Link Speed registers value $reg" - echo 0 - fi - elif [[ "$gen" = "gen6" ]]; then - if [[ "$reg" -eq 5 ]]; then - test_print_trc "PCI bridge: $dev, PCIe Target Link Speed is: 64GT/s" - echo 64 - else - reg=$(decimal_to_binary "$reg" 4) - test_print_wrn "PCI bridge: $dev, PCIe Target Link Speed registers value $reg" - echo 0 - fi - elif [[ "$gen" = "gen4" ]]; then - if [[ "$reg" -eq 3 ]]; then - test_print_trc "PCI bridge: $dev, PCIe Target Link Speed is: 16GT/s" - echo 16 - else - reg=$(decimal_to_binary "$reg" 4) - test_print_wrn "PCI bridge: $dev, PCIe Target Link Speed registers value $reg" - echo 0 - fi - else - die "PCIe Target Link Speed check failed, invalid gen argument $gen" - fi -} - -###################### Do Works ###################### -cd "$(dirname "$0")" 2>/dev/null || exit 1 -source ../.env - -# run pre-check -pci_bridge_device_check - -# run pcie capability check -pci_bridge_device=0 -dev=0 -gen=$1 -max_speed=0 -support_speed=0 -target_speed=0 -passed=0 - -pci_bridge_device=$(lspci -nnv | grep -wE "PCI bridge" | awk '{print $1}') -pci_bridge_device=$(echo -e $pci_bridge_device) -IFS=" " read -ra pci_bridge_array <<< "$pci_bridge_device" -for dev in "${pci_bridge_array[@]}" - do - max_speed=$(pci_max_link_speed $gen $dev) - pci_current_link_speed $gen $dev - support_speed=$(pci_supported_link_speed $gen $dev) - target_speed=$(pci_target_link_speed $gen $dev) - if [[ "$gen" != "gen4" && "$gen" != "gen5" && "$gen" != "gen6" ]]; then - die "Invalid gen argument $gen" - elif [[ "$gen" = "gen4" ]]; then - # check if max speed is 16GT/s, support speed is 2.5-16GT/s and target speed is 16GT/s - # bypass current link speed check as it may be downgraded due to various reasons - if [[ "$max_speed" -eq 16 && "$support_speed" = "2.5-16GT/s" && "$target_speed" -eq 16 ]]; then - test_print_trc "PCI bridge: $dev, PCIe Gen4 capability check passed" - passed=1 - break - fi - elif [[ "$gen" = "gen5" ]]; then - # check if max speed is 32GT/s, support speed is 2.5-32GT/s and target speed is 32GT/s - # bypass current link speed check as it may be downgraded due to various reasons - if [[ "$max_speed" -eq 32 && "$support_speed" = "2.5-64GT/s" && "$target_speed" -eq 32 ]]; then - test_print_trc "PCI bridge: $dev, PCIe Gen5 capability check passed" - passed=1 - break - fi - elif [[ "$gen" = "gen6" ]]; then - # check if max speed is 64GT/s, support speed is 2.5-64GT/s and target speed is 64GT/s - # bypass current link speed check as it may be downgraded due to various reasons - if [[ "$max_speed" -eq 64 && "$support_speed" = "2.5-64GT/s" && "$target_speed" -eq 64 ]]; then - test_print_trc "PCI bridge: $dev, PCIe Gen6 capability check passed" - passed=1 - break - fi - fi - die "PCI bridge: $dev, PCIe $gen capability check failed" - done - -if [[ "$passed" -eq 1 ]]; then - test_print_trc "PCIe $gen capability check test completed successfully" -else - die "PCIe $gen capability check failed after all PCI bridge devices checked" -fi \ No newline at end of file diff --git a/BM/pcie/tests b/BM/pcie/tests deleted file mode 100644 index bcf60b10..00000000 --- a/BM/pcie/tests +++ /dev/null @@ -1,8 +0,0 @@ -# This file collects PCIe tests on Intel® Architecture-based platforms. - -# case info: PCIe gen4 device capability check -./pcie_check.sh gen4 -# case info: PCIe gen5 device capability check -./pcie_check.sh gen5 -# case info: PCIe gen6 device capability check -./pcie_check.sh gen6 diff --git a/BM/pstate/intel_pstate_tests.sh b/BM/pstate/intel_pstate_tests.sh index 72dd5cfe..5ff4db08 100755 --- a/BM/pstate/intel_pstate_tests.sh +++ b/BM/pstate/intel_pstate_tests.sh @@ -106,18 +106,6 @@ cpufreq_sysfs_attr() { fi } -# Function to check tuned.service is enabled or disabled -# This may impact the cpu frequency when a workload is running -check_tuned_service() { - # Check the status of tuned.service using systemctl - if systemctl is-enabled --quiet tuned.service; then - test_print_trc "tuned.service is enabled, which may change the performance profile and impact the CPU frequency,\ -please consider disabling it with the command: 'sudo systemctl disable tuned.service', then reboot the system." - else - test_print_trc "tuned.service is disabled, so it will not impact the CPU frequency." - fi -} - # Function to check if there is any package and core power limitation being asserted # When CPU Frequency is lower than the expected value. power_limit_check() { @@ -362,7 +350,6 @@ check_max_cores_freq() { test_print_trc "$current_freq is lower than $max_freq with power limitation asserted" else test_print_trc "The package and core power limitation is NOT being asserted." - check_tuned_service die "$current_freq is lower than $max_freq without power limitation asserted" fi else diff --git a/BM/pstate/tests b/BM/pstate/tests old mode 100644 new mode 100755 diff --git a/BM/rapl/tests-client b/BM/rapl/tests-client old mode 100644 new mode 100755 diff --git a/BM/rapl/tests-server b/BM/rapl/tests-server old mode 100644 new mode 100755 diff --git a/BM/runtests b/BM/runtests index 5e1a2f4e..d45e1e3b 100755 --- a/BM/runtests +++ b/BM/runtests @@ -43,7 +43,6 @@ Usage: ${0##*/} [-f CMDFILES] [-c CMDLINE] [-o LOGFILE] -d DEPENDENCE_FILE check dependence for specified feature tests -t TYPE_FILE check test type like tests-server|tests-client -c CMDLINE execute test case - -s SCENARIO_FOLDER all tests-* files under target folder -o LOGFILE redirect output of tests to file Examples: @@ -52,7 +51,6 @@ Examples: ./runtests -t tests-client // type like tests-client|tests for all subfolders ./runtests -t tests-server // type like tests-server|tests for all subfolders ./runtests -c ./cet/quick_test -o cet_quick_test.log - ./runtests -s ../scenario/emr-oe // scenario test files folder ./runtests -d cet/tests // check cet dependence ./runtests -d tests-server // check tests-server/tests for all subfolders dependence _EOF @@ -101,9 +99,9 @@ init_dep_log() { cat /dev/null > "$dep_log" { echo "-----------------------------------------------------------------" - printf "%-35s%-13s%-16s%-13s%-20s\n" "Feature" "|HW_support" "|Other_support" \ + printf "%-16s%-13s%-16s%-13s%-20s\n" "Feature" "|HW_support" "|Other_support" \ "|Other_WARN" "|Reason" - printf "%-35s%-13s%-16s%-13s%-20s\n" "-------" "-----------" "--------------" \ + printf "%-16s%-13s%-16s%-13s%-20s\n" "-------" "-----------" "--------------" \ "-----------" "-------" } >> "$dep_log" } @@ -198,33 +196,33 @@ check_dep_feature() { other_dep_info=$(grep "$MARK_OTHER_DEP" "$cmdfile" | awk -F "$MARK_OTHER_DEP" '{print $2}' | sed -e 's/^ *//g') other_warn_info=$(grep "$MARK_WARN_DEP" "$cmdfile" | awk -F "$MARK_WARN_DEP" '{print $2}' | sed -e 's/^ *//g') - check_dep_info "$hw_dep_info" "$cmdfile" "$MARK_HW_DEP" + check_dep_info "$hw_dep_info" "$subfolder" "$MARK_HW_DEP" ret=$? hw_sta=$(get_ret_status "$ret") [[ "$ret" == "$NA_CODE" || "$ret" == "$BLOCK_CODE" ]] && { - printf "%-35s%-13s%-16s%-13s%-20s\n" "$cmdfile" "|$hw_sta" "|$SKIP" "|$SKIP" \ + printf "%-16s%-13s%-16s%-13s%-20s\n" "$subfolder" "|$hw_sta" "|$SKIP" "|$SKIP" \ "|$REASON" >> "$DEP_LOG" return "$ret" } - check_dep_info "$other_dep_info" "$cmdfile" "$MARK_OTHER_DEP" + check_dep_info "$other_dep_info" "$subfolder" "$MARK_OTHER_DEP" ret=$? other_sta=$(get_ret_status "$ret") [[ "$ret" == "$NA_CODE" || "$ret" == "$BLOCK_CODE" ]] && { - printf "%-35s%-13s%-16s%-13s%-20s\n" "$cmdfile" "|$hw_sta" "|$other_sta" "|$SKIP" \ + printf "%-16s%-13s%-16s%-13s%-20s\n" "$subfolder" "|$hw_sta" "|$other_sta" "|$SKIP" \ "|$REASON" >> "$DEP_LOG" return "$ret" } # It's a warning, will not block the subfolder test cases - check_dep_info "$other_warn_info" "$cmdfile" "$MARK_WARN_DEP" + check_dep_info "$other_warn_info" "$subfolder" "$MARK_WARN_DEP" ret=$? warn_sta=$(get_ret_status "$ret") # warn_sta does not set the block, just NA to fail in some cases of this feature [[ "$ret" == "$BLOCK_CODE" ]] && warn_sta="$NA" - [[ -z "$REASON" || "$ret" == "$PASS_CODE" ]] && REASON="No dependence for $cmdfile" - printf "%-35s%-13s%-16s%-13s%-20s\n" "$cmdfile" "|$hw_sta" "|$other_sta" "|$warn_sta" \ + [[ -z "$REASON" || "$ret" == "$PASS_CODE" ]] && REASON="No dependence for $subfolder" + printf "%-16s%-13s%-16s%-13s%-20s\n" "$subfolder" "|$hw_sta" "|$other_sta" "|$warn_sta" \ "|$REASON" >> "$DEP_LOG" return 0 } @@ -400,10 +398,9 @@ run_tests() { check_dep_feature "$cmdfile" || { append_log "Skip $cmdfile due to dependece, please check $DEP_LOG" "$LOGFILE" - DEP_EXIT=$BLOCK_CODE continue } - append_log "Next run cases from $cmdfile" "$LOGFILE" + runcmdfile "$cmdfile" "$LOGFILE" done @@ -417,7 +414,7 @@ run_tests() { : CMDFILES="" : CMDLINE="" -while getopts ":o:d:f:t:s:c:h" opt; do +while getopts ":o:d:f:t:c:h" opt; do case "$opt" in o) LOGFILE=$OPTARG @@ -425,12 +422,11 @@ while getopts ":o:d:f:t:s:c:h" opt; do d) init_dep_log "$DEP_LOG" CMDFILES=$OPTARG - # If tests-server type will list tests-server in all subfolders - [[ "$CMDFILES" == "$TESTS_SERVER" ]] && list_all_test_files "$CMDFILES" + [[ "$CMDFILES" == *"-"* ]] && list_all_test_files "$CMDFILES" for cmdfile in $(tr "," " " <<< "$CMDFILES"); do - check_test_file_legal "$cmdfile" || continue + check_test_file_legal "$cmdfile" check_dep_feature "$cmdfile" || { append_log "Skip $cmdfile due to dependece, please check $DEP_LOG" "$LOGFILE" @@ -448,20 +444,6 @@ while getopts ":o:d:f:t:s:c:h" opt; do # If tests-server type will list tests-server in all subfolders [[ "$CMDFILES" == *"-"* ]] && list_all_test_files "$CMDFILES" ;; - s) - test_files="" - - SCENARIO_FOLDER=$OPTARG - [[ -d "$SCENARIO_FOLDER" ]] || usage - test_files=$(find "$SCENARIO_FOLDER" -name "tests-*") - [[ -z "$test_files" ]] && { - append_log "No tests-* files under $SCENARIO_FOLDER" - exit 2 - } - for cmdfile in $test_files; do - CMDFILES="$CMDFILES,$cmdfile" - done - ;; c) CMDLINE=$OPTARG ;; diff --git a/BM/runtests.py b/BM/runtests.py index a06700be..5812367f 100755 --- a/BM/runtests.py +++ b/BM/runtests.py @@ -1,20 +1,16 @@ -#!/usr/bin/env python3 - -from avocado.core.nrunner.runnable import Runnable -from avocado.core.suite import TestSuite -from avocado.core.job import Job +#!/usr/bin/python3 +import sys import subprocess import argparse -import shlex -import sys import os +from avocado.core.job import Job +from avocado.core.nrunner.runnable import Runnable +from avocado.core.suite import TestSuite # Parse command line arguments. -parser = argparse.ArgumentParser(description='Run tests from a list in a file(tests).') -parser.add_argument('-f', '--feature', required=True, - help='Directory of a feature to run the tests') -parser.add_argument('-t', '--tests', required=True, - help='Path to a test file containing the list of tests to run') +parser = argparse.ArgumentParser(description='Run tests from a list in a file(tests/tests-client/tests-server).') +parser.add_argument('-f', '--feature', help='Directory of a feature to run the tests') +parser.add_argument('-t', '--tests', help='Path to a test file containing the list of tests to run') args = parser.parse_args() BM_dir = os.path.dirname(os.path.realpath(__file__)) @@ -22,41 +18,46 @@ # Check the dependency, if the exit value is not 0, then terminate the test. # Parse dependency information. def parse_line(line): - if ':' not in line: - return None, None - - info = line.split(':', 1)[1].strip() - if not info: - return None, None - - if '@' in info: - info, reason_info = map(str.strip, info.split('@', 1)) - else: - reason_info = None - - return f"{info} >& /dev/null", reason_info + colon_index = line.find(':') + if colon_index != -1: + info = line[colon_index + 1:].strip() + if not info: + return None, None + at_index = info.find('@') + if at_index != -1: + reason_info = info[at_index + 1:].strip() + info = info[:at_index].strip() + else: + reason_info = None + info += ' >& /dev/null' + return info, reason_info + return None, None def dependency_check(ftests): common_dir = f"{BM_dir}/common" cpuid_dir = f"{BM_dir}/tools/cpuid_check" # Add the necessary environment variables. - os.environ['PATH'] += os.pathsep + common_dir + os.pathsep + cpuid_dir - + os.environ['PATH'] += os.pathsep + os.pathsep.join([common_dir, cpuid_dir]) + # Check the dependency. with open(ftests, 'r') as file: for line in file: - if line.startswith(('# @hw_dep', '# @other_dep', '# @other_warn')): + if line.startswith('# @hw_dep') or line.startswith('# @other_dep'): info, reason_info = parse_line(line) if info: try: subprocess.run(info, shell=True, check=True) except subprocess.CalledProcessError: - if line.startswith('# @other_warn'): - print(f"Warning: {reason_info}") - else: - print(f"Terminate the test: {reason_info}") - sys.exit(1) + print(f"Terminate the test: {reason_info}") + sys.exit(1) + elif line.startswith('# @other_warn'): + info, reason_info = parse_line(line) + if info: + try: + subprocess.run(info, shell=True, check=True) + except subprocess.CalledProcessError: + print(f"Warning: {reason_info}") # Read the tests file and create Runnable objects. def create_runnables_from_file(ftests): @@ -64,13 +65,12 @@ def create_runnables_from_file(ftests): with open(ftests, 'r') as file: for line in file: # Handle empty lines and comments. - line_str = line.strip() - if not line_str or line.startswith('#'): + if not line.strip() or line.startswith('#'): continue - # Split command line parameters. - cmd_line = shlex.split(line_str) - runnable = Runnable("exec-test", *cmd_line) + parts = line.strip().split() + # Create a Runnable object. + runnable = Runnable("exec-test", parts[0], *parts[1:]) tests.append(runnable) return tests diff --git a/BM/sdsi/sdsi_fms_list b/BM/sdsi/sdsi_fms_list old mode 100644 new mode 100755 diff --git a/BM/sdsi/tests b/BM/sdsi/tests old mode 100644 new mode 100755 diff --git a/BM/splitlock/tests b/BM/splitlock/tests old mode 100644 new mode 100755 diff --git a/BM/tdx-compliance/README.md b/BM/tdx-compliance/README.md index d0a49c0c..6aa894e4 100644 --- a/BM/tdx-compliance/README.md +++ b/BM/tdx-compliance/README.md @@ -26,9 +26,9 @@ To build tdx-compliance, follow these steps: ```bash git clone https://github.com/intel/lkvs.git -cd lkvs/BM/tdx-compliance +cd lkvs/tdx-compliance make -insmod tdx-compliance.ko +insmod tdx-compliance ``` ### Step 3: Run test cases To run all kinds of compliance tests, simply enter the following command: @@ -93,31 +93,6 @@ Usage: echo cr [version] > /sys/kernel/debug/tdx/tdx-tests ``` -* Trigger the cpuid and capture #VE or #GP. - -Some CPUID instructions will trigger #VE (Virtualization Exceptions), and during the process of handling #VE, the ``tdx_handle_virt_exception function`` is called. Based on the return value of this function, it can be determined whether it is #VE or #GP. The #VE triggered by the CPUID instruction will ultimately be handled by the ``handle_cpuid`` function, and the return value of this function determines the return value of the ``tdx_handle_virt_exception`` function. Therefore, it is necessary to capture the return value of the ``handle_cpuid`` function. We use the kernel-provided ``kretprobe`` mechanism to capture the return value of the handle_cpuid function, thereby determining whether it is #VE or #GP. - -Usage: -Register probe points: -``` -echo kretprobe > /sys/kernel/debug/tdx/tdx-tests -``` -Single trigger cpuid instruction, and the captured information is printed in dmesg. ``0x1f 0x0 0x0 0x0`` are the input of eax, ebx, ecx, edx.: -``` -echo trigger_cpuid 0x1f 0x0 0x0 0x0 > /sys/kernel/debug/tdx/tdx-tests -``` -Trigger all cpuid instructions in tdx-compliance.h: -``` -echo cpuid > /sys/kernel/debug/tdx/tdx-tests -``` -Unregister the kretprobe: -``` -echo unregister > /sys/kernel/debug/tdx/tdx-tests -rmmod tdx_compliance -``` -Note: -Executing the CPUID instruction in user space can lead to contamination, resulting in multiple captures of ``handle_cpuid``; therefore, the most accurate method is to trigger the CPUID instruction in kernel space. - ## Contact: Sun, Yi (yi.sun@intel.com) diff --git a/BM/tdx-compliance/tdx-compliance-cpuid.h b/BM/tdx-compliance/tdx-compliance-cpuid.h index 08b2e979..feee2926 100644 --- a/BM/tdx-compliance/tdx-compliance-cpuid.h +++ b/BM/tdx-compliance/tdx-compliance-cpuid.h @@ -53,8 +53,8 @@ extern void initial_cpuid(void); void initial_cpuid(void) { /* CPUID(0x0) */ - EXP_CPUID_BYTE(0x0, 0, eax, 0x00000021, VER1_0); //"MaxIndex" - EXP_CPUID_BYTE(0x0, 0, eax, 0x00000023, VER1_5 | VER2_0); //"MaxIndex" + EXP_CPUID_BYTE(0x0, 0, eax, 0x00000021, VER1_0 | VER2_0); //"MaxIndex" + EXP_CPUID_BYTE(0x0, 0, eax, 0x00000023, VER1_5); //"MaxIndex" EXP_CPUID_BYTE(0x0, 0, ebx, 0x756e6547, VER1_5); //"Genu" EXP_CPUID_BYTE(0x0, 0, ecx, 0x6c65746e, VER1_5); //"ntel" EXP_CPUID_BYTE(0x0, 0, edx, 0x49656e69, VER1_5); //"ineI" @@ -240,8 +240,8 @@ void initial_cpuid(void) EXP_CPUID_RES_BITS(0x4, 4, edx, 3, 31, VER1_0 | VER1_5 | VER2_0); //Reserved /* CPUID(0x7, 0x0).EAX */ - EXP_CPUID_BYTE(0x7, 0, eax, 2, VER1_5 | VER2_0); //Max Sub-Leaves - EXP_CPUID_BYTE(0x7, 0, eax, 1, VER1_0); //Max Sub-Leaves + EXP_CPUID_BYTE(0x7, 0, eax, 2, VER1_5); //Max Sub-Leaves + EXP_CPUID_BYTE(0x7, 0, eax, 1, VER1_0 | VER2_0); //Max Sub-Leaves /* CPUID(0x7, 0x0).EBX */ EXP_CPUID_BIT(0x7, 0x0, ebx, 0, 1, VER1_0 | VER1_5 | VER2_0); //FSGSBASE @@ -291,9 +291,7 @@ void initial_cpuid(void) EXP_CPUID_BIT(0x7, 0x1, eax, 7, 0, VER1_5 | VER2_0); //Reserved EXP_CPUID_BIT(0x7, 0x1, eax, 8, 0, VER2_0); //Reserved EXP_CPUID_BIT(0x7, 0x1, eax, 9, 0, VER1_5 | VER2_0); //Reserved - EXP_CPUID_RES_BITS(0x7, 0x1, eax, 13, 21, VER1_0 | VER1_5); //Reserved - EXP_CPUID_RES_BITS(0x7, 0x1, eax, 13, 18, VER2_0); //Reserved - EXP_CPUID_BIT(0x7, 0x1, eax, 20, 0, VER2_0); //HRESET + EXP_CPUID_RES_BITS(0x7, 0x1, eax, 13, 21, VER1_0 | VER1_5 | VER2_0); //Reserved EXP_CPUID_BIT(0x7, 0x1, eax, 22, 0, VER1_0 | VER1_5 | VER2_0); //HRESET EXP_CPUID_RES_BITS(0x7, 0x1, eax, 23, 31, VER1_0); //Reserved EXP_CPUID_RES_BITS(0x7, 0x1, eax, 23, 25, VER1_5 | VER2_0); //Reserved @@ -306,8 +304,7 @@ void initial_cpuid(void) EXP_CPUID_RES_BITS(0x7, 0x1, ecx, 0, 31, VER1_0 | VER1_5 | VER2_0); //Reserved /* CPUID(0x7, 0x1).EDX */ -//TODO: big change here. -// EXP_CPUID_RES_BITS(0x7, 0x1, edx, 0, 31, VER2_0); //Reserved + EXP_CPUID_RES_BITS(0x7, 0x1, edx, 0, 31, VER2_0); //Reserved EXP_CPUID_BIT(0x7, 0x1, edx, 4, 1, VER1_5); EXP_CPUID_BIT(0x7, 0x1, edx, 5, 1, VER1_5); @@ -335,8 +332,7 @@ void initial_cpuid(void) /* CPUID(0xa, 0x0).EDX */ EXP_CPUID_RES_BITS(0xa, 0x0, edx, 13, 14, VER1_5 | VER2_0); //Reserved -//TODO: Need check Attributes & Native PERFMON -// EXP_CPUID_BIT(0xa, 0x0, edx, 15, 1, VER1_5 | VER2_0); //AnyThread Deprecation + EXP_CPUID_BIT(0xa, 0x0, edx, 15, 1, VER1_5 | VER2_0); //AnyThread Deprecation EXP_CPUID_RES_BITS(0xa, 0x0, edx, 16, 31, VER1_5 | VER2_0); //Reserved /* CPUID(0xd, 0x0).EAX */ diff --git a/BM/tdx-compliance/tdx-compliance-msr.h b/BM/tdx-compliance/tdx-compliance-msr.h index 9098070b..6ed6ae33 100644 --- a/BM/tdx-compliance/tdx-compliance-msr.h +++ b/BM/tdx-compliance/tdx-compliance-msr.h @@ -468,7 +468,7 @@ struct test_msr msr_cases[] = { DEF_WRITE_MSR_SIZE(RESERVED_XAPIC_0X0800, X86_TRAP_GP, NO_PRE_COND, 0x2, VER1_0 | VER1_5 | VER2_0), /* according to MSR Index & Name, Ihis is a Guest behavior. */ DEF_READ_MSR(IA32_X2APIC_APICID, NO_EXCP, NO_PRE_COND, VER1_5 | VER2_0), - DEF_WRITE_MSR(IA32_X2APIC_APICID, X86_TRAP_GP, NO_PRE_COND, VER1_5 | VER2_0), + DEF_WRITE_MSR(IA32_X2APIC_APICID, X86_TRAP_VE, NO_PRE_COND, VER1_5 | VER2_0), /* according to MSR Index & Name, Ihis is a Guest behavior. */ DEF_READ_MSR(IA32_X2APIC_VERSION, NO_EXCP, NO_PRE_COND, VER1_5 | VER2_0), DEF_WRITE_MSR(IA32_X2APIC_VERSION, X86_TRAP_VE, NO_PRE_COND, VER1_5 | VER2_0), diff --git a/BM/tdx-compliance/tdx-compliance.c b/BM/tdx-compliance/tdx-compliance.c index a58e297c..06275929 100644 --- a/BM/tdx-compliance/tdx-compliance.c +++ b/BM/tdx-compliance/tdx-compliance.c @@ -4,8 +4,6 @@ #include #include -#include - #include "asm/trapnr.h" #include "tdx-compliance.h" @@ -36,7 +34,6 @@ int spec_version; char case_name[256]; char version_name[32]; char *buf_ret; -bool kretprobe_switch; static struct dentry *f_tdx_tests, *d_tdx; LIST_HEAD(cpuid_list); @@ -61,9 +58,6 @@ LIST_HEAD(cpuid_list); #define OPMASK_CPUID 1 #define OPMASK_CR 2 #define OPMASK_MSR 4 -#define OPMASK_KRETKPROBE 8 -#define OPMASK_UNREGISTER 16 -#define TRIGGER_CPUID 32 #define OPMASK_DUMP 0x800 #define OPMASK_SINGLE 0x8000 @@ -84,7 +78,7 @@ static char *result_str(int ret) return "UNKNOWN"; } -void parse_version(void) +void parse_version(void) { if (strstr(version_name, "1.0")) spec_version = VER1_0; @@ -96,8 +90,7 @@ void parse_version(void) spec_version = (VER1_0 | VER1_5 | VER2_0); } -static char *case_version(int ret) -{ +static char* case_version(int ret) { switch (ret) { case VER1_0: return "1.0"; @@ -110,21 +103,18 @@ static char *case_version(int ret) return ""; } -void parse_input(char *s) +void parse_input(char* s) { memset(case_name, 0, sizeof(case_name)); memset(version_name, 0, sizeof(version_name)); char *space = strchr(s, ' '); - - if (space) { + if (space != NULL) { size_t length_case = space - s; - strncpy(case_name, s, length_case); case_name[length_case] = '\0'; - size_t length_ver = strlen(space + 1); - - strncpy(version_name, space + 1, length_ver); + size_t length_ver = strlen(space+1); + strncpy(version_name, space+1, length_ver); } else { strcpy(case_name, s); strcpy(version_name, "generic"); @@ -233,8 +223,7 @@ static int run_all_msr(void) if (operation & 0x8000 && strcmp(case_name, t->name) != 0) continue; - if (!(spec_version & t->version)) - continue; + if (!(spec_version & t->version)) continue; if (operation & 0x800) { pr_buf("%s %s\n", t->name, case_version(t->version)); @@ -268,7 +257,7 @@ static int check_results_cpuid(struct test_cpuid *t) return 1; /* - * Show the detail that results in the failure, + * Show the detail that resutls in the failure, * CPUID here focus on the fixed bit, not actual cpuid val. */ pr_buf("CPUID: %s_%s\n", t->name, version_name); @@ -304,18 +293,16 @@ static int run_all_cpuid(void) pr_tdx_tests("Testing CPUID...\n"); list_for_each_entry(t, &cpuid_list, list) { + if (operation & 0x8000 && strcmp(case_name, t->name) != 0) continue; - if (!(spec_version & t->version)) - continue; + if (!(spec_version & t->version)) continue; if (operation & 0x800) { pr_buf("%s %s\n", t->name, case_version(t->version)); continue; } - if (kretprobe_switch) - pr_info("leaf:%X subleaf:%X\n", t->leaf, t->subleaf); run_cpuid(t); @@ -324,14 +311,9 @@ static int run_all_cpuid(void) stat_pass++; else if (t->ret == -1) stat_fail++; - if (kretprobe_switch) - pr_info("CPUID output: eax:%X, ebx:%X, ecx:%X, edx:%X\n", - t->regs.eax.val, t->regs.ebx.val, t->regs.ecx.val, t->regs.edx.val); - pr_buf("%d: %s_%s:\t %s\n", - ++stat_total, t->name, version_name, result_str(t->ret)); + pr_buf("%d: %s_%s:\t %s\n", ++stat_total, t->name, version_name, result_str(t->ret)); } - pr_tdx_tests("CPUID test end!\n"); return 0; } @@ -353,7 +335,7 @@ static u64 get_cr4(void) return cr4; } -int _native_write_cr0(u64 val) +int __no_profile _native_write_cr0(u64 val) { int err; @@ -366,7 +348,7 @@ int _native_write_cr0(u64 val) return err; } -int _native_write_cr4(u64 val) +int __no_profile _native_write_cr4(u64 val) { int err; @@ -391,8 +373,7 @@ static int run_all_cr(void) if (operation & 0x8000 && strcmp(case_name, t->name) != 0) continue; - if (!(spec_version & t->version)) - continue; + if (!(spec_version & t->version)) continue; if (operation & 0x800) { pr_buf("%s %s\n", t->name, case_version(t->version)); @@ -423,70 +404,6 @@ static int run_all_cr(void) return 0; } -unsigned int count; -static int ret_handler(struct kretprobe_instance *ri, struct pt_regs *regs) -{ - int retval = regs_return_value(regs); - - count++; - pr_info("handle_cpuid count %d\n", count); - pr_info("handle_cpuid returned %d\n", retval); - if (retval < 0) - pr_info("#GP trigger.\n"); - else - pr_info("#VE trigger.\n"); - - return 0; -} - -static struct kretprobe my_kretprobe = { - .handler = ret_handler, - /* - * Here can modify the detection functions, such as hanlde_cpuid, read_msr, - * write_msr, handle_mmio, handle_io, etc. - * It should be noted that the detected function must be exposed to the kernel, - * that is, the address corresponding to the function needs to be in /proc/kallsyms. - */ - .kp.symbol_name = "handle_cpuid", -}; - -static int run_kretprobe(void) -{ - // Register the kretprobe. - int ret; - - ret = register_kretprobe(&my_kretprobe); - if (ret < 0) { - pr_err("register_kprobe failed, returned %d\n", ret); - return ret; - } - kretprobe_switch = true; - pr_info("Detect the return value of the %s.\n", my_kretprobe.kp.symbol_name); - pr_info("Planted kprobe at %p\n", my_kretprobe.kp.addr); - - return 0; -} - -static int unregister(void) -{ - // Unregister the kretprobe. - unregister_kretprobe(&my_kretprobe); - kretprobe_switch = false; - pr_info("kprobe at %p unregistered. Please rmmod tdx_compliance. \n", my_kretprobe.kp.addr); - return 0; -} - -static int trigger_cpuid(unsigned int *A, unsigned int *B, unsigned int *C, unsigned int *D) -{ - pr_info("CPUID leaf:%X, subleaf:%X\n", *A, *C); - __asm__ volatile("cpuid" - : "=a" (*A), "=b" (*B), "=c" (*C), "=d" (*D) - : "a" (*A), "c"(*C) - :); - pr_info("CPUID output: eax:%X, ebx:%X, ecx:%X, edx:%X\n", *A, *B, *C, *D); - return 0; -} - static ssize_t tdx_tests_proc_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) @@ -500,7 +417,6 @@ tdx_tests_proc_write(struct file *file, size_t count, loff_t *f_pos) { char *str_input; - str_input = kzalloc((count + 1), GFP_KERNEL); if (!str_input) @@ -516,22 +432,16 @@ tdx_tests_proc_write(struct file *file, parse_input(str_input); - if (strncmp(case_name, "cpuid", 5) == 0) + if (strstr(case_name, "cpuid")) operation |= OPMASK_CPUID; - else if (strncmp(case_name, "cr", 2) == 0) + else if (strstr(case_name, "cr")) operation |= OPMASK_CR; - else if (strncmp(case_name, "msr", 3) == 0) + else if (strstr(case_name, "msr")) operation |= OPMASK_MSR; - else if (strncmp(case_name, "all", 3) == 0) + else if (strstr(case_name, "all")) operation |= OPMASK_CPUID | OPMASK_CR | OPMASK_MSR; - else if (strncmp(case_name, "list", 4) == 0) + else if (strstr(case_name, "list")) operation |= OPMASK_DUMP | OPMASK_CPUID | OPMASK_CR | OPMASK_MSR; - else if (strncmp(case_name, "kretprobe", 9) == 0) - operation |= OPMASK_KRETKPROBE; - else if (strncmp(case_name, "unregister", 10) == 0) - operation |= OPMASK_UNREGISTER; - else if (strncmp(case_name, "trigger_cpuid", 13) == 0) - operation |= TRIGGER_CPUID; else operation |= OPMASK_SINGLE | OPMASK_CPUID | OPMASK_CR | OPMASK_MSR; @@ -548,24 +458,11 @@ tdx_tests_proc_write(struct file *file, run_all_cr(); if (operation & OPMASK_MSR) run_all_msr(); - if (operation & OPMASK_KRETKPROBE) - run_kretprobe(); - if (operation & OPMASK_UNREGISTER) - unregister(); - if (operation & TRIGGER_CPUID) - { - unsigned int A, B, C, D; - - if (sscanf(version_name, "%x %x %x %x", &A, &B, &C, &D) == 4) - trigger_cpuid(&A, &B, &C, &D); - else - pr_info("Error parsing input string.\n"); - } if (!(operation & OPMASK_DUMP)) pr_buf("Total:%d, PASS:%d, FAIL:%d, SKIP:%d\n", - stat_total, stat_pass, stat_fail, - stat_total - stat_pass - stat_fail); + stat_total, stat_pass, stat_fail, + stat_total - stat_pass - stat_fail); kfree(str_input); operation = 0; @@ -615,7 +512,6 @@ static void __exit tdx_tests_exit(void) } kfree(buf_ret); debugfs_remove_recursive(d_tdx); - pr_info("The tdx_compliance module has been removed.\n"); } module_init(tdx_tests_init); diff --git a/BM/tdx-compliance/tdx-compliance.h b/BM/tdx-compliance/tdx-compliance.h index d339967e..100b69c1 100644 --- a/BM/tdx-compliance/tdx-compliance.h +++ b/BM/tdx-compliance/tdx-compliance.h @@ -96,10 +96,6 @@ int __no_profile _native_write_cr0(u64 val); int __no_profile _native_write_cr4(u64 val); static int write_msr_native(struct test_msr *c); static int read_msr_native(struct test_msr *c); -void initial_cpuid(void); -void parse_version(void); -void parse_input(char* s); -int check_results_cr(struct test_cr *t); u64 cur_cr4, cur_cr0; extern struct list_head cpuid_list; diff --git a/BM/tdx-compliance/testallcase.sh b/BM/tdx-compliance/testallcase.sh old mode 100755 new mode 100644 diff --git a/BM/tdx-compliance/tests-trigger-cpuid.sh b/BM/tdx-compliance/tests-trigger-cpuid.sh deleted file mode 100755 index cf41455e..00000000 --- a/BM/tdx-compliance/tests-trigger-cpuid.sh +++ /dev/null @@ -1,10 +0,0 @@ -##!/bin/bash -# Some examples on how to trigger the cpuid and capture #VE. -# Register the kretprobe. -echo kretprobe > /sys/kernel/debug/tdx/tdx-tests - -# Trigger the cpuid and capture #VE. The captured information is printed in dmesg. -echo trigger_cpuid 0x1f 0x0 0x0 0x0 > /sys/kernel/debug/tdx/tdx-tests - -# Unregister the kretprobe. -echo unregister > /sys/kernel/debug/tdx/tdx-tests diff --git a/BM/tdx-osv-sanity/2.1.1.4-tests b/BM/tdx-osv-sanity/2.1.1.4-tests old mode 100644 new mode 100755 diff --git a/BM/thermal/tests b/BM/thermal/tests old mode 100644 new mode 100755 diff --git a/BM/tools/pcie/pcie_check.c b/BM/tools/pcie/pcie_check.c index 51dad299..06b13618 100644 --- a/BM/tools/pcie/pcie_check.c +++ b/BM/tools/pcie/pcie_check.c @@ -261,7 +261,7 @@ void speed_show(u8 speed) void linkwidth(u8 width) { printf("\tLink Capabilities Register(0x0c bit9:4) width:%02x - ", width); - if (width > 0 && width < 17 && (width & (width - 1)) == 0) + if (width > 0 && width < 17 && (width & width - 1) == 0) printf("x%d\n", width); else printf("reserved\n"); @@ -511,7 +511,8 @@ int scan_pci(void) u32 bus, dev, fun; // Must 32bit for data check! u32 *ptrdata = malloc(sizeof(unsigned long) * 4096); - int fd; + u8 nextpoint; + int fd, result; fd = open("/dev/mem", O_RDWR); diff --git a/BM/topology/cpu_topology.sh b/BM/topology/cpu_topology.sh index 4fc057cc..d568b71f 100755 --- a/BM/topology/cpu_topology.sh +++ b/BM/topology/cpu_topology.sh @@ -14,8 +14,6 @@ LL3_VALUE="" DIE_VALUE="" SNC_VALUE="" LL3_PER_SOCKET="" -CXL_DEVICE="" -CXL_MEM="" : "${CASE_NAME:=""}" @@ -27,12 +25,6 @@ usage() { __EOF } -CXL_DEVICE=$(lspci | grep CXL 2>&1) -[[ -n "$CXL_DEVICE" ]] && test_print_trc "CXL device is available." - -CXL_MEM=$(grep CXL /proc/iomem 2>&1) -[[ -n "$CXL_MEM" ]] && test_print_trc "CXL memory is available." - # cpuid tool is required to run cases if which cpuid 1>/dev/null 2>&1; then cpuid 1>/dev/null || block_test "Failed to run cpuid tool, @@ -233,8 +225,6 @@ socket_num() { [[ $numa_num -eq $snc_enabled_pkg_num_two ]] || [[ $numa_num -eq $snc_enabled_pkg_num_three ]] then test_print_trc "SNC is enabled, sockets and NUMA Nodes number is expected." - elif [[ -n "$CXL_DEVICE" ]] && [[ -n "$CXL_MEM" ]]; then - test_print_trc "CXL device is available, sockets and NUMA Nodes number is expected." else die "socket number is not aligned between lspci and sysfs" fi diff --git a/BM/tpm/.gitignore b/BM/tpm/.gitignore deleted file mode 100644 index d9d719b4..00000000 --- a/BM/tpm/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -__pycache__ -*.log diff --git a/BM/tpm/README.md b/BM/tpm/README.md deleted file mode 100644 index 98cbc619..00000000 --- a/BM/tpm/README.md +++ /dev/null @@ -1,61 +0,0 @@ -# Trust Platform Module - -## Description -Trust Platform Module(TPM) is a physical or embedded security technology -(microcontroller) that resides on a computer's motherboard or in its processor. -TPMs use cryptography to help securely store essential and critical information -on PCs to enable platform authentication. - -The Intel® PTT is an integrated TPM that adheres to the 2.0 specifications -and offers the same capabilities of a discrete TPM, only it resides in the -system’s firmware, thus removing the need for dedicated processing or memory -resources. - -TPM2 smoke test: test_smoke.sh -``` -# python3 -m unittest -v tpm2_tests.SmokeTest -test_read_partial_overwrite (tpm2_tests.SmokeTest) ... ok -test_read_partial_resp (tpm2_tests.SmokeTest) ... ok -test_seal_with_auth (tpm2_tests.SmokeTest) ... ok -test_seal_with_policy (tpm2_tests.SmokeTest) ... ok -test_seal_with_too_long_auth (tpm2_tests.SmokeTest) ... ok -test_send_two_cmds (tpm2_tests.SmokeTest) ... ok -test_too_short_cmd (tpm2_tests.SmokeTest) ... ok -test_unseal_with_wrong_auth (tpm2_tests.SmokeTest) ... ok -test_unseal_with_wrong_policy (tpm2_tests.SmokeTest) ... ok - ----------------------------------------------------------------------- -Ran 9 tests in 293.561s - -OK -``` - -TPM2 space content test: test_space.sh -``` -# python3 -m unittest -v tpm2_tests.SpaceTest -test_flush_context (tpm2_tests.SpaceTest) ... ok -test_get_handles (tpm2_tests.SpaceTest) ... ok -test_invalid_cc (tpm2_tests.SpaceTest) ... ok -test_make_two_spaces (tpm2_tests.SpaceTest) ... ok - ----------------------------------------------------------------------- -Ran 4 tests in 261.409s - -OK -``` - - -TPM2 sync test: test_async.sh -``` -# python3 -m unittest -v tpm2_tests.AsyncTest -test_async (tpm2_tests.AsyncTest) ... ok -test_flush_invalid_context (tpm2_tests.AsyncTest) ... ok - ----------------------------------------------------------------------- -Ran 2 tests in 0.004s - -OK -``` - -## Expected result -All test results should show pass, no fail. diff --git a/BM/tpm/test_async.sh b/BM/tpm/test_async.sh deleted file mode 100755 index 2209dff5..00000000 --- a/BM/tpm/test_async.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) - -# Kselftest framework requirement - SKIP code is 4. -ksft_skip=4 - -[ -e /dev/tpm0 ] || exit $ksft_skip -[ -e /dev/tpmrm0 ] || exit $ksft_skip - -# shellcheck disable=SC3028,SC3054 -TPM_ROOT=$(realpath "$(dirname "${BASH_SOURCE[0]}")") -export PYTHONPATH="$TPM_ROOT" -python3 -m unittest -v tpm2_tests.AsyncTest diff --git a/BM/tpm/test_smoke.sh b/BM/tpm/test_smoke.sh deleted file mode 100755 index ab4436e0..00000000 --- a/BM/tpm/test_smoke.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) - -# Kselftest framework requirement - SKIP code is 4. -ksft_skip=4 - -[ -e /dev/tpm0 ] || exit $ksft_skip - -# shellcheck disable=SC3028,SC3054 -TPM_ROOT=$(realpath "$(dirname "${BASH_SOURCE[0]}")") -export PYTHONPATH="$TPM_ROOT" -python3 -m unittest -v tpm2_tests.SmokeTest diff --git a/BM/tpm/test_space.sh b/BM/tpm/test_space.sh deleted file mode 100755 index 0f21ea6b..00000000 --- a/BM/tpm/test_space.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) - -# Kselftest framework requirement - SKIP code is 4. -ksft_skip=4 - -[ -e /dev/tpmrm0 ] || exit $ksft_skip - -# shellcheck disable=SC3028,SC3054 -TPM_ROOT=$(realpath "$(dirname "${BASH_SOURCE[0]}")") -export PYTHONPATH="$TPM_ROOT" -python3 -m unittest -v tpm2_tests.SpaceTest diff --git a/BM/tpm/tests b/BM/tpm/tests deleted file mode 100644 index 957b5810..00000000 --- a/BM/tpm/tests +++ /dev/null @@ -1,9 +0,0 @@ -# This file collects Intel TPM(Trust Platform Module) tests on -# Intel® Architecture-based platforms. -# @hw_dep: [ -e "/dev/tpm0" ] @ No /dev/tpm0 device node to support TPM -# @other_dep: general_test.sh -t kconfig -k "CONFIG_TCG_TPM=y" @ No TPM kconfig CONFIG_TCG_TPM=y -# @other_warn: [ -e "/dev/tpmrm0" ] @ No /dev/tpmrm0 device node test_async.sh will skip with return 4 - -test_smoke.sh -test_space.sh -test_async.sh diff --git a/BM/tpm/tpm2.py b/BM/tpm/tpm2.py deleted file mode 100755 index c8ef5418..00000000 --- a/BM/tpm/tpm2.py +++ /dev/null @@ -1,755 +0,0 @@ -#!/usr/bin/env python3 -# SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) -# -# It's from Linux Kernel v6.10 tools/testing/selftests/tpm2 -# -# Original Author: Jarkko Sakkinen -# - -import hashlib -import os -import socket -import struct -import sys -import unittest -import fcntl -import select - -TPM2_ST_NO_SESSIONS = 0x8001 -TPM2_ST_SESSIONS = 0x8002 - -TPM2_CC_FIRST = 0x01FF - -TPM2_CC_CREATE_PRIMARY = 0x0131 -TPM2_CC_DICTIONARY_ATTACK_LOCK_RESET = 0x0139 -TPM2_CC_CREATE = 0x0153 -TPM2_CC_LOAD = 0x0157 -TPM2_CC_UNSEAL = 0x015E -TPM2_CC_FLUSH_CONTEXT = 0x0165 -TPM2_CC_START_AUTH_SESSION = 0x0176 -TPM2_CC_GET_CAPABILITY = 0x017A -TPM2_CC_GET_RANDOM = 0x017B -TPM2_CC_PCR_READ = 0x017E -TPM2_CC_POLICY_PCR = 0x017F -TPM2_CC_PCR_EXTEND = 0x0182 -TPM2_CC_POLICY_PASSWORD = 0x018C -TPM2_CC_POLICY_GET_DIGEST = 0x0189 - -TPM2_SE_POLICY = 0x01 -TPM2_SE_TRIAL = 0x03 - -TPM2_ALG_RSA = 0x0001 -TPM2_ALG_SHA1 = 0x0004 -TPM2_ALG_AES = 0x0006 -TPM2_ALG_KEYEDHASH = 0x0008 -TPM2_ALG_SHA256 = 0x000B -TPM2_ALG_NULL = 0x0010 -TPM2_ALG_CBC = 0x0042 -TPM2_ALG_CFB = 0x0043 - -TPM2_RH_OWNER = 0x40000001 -TPM2_RH_NULL = 0x40000007 -TPM2_RH_LOCKOUT = 0x4000000A -TPM2_RS_PW = 0x40000009 - -TPM2_RC_SIZE = 0x01D5 -TPM2_RC_AUTH_FAIL = 0x098E -TPM2_RC_POLICY_FAIL = 0x099D -TPM2_RC_COMMAND_CODE = 0x0143 - -TSS2_RC_LAYER_SHIFT = 16 -TSS2_RESMGR_TPM_RC_LAYER = (11 << TSS2_RC_LAYER_SHIFT) - -TPM2_CAP_HANDLES = 0x00000001 -TPM2_CAP_COMMANDS = 0x00000002 -TPM2_CAP_PCRS = 0x00000005 -TPM2_CAP_TPM_PROPERTIES = 0x00000006 - -TPM2_PT_FIXED = 0x100 -TPM2_PT_TOTAL_COMMANDS = TPM2_PT_FIXED + 41 - -HR_SHIFT = 24 -HR_LOADED_SESSION = 0x02000000 -HR_TRANSIENT = 0x80000000 - -SHA1_DIGEST_SIZE = 20 -SHA256_DIGEST_SIZE = 32 - -TPM2_VER0_ERRORS = { - 0x000: "TPM_RC_SUCCESS", - 0x030: "TPM_RC_BAD_TAG", -} - -TPM2_VER1_ERRORS = { - 0x000: "TPM_RC_FAILURE", - 0x001: "TPM_RC_FAILURE", - 0x003: "TPM_RC_SEQUENCE", - 0x00B: "TPM_RC_PRIVATE", - 0x019: "TPM_RC_HMAC", - 0x020: "TPM_RC_DISABLED", - 0x021: "TPM_RC_EXCLUSIVE", - 0x024: "TPM_RC_AUTH_TYPE", - 0x025: "TPM_RC_AUTH_MISSING", - 0x026: "TPM_RC_POLICY", - 0x027: "TPM_RC_PCR", - 0x028: "TPM_RC_PCR_CHANGED", - 0x02D: "TPM_RC_UPGRADE", - 0x02E: "TPM_RC_TOO_MANY_CONTEXTS", - 0x02F: "TPM_RC_AUTH_UNAVAILABLE", - 0x030: "TPM_RC_REBOOT", - 0x031: "TPM_RC_UNBALANCED", - 0x042: "TPM_RC_COMMAND_SIZE", - 0x043: "TPM_RC_COMMAND_CODE", - 0x044: "TPM_RC_AUTHSIZE", - 0x045: "TPM_RC_AUTH_CONTEXT", - 0x046: "TPM_RC_NV_RANGE", - 0x047: "TPM_RC_NV_SIZE", - 0x048: "TPM_RC_NV_LOCKED", - 0x049: "TPM_RC_NV_AUTHORIZATION", - 0x04A: "TPM_RC_NV_UNINITIALIZED", - 0x04B: "TPM_RC_NV_SPACE", - 0x04C: "TPM_RC_NV_DEFINED", - 0x050: "TPM_RC_BAD_CONTEXT", - 0x051: "TPM_RC_CPHASH", - 0x052: "TPM_RC_PARENT", - 0x053: "TPM_RC_NEEDS_TEST", - 0x054: "TPM_RC_NO_RESULT", - 0x055: "TPM_RC_SENSITIVE", - 0x07F: "RC_MAX_FM0", -} - -TPM2_FMT1_ERRORS = { - 0x001: "TPM_RC_ASYMMETRIC", - 0x002: "TPM_RC_ATTRIBUTES", - 0x003: "TPM_RC_HASH", - 0x004: "TPM_RC_VALUE", - 0x005: "TPM_RC_HIERARCHY", - 0x007: "TPM_RC_KEY_SIZE", - 0x008: "TPM_RC_MGF", - 0x009: "TPM_RC_MODE", - 0x00A: "TPM_RC_TYPE", - 0x00B: "TPM_RC_HANDLE", - 0x00C: "TPM_RC_KDF", - 0x00D: "TPM_RC_RANGE", - 0x00E: "TPM_RC_AUTH_FAIL", - 0x00F: "TPM_RC_NONCE", - 0x010: "TPM_RC_PP", - 0x012: "TPM_RC_SCHEME", - 0x015: "TPM_RC_SIZE", - 0x016: "TPM_RC_SYMMETRIC", - 0x017: "TPM_RC_TAG", - 0x018: "TPM_RC_SELECTOR", - 0x01A: "TPM_RC_INSUFFICIENT", - 0x01B: "TPM_RC_SIGNATURE", - 0x01C: "TPM_RC_KEY", - 0x01D: "TPM_RC_POLICY_FAIL", - 0x01F: "TPM_RC_INTEGRITY", - 0x020: "TPM_RC_TICKET", - 0x021: "TPM_RC_RESERVED_BITS", - 0x022: "TPM_RC_BAD_AUTH", - 0x023: "TPM_RC_EXPIRED", - 0x024: "TPM_RC_POLICY_CC", - 0x025: "TPM_RC_BINDING", - 0x026: "TPM_RC_CURVE", - 0x027: "TPM_RC_ECC_POINT", -} - -TPM2_WARN_ERRORS = { - 0x001: "TPM_RC_CONTEXT_GAP", - 0x002: "TPM_RC_OBJECT_MEMORY", - 0x003: "TPM_RC_SESSION_MEMORY", - 0x004: "TPM_RC_MEMORY", - 0x005: "TPM_RC_SESSION_HANDLES", - 0x006: "TPM_RC_OBJECT_HANDLES", - 0x007: "TPM_RC_LOCALITY", - 0x008: "TPM_RC_YIELDED", - 0x009: "TPM_RC_CANCELED", - 0x00A: "TPM_RC_TESTING", - 0x010: "TPM_RC_REFERENCE_H0", - 0x011: "TPM_RC_REFERENCE_H1", - 0x012: "TPM_RC_REFERENCE_H2", - 0x013: "TPM_RC_REFERENCE_H3", - 0x014: "TPM_RC_REFERENCE_H4", - 0x015: "TPM_RC_REFERENCE_H5", - 0x016: "TPM_RC_REFERENCE_H6", - 0x018: "TPM_RC_REFERENCE_S0", - 0x019: "TPM_RC_REFERENCE_S1", - 0x01A: "TPM_RC_REFERENCE_S2", - 0x01B: "TPM_RC_REFERENCE_S3", - 0x01C: "TPM_RC_REFERENCE_S4", - 0x01D: "TPM_RC_REFERENCE_S5", - 0x01E: "TPM_RC_REFERENCE_S6", - 0x020: "TPM_RC_NV_RATE", - 0x021: "TPM_RC_LOCKOUT", - 0x022: "TPM_RC_RETRY", - 0x023: "TPM_RC_NV_UNAVAILABLE", - 0x7F: "TPM_RC_NOT_USED", -} - -RC_VER1 = 0x100 -RC_FMT1 = 0x080 -RC_WARN = 0x900 - -ALG_DIGEST_SIZE_MAP = { - TPM2_ALG_SHA1: SHA1_DIGEST_SIZE, - TPM2_ALG_SHA256: SHA256_DIGEST_SIZE, -} - -ALG_HASH_FUNCTION_MAP = { - TPM2_ALG_SHA1: hashlib.sha1, - TPM2_ALG_SHA256: hashlib.sha256 -} - -NAME_ALG_MAP = { - "sha1": TPM2_ALG_SHA1, - "sha256": TPM2_ALG_SHA256, -} - - -class UnknownAlgorithmIdError(Exception): - def __init__(self, alg): - self.alg = alg - - def __str__(self): - return '0x%0x' % (alg) - - -class UnknownAlgorithmNameError(Exception): - def __init__(self, name): - self.name = name - - def __str__(self): - return name - - -class UnknownPCRBankError(Exception): - def __init__(self, alg): - self.alg = alg - - def __str__(self): - return '0x%0x' % (alg) - - -class ProtocolError(Exception): - def __init__(self, cc, rc): - self.cc = cc - self.rc = rc - - if (rc & RC_FMT1) == RC_FMT1: - self.name = TPM2_FMT1_ERRORS.get(rc & 0x3f, "TPM_RC_UNKNOWN") - elif (rc & RC_WARN) == RC_WARN: - self.name = TPM2_WARN_ERRORS.get(rc & 0x7f, "TPM_RC_UNKNOWN") - elif (rc & RC_VER1) == RC_VER1: - self.name = TPM2_VER1_ERRORS.get(rc & 0x7f, "TPM_RC_UNKNOWN") - else: - self.name = TPM2_VER0_ERRORS.get(rc & 0x7f, "TPM_RC_UNKNOWN") - - def __str__(self): - if self.cc: - return '%s: cc=0x%08x, rc=0x%08x' % (self.name, self.cc, self.rc) - else: - return '%s: rc=0x%08x' % (self.name, self.rc) - - -class AuthCommand(object): - """TPMS_AUTH_COMMAND""" - - def __init__(self, session_handle=TPM2_RS_PW, nonce=bytes(), - session_attributes=0, hmac=bytes()): - self.session_handle = session_handle - self.nonce = nonce - self.session_attributes = session_attributes - self.hmac = hmac - - def __bytes__(self): - fmt = '>I H%us B H%us' % (len(self.nonce), len(self.hmac)) - return struct.pack(fmt, self.session_handle, len(self.nonce), - self.nonce, self.session_attributes, len(self.hmac), - self.hmac) - - def __len__(self): - fmt = '>I H%us B H%us' % (len(self.nonce), len(self.hmac)) - return struct.calcsize(fmt) - - -class SensitiveCreate(object): - """TPMS_SENSITIVE_CREATE""" - - def __init__(self, user_auth=bytes(), data=bytes()): - self.user_auth = user_auth - self.data = data - - def __bytes__(self): - fmt = '>H%us H%us' % (len(self.user_auth), len(self.data)) - return struct.pack(fmt, len(self.user_auth), self.user_auth, - len(self.data), self.data) - - def __len__(self): - fmt = '>H%us H%us' % (len(self.user_auth), len(self.data)) - return struct.calcsize(fmt) - - -class Public(object): - """TPMT_PUBLIC""" - - FIXED_TPM = (1 << 1) - FIXED_PARENT = (1 << 4) - SENSITIVE_DATA_ORIGIN = (1 << 5) - USER_WITH_AUTH = (1 << 6) - RESTRICTED = (1 << 16) - DECRYPT = (1 << 17) - - def __fmt(self): - return '>HHIH%us%usH%us' % \ - (len(self.auth_policy), len(self.parameters), len(self.unique)) - - def __init__(self, object_type, name_alg, object_attributes, - auth_policy=bytes(), parameters=bytes(), - unique=bytes()): - self.object_type = object_type - self.name_alg = name_alg - self.object_attributes = object_attributes - self.auth_policy = auth_policy - self.parameters = parameters - self.unique = unique - - def __bytes__(self): - return struct.pack(self.__fmt(), - self.object_type, - self.name_alg, - self.object_attributes, - len(self.auth_policy), - self.auth_policy, - self.parameters, - len(self.unique), - self.unique) - - def __len__(self): - return struct.calcsize(self.__fmt()) - - -def get_digest_size(alg): - ds = ALG_DIGEST_SIZE_MAP.get(alg) - if not ds: - raise UnknownAlgorithmIdError(alg) - return ds - - -def get_hash_function(alg): - f = ALG_HASH_FUNCTION_MAP.get(alg) - if not f: - raise UnknownAlgorithmIdError(alg) - return f - - -def get_algorithm(name): - alg = NAME_ALG_MAP.get(name) - if not alg: - raise UnknownAlgorithmNameError(name) - return alg - - -def hex_dump(d): - d = [format(x, '02x') for x in d] - d = [d[i: i + 16] for i in range(0, len(d), 16)] - d = [' '.join(x) for x in d] - d = os.linesep.join(d) - - return d - -class Client: - FLAG_DEBUG = 0x01 - FLAG_SPACE = 0x02 - FLAG_NONBLOCK = 0x04 - TPM_IOC_NEW_SPACE = 0xa200 - - def __init__(self, flags = 0): - self.flags = flags - - if (self.flags & Client.FLAG_SPACE) == 0: - self.tpm = open('/dev/tpm0', 'r+b', buffering=0) - else: - self.tpm = open('/dev/tpmrm0', 'r+b', buffering=0) - - if (self.flags & Client.FLAG_NONBLOCK): - flags = fcntl.fcntl(self.tpm, fcntl.F_GETFL) - flags |= os.O_NONBLOCK - fcntl.fcntl(self.tpm, fcntl.F_SETFL, flags) - self.tpm_poll = select.poll() - - def __del__(self): - if self.tpm: - self.tpm.close() - - def close(self): - self.tpm.close() - - def send_cmd(self, cmd): - self.tpm.write(cmd) - - if (self.flags & Client.FLAG_NONBLOCK): - self.tpm_poll.register(self.tpm, select.POLLIN) - self.tpm_poll.poll(10000) - - rsp = self.tpm.read() - - if (self.flags & Client.FLAG_NONBLOCK): - self.tpm_poll.unregister(self.tpm) - - if (self.flags & Client.FLAG_DEBUG) != 0: - sys.stderr.write('cmd' + os.linesep) - sys.stderr.write(hex_dump(cmd) + os.linesep) - sys.stderr.write('rsp' + os.linesep) - sys.stderr.write(hex_dump(rsp) + os.linesep) - - rc = struct.unpack('>I', rsp[6:10])[0] - if rc != 0: - cc = struct.unpack('>I', cmd[6:10])[0] - raise ProtocolError(cc, rc) - - return rsp - - def read_pcr(self, i, bank_alg = TPM2_ALG_SHA1): - pcrsel_len = max((i >> 3) + 1, 3) - pcrsel = [0] * pcrsel_len - pcrsel[i >> 3] = 1 << (i & 7) - pcrsel = ''.join(map(chr, pcrsel)).encode() - - fmt = '>HII IHB%us' % (pcrsel_len) - cmd = struct.pack(fmt, - TPM2_ST_NO_SESSIONS, - struct.calcsize(fmt), - TPM2_CC_PCR_READ, - 1, - bank_alg, - pcrsel_len, pcrsel) - - rsp = self.send_cmd(cmd) - - pcr_update_cnt, pcr_select_cnt = struct.unpack('>II', rsp[10:18]) - assert pcr_select_cnt == 1 - rsp = rsp[18:] - - alg2, pcrsel_len2 = struct.unpack('>HB', rsp[:3]) - assert bank_alg == alg2 and pcrsel_len == pcrsel_len2 - rsp = rsp[3 + pcrsel_len:] - - digest_cnt = struct.unpack('>I', rsp[:4])[0] - if digest_cnt == 0: - return None - rsp = rsp[6:] - - return rsp - - def extend_pcr(self, i, dig, bank_alg = TPM2_ALG_SHA1): - ds = get_digest_size(bank_alg) - assert(ds == len(dig)) - - auth_cmd = AuthCommand() - - fmt = '>HII I I%us IH%us' % (len(auth_cmd), ds) - cmd = struct.pack( - fmt, - TPM2_ST_SESSIONS, - struct.calcsize(fmt), - TPM2_CC_PCR_EXTEND, - i, - len(auth_cmd), - bytes(auth_cmd), - 1, bank_alg, dig) - - self.send_cmd(cmd) - - def start_auth_session(self, session_type, name_alg = TPM2_ALG_SHA1): - fmt = '>HII IIH16sHBHH' - cmd = struct.pack(fmt, - TPM2_ST_NO_SESSIONS, - struct.calcsize(fmt), - TPM2_CC_START_AUTH_SESSION, - TPM2_RH_NULL, - TPM2_RH_NULL, - 16, - ('\0' * 16).encode(), - 0, - session_type, - TPM2_ALG_NULL, - name_alg) - - return struct.unpack('>I', self.send_cmd(cmd)[10:14])[0] - - def __calc_pcr_digest(self, pcrs, bank_alg = TPM2_ALG_SHA1, - digest_alg = TPM2_ALG_SHA1): - x = [] - f = get_hash_function(digest_alg) - - for i in pcrs: - pcr = self.read_pcr(i, bank_alg) - if pcr is None: - return None - x += pcr - - return f(bytearray(x)).digest() - - def policy_pcr(self, handle, pcrs, bank_alg = TPM2_ALG_SHA1, - name_alg = TPM2_ALG_SHA1): - ds = get_digest_size(name_alg) - dig = self.__calc_pcr_digest(pcrs, bank_alg, name_alg) - if not dig: - raise UnknownPCRBankError(bank_alg) - - pcrsel_len = max((max(pcrs) >> 3) + 1, 3) - pcrsel = [0] * pcrsel_len - for i in pcrs: - pcrsel[i >> 3] |= 1 << (i & 7) - pcrsel = ''.join(map(chr, pcrsel)).encode() - - fmt = '>HII IH%usIHB3s' % ds - cmd = struct.pack(fmt, - TPM2_ST_NO_SESSIONS, - struct.calcsize(fmt), - TPM2_CC_POLICY_PCR, - handle, - len(dig), - bytes(dig), - 1, - bank_alg, - pcrsel_len, pcrsel) - - self.send_cmd(cmd) - - def policy_password(self, handle): - fmt = '>HII I' - cmd = struct.pack(fmt, - TPM2_ST_NO_SESSIONS, - struct.calcsize(fmt), - TPM2_CC_POLICY_PASSWORD, - handle) - - self.send_cmd(cmd) - - def get_policy_digest(self, handle): - fmt = '>HII I' - cmd = struct.pack(fmt, - TPM2_ST_NO_SESSIONS, - struct.calcsize(fmt), - TPM2_CC_POLICY_GET_DIGEST, - handle) - - return self.send_cmd(cmd)[12:] - - def flush_context(self, handle): - fmt = '>HIII' - cmd = struct.pack(fmt, - TPM2_ST_NO_SESSIONS, - struct.calcsize(fmt), - TPM2_CC_FLUSH_CONTEXT, - handle) - - self.send_cmd(cmd) - - def create_root_key(self, auth_value = bytes()): - attributes = \ - Public.FIXED_TPM | \ - Public.FIXED_PARENT | \ - Public.SENSITIVE_DATA_ORIGIN | \ - Public.USER_WITH_AUTH | \ - Public.RESTRICTED | \ - Public.DECRYPT - - auth_cmd = AuthCommand() - sensitive = SensitiveCreate(user_auth=auth_value) - - public_parms = struct.pack( - '>HHHHHI', - TPM2_ALG_AES, - 128, - TPM2_ALG_CFB, - TPM2_ALG_NULL, - 2048, - 0) - - public = Public( - object_type=TPM2_ALG_RSA, - name_alg=TPM2_ALG_SHA1, - object_attributes=attributes, - parameters=public_parms) - - fmt = '>HIII I%us H%us H%us HI' % \ - (len(auth_cmd), len(sensitive), len(public)) - cmd = struct.pack( - fmt, - TPM2_ST_SESSIONS, - struct.calcsize(fmt), - TPM2_CC_CREATE_PRIMARY, - TPM2_RH_OWNER, - len(auth_cmd), - bytes(auth_cmd), - len(sensitive), - bytes(sensitive), - len(public), - bytes(public), - 0, 0) - - return struct.unpack('>I', self.send_cmd(cmd)[10:14])[0] - - def seal(self, parent_key, data, auth_value, policy_dig, - name_alg = TPM2_ALG_SHA1): - ds = get_digest_size(name_alg) - assert(not policy_dig or ds == len(policy_dig)) - - attributes = 0 - if not policy_dig: - attributes |= Public.USER_WITH_AUTH - policy_dig = bytes() - - auth_cmd = AuthCommand() - sensitive = SensitiveCreate(user_auth=auth_value, data=data) - - public = Public( - object_type=TPM2_ALG_KEYEDHASH, - name_alg=name_alg, - object_attributes=attributes, - auth_policy=policy_dig, - parameters=struct.pack('>H', TPM2_ALG_NULL)) - - fmt = '>HIII I%us H%us H%us HI' % \ - (len(auth_cmd), len(sensitive), len(public)) - cmd = struct.pack( - fmt, - TPM2_ST_SESSIONS, - struct.calcsize(fmt), - TPM2_CC_CREATE, - parent_key, - len(auth_cmd), - bytes(auth_cmd), - len(sensitive), - bytes(sensitive), - len(public), - bytes(public), - 0, 0) - - rsp = self.send_cmd(cmd) - - return rsp[14:] - - def unseal(self, parent_key, blob, auth_value, policy_handle): - private_len = struct.unpack('>H', blob[0:2])[0] - public_start = private_len + 2 - public_len = struct.unpack('>H', blob[public_start:public_start + 2])[0] - blob = blob[:private_len + public_len + 4] - - auth_cmd = AuthCommand() - - fmt = '>HII I I%us %us' % (len(auth_cmd), len(blob)) - cmd = struct.pack( - fmt, - TPM2_ST_SESSIONS, - struct.calcsize(fmt), - TPM2_CC_LOAD, - parent_key, - len(auth_cmd), - bytes(auth_cmd), - blob) - - data_handle = struct.unpack('>I', self.send_cmd(cmd)[10:14])[0] - - if policy_handle: - auth_cmd = AuthCommand(session_handle=policy_handle, hmac=auth_value) - else: - auth_cmd = AuthCommand(hmac=auth_value) - - fmt = '>HII I I%us' % (len(auth_cmd)) - cmd = struct.pack( - fmt, - TPM2_ST_SESSIONS, - struct.calcsize(fmt), - TPM2_CC_UNSEAL, - data_handle, - len(auth_cmd), - bytes(auth_cmd)) - - try: - rsp = self.send_cmd(cmd) - finally: - self.flush_context(data_handle) - - data_len = struct.unpack('>I', rsp[10:14])[0] - 2 - - return rsp[16:16 + data_len] - - def reset_da_lock(self): - auth_cmd = AuthCommand() - - fmt = '>HII I I%us' % (len(auth_cmd)) - cmd = struct.pack( - fmt, - TPM2_ST_SESSIONS, - struct.calcsize(fmt), - TPM2_CC_DICTIONARY_ATTACK_LOCK_RESET, - TPM2_RH_LOCKOUT, - len(auth_cmd), - bytes(auth_cmd)) - - self.send_cmd(cmd) - - def __get_cap_cnt(self, cap, pt, cnt): - handles = [] - fmt = '>HII III' - - cmd = struct.pack(fmt, - TPM2_ST_NO_SESSIONS, - struct.calcsize(fmt), - TPM2_CC_GET_CAPABILITY, - cap, pt, cnt) - - rsp = self.send_cmd(cmd)[10:] - more_data, cap, cnt = struct.unpack('>BII', rsp[:9]) - rsp = rsp[9:] - - for i in range(0, cnt): - handle = struct.unpack('>I', rsp[:4])[0] - handles.append(handle) - rsp = rsp[4:] - - return handles, more_data - - def get_cap(self, cap, pt): - handles = [] - - more_data = True - while more_data: - next_handles, more_data = self.__get_cap_cnt(cap, pt, 1) - handles += next_handles - pt += 1 - - return handles - - def get_cap_pcrs(self): - pcr_banks = {} - - fmt = '>HII III' - - cmd = struct.pack(fmt, - TPM2_ST_NO_SESSIONS, - struct.calcsize(fmt), - TPM2_CC_GET_CAPABILITY, - TPM2_CAP_PCRS, 0, 1) - rsp = self.send_cmd(cmd)[10:] - _, _, cnt = struct.unpack('>BII', rsp[:9]) - rsp = rsp[9:] - - # items are TPMS_PCR_SELECTION's - for i in range(0, cnt): - hash, sizeOfSelect = struct.unpack('>HB', rsp[:3]) - rsp = rsp[3:] - - pcrSelect = 0 - if sizeOfSelect > 0: - pcrSelect, = struct.unpack('%ds' % sizeOfSelect, - rsp[:sizeOfSelect]) - rsp = rsp[sizeOfSelect:] - pcrSelect = int.from_bytes(pcrSelect, byteorder='big') - - pcr_banks[hash] = pcrSelect - - return pcr_banks diff --git a/BM/tpm/tpm2_tests.py b/BM/tpm/tpm2_tests.py deleted file mode 100755 index a0e9039a..00000000 --- a/BM/tpm/tpm2_tests.py +++ /dev/null @@ -1,339 +0,0 @@ -#!/usr/bin/env python3 -# SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) -# -# It's from Linux Kernel v6.10 tools/testing/selftests/tpm2 -# -# Original Author: Jarkko Sakkinen -# - -from argparse import ArgumentParser -from argparse import FileType -import os -import sys -import tpm2 -from tpm2 import ProtocolError -import unittest -import logging -import struct - -class SmokeTest(unittest.TestCase): - def setUp(self): - self.client = tpm2.Client() - self.root_key = self.client.create_root_key() - - def tearDown(self): - self.client.flush_context(self.root_key) - self.client.close() - - def test_seal_with_auth(self): - data = ('X' * 64).encode() - auth = ('A' * 15).encode() - - blob = self.client.seal(self.root_key, data, auth, None) - result = self.client.unseal(self.root_key, blob, auth, None) - self.assertEqual(data, result) - - def determine_bank_alg(self, mask): - pcr_banks = self.client.get_cap_pcrs() - for bank_alg, pcrSelection in pcr_banks.items(): - if pcrSelection & mask == mask: - return bank_alg - return None - - def test_seal_with_policy(self): - bank_alg = self.determine_bank_alg(1 << 16) - self.assertIsNotNone(bank_alg) - - handle = self.client.start_auth_session(tpm2.TPM2_SE_TRIAL) - - data = ('X' * 64).encode() - auth = ('A' * 15).encode() - pcrs = [16] - - try: - self.client.policy_pcr(handle, pcrs, bank_alg=bank_alg) - self.client.policy_password(handle) - - policy_dig = self.client.get_policy_digest(handle) - finally: - self.client.flush_context(handle) - - blob = self.client.seal(self.root_key, data, auth, policy_dig) - - handle = self.client.start_auth_session(tpm2.TPM2_SE_POLICY) - - try: - self.client.policy_pcr(handle, pcrs, bank_alg=bank_alg) - self.client.policy_password(handle) - - result = self.client.unseal(self.root_key, blob, auth, handle) - except: - self.client.flush_context(handle) - raise - - self.assertEqual(data, result) - - def test_unseal_with_wrong_auth(self): - data = ('X' * 64).encode() - auth = ('A' * 20).encode() - rc = 0 - - blob = self.client.seal(self.root_key, data, auth, None) - try: - result = self.client.unseal(self.root_key, blob, - auth[:-1] + 'B'.encode(), None) - except ProtocolError as e: - rc = e.rc - - self.assertEqual(rc, tpm2.TPM2_RC_AUTH_FAIL) - - def test_unseal_with_wrong_policy(self): - bank_alg = self.determine_bank_alg(1 << 16 | 1 << 1) - self.assertIsNotNone(bank_alg) - - handle = self.client.start_auth_session(tpm2.TPM2_SE_TRIAL) - - data = ('X' * 64).encode() - auth = ('A' * 17).encode() - pcrs = [16] - - try: - self.client.policy_pcr(handle, pcrs, bank_alg=bank_alg) - self.client.policy_password(handle) - - policy_dig = self.client.get_policy_digest(handle) - finally: - self.client.flush_context(handle) - - blob = self.client.seal(self.root_key, data, auth, policy_dig) - - # Extend first a PCR that is not part of the policy and try to unseal. - # This should succeed. - - ds = tpm2.get_digest_size(bank_alg) - self.client.extend_pcr(1, ('X' * ds).encode(), bank_alg=bank_alg) - - handle = self.client.start_auth_session(tpm2.TPM2_SE_POLICY) - - try: - self.client.policy_pcr(handle, pcrs, bank_alg=bank_alg) - self.client.policy_password(handle) - - result = self.client.unseal(self.root_key, blob, auth, handle) - except: - self.client.flush_context(handle) - raise - - self.assertEqual(data, result) - - # Then, extend a PCR that is part of the policy and try to unseal. - # This should fail. - self.client.extend_pcr(16, ('X' * ds).encode(), bank_alg=bank_alg) - - handle = self.client.start_auth_session(tpm2.TPM2_SE_POLICY) - - rc = 0 - - try: - self.client.policy_pcr(handle, pcrs, bank_alg=bank_alg) - self.client.policy_password(handle) - - result = self.client.unseal(self.root_key, blob, auth, handle) - except ProtocolError as e: - rc = e.rc - self.client.flush_context(handle) - except: - self.client.flush_context(handle) - raise - - self.assertEqual(rc, tpm2.TPM2_RC_POLICY_FAIL) - - def test_seal_with_too_long_auth(self): - ds = tpm2.get_digest_size(tpm2.TPM2_ALG_SHA1) - data = ('X' * 64).encode() - auth = ('A' * (ds + 1)).encode() - - rc = 0 - try: - blob = self.client.seal(self.root_key, data, auth, None) - except ProtocolError as e: - rc = e.rc - - self.assertEqual(rc, tpm2.TPM2_RC_SIZE) - - def test_too_short_cmd(self): - rejected = False - try: - fmt = '>HIII' - cmd = struct.pack(fmt, - tpm2.TPM2_ST_NO_SESSIONS, - struct.calcsize(fmt) + 1, - tpm2.TPM2_CC_FLUSH_CONTEXT, - 0xDEADBEEF) - - self.client.send_cmd(cmd) - except IOError as e: - rejected = True - except: - pass - self.assertEqual(rejected, True) - - def test_read_partial_resp(self): - try: - fmt = '>HIIH' - cmd = struct.pack(fmt, - tpm2.TPM2_ST_NO_SESSIONS, - struct.calcsize(fmt), - tpm2.TPM2_CC_GET_RANDOM, - 0x20) - self.client.tpm.write(cmd) - hdr = self.client.tpm.read(10) - sz = struct.unpack('>I', hdr[2:6])[0] - rsp = self.client.tpm.read() - except: - pass - self.assertEqual(sz, 10 + 2 + 32) - self.assertEqual(len(rsp), 2 + 32) - - def test_read_partial_overwrite(self): - try: - fmt = '>HIIH' - cmd = struct.pack(fmt, - tpm2.TPM2_ST_NO_SESSIONS, - struct.calcsize(fmt), - tpm2.TPM2_CC_GET_RANDOM, - 0x20) - self.client.tpm.write(cmd) - # Read part of the respone - rsp1 = self.client.tpm.read(15) - - # Send a new cmd - self.client.tpm.write(cmd) - - # Read the whole respone - rsp2 = self.client.tpm.read() - except: - pass - self.assertEqual(len(rsp1), 15) - self.assertEqual(len(rsp2), 10 + 2 + 32) - - def test_send_two_cmds(self): - rejected = False - try: - fmt = '>HIIH' - cmd = struct.pack(fmt, - tpm2.TPM2_ST_NO_SESSIONS, - struct.calcsize(fmt), - tpm2.TPM2_CC_GET_RANDOM, - 0x20) - self.client.tpm.write(cmd) - - # expect the second one to raise -EBUSY error - self.client.tpm.write(cmd) - rsp = self.client.tpm.read() - - except IOError as e: - # read the response - rsp = self.client.tpm.read() - rejected = True - pass - except: - pass - self.assertEqual(rejected, True) - -class SpaceTest(unittest.TestCase): - def setUp(self): - logging.basicConfig(filename='SpaceTest.log', level=logging.DEBUG) - - def test_make_two_spaces(self): - log = logging.getLogger(__name__) - log.debug("test_make_two_spaces") - - space1 = tpm2.Client(tpm2.Client.FLAG_SPACE) - root1 = space1.create_root_key() - space2 = tpm2.Client(tpm2.Client.FLAG_SPACE) - root2 = space2.create_root_key() - root3 = space2.create_root_key() - - log.debug("%08x" % (root1)) - log.debug("%08x" % (root2)) - log.debug("%08x" % (root3)) - - def test_flush_context(self): - log = logging.getLogger(__name__) - log.debug("test_flush_context") - - space1 = tpm2.Client(tpm2.Client.FLAG_SPACE) - root1 = space1.create_root_key() - log.debug("%08x" % (root1)) - - space1.flush_context(root1) - - def test_get_handles(self): - log = logging.getLogger(__name__) - log.debug("test_get_handles") - - space1 = tpm2.Client(tpm2.Client.FLAG_SPACE) - space1.create_root_key() - space2 = tpm2.Client(tpm2.Client.FLAG_SPACE) - space2.create_root_key() - space2.create_root_key() - - handles = space2.get_cap(tpm2.TPM2_CAP_HANDLES, tpm2.HR_TRANSIENT) - - self.assertEqual(len(handles), 2) - - log.debug("%08x" % (handles[0])) - log.debug("%08x" % (handles[1])) - - def test_invalid_cc(self): - log = logging.getLogger(__name__) - log.debug(sys._getframe().f_code.co_name) - - TPM2_CC_INVALID = tpm2.TPM2_CC_FIRST - 1 - - space1 = tpm2.Client(tpm2.Client.FLAG_SPACE) - root1 = space1.create_root_key() - log.debug("%08x" % (root1)) - - fmt = '>HII' - cmd = struct.pack(fmt, tpm2.TPM2_ST_NO_SESSIONS, struct.calcsize(fmt), - TPM2_CC_INVALID) - - rc = 0 - try: - space1.send_cmd(cmd) - except ProtocolError as e: - rc = e.rc - - self.assertEqual(rc, tpm2.TPM2_RC_COMMAND_CODE | - tpm2.TSS2_RESMGR_TPM_RC_LAYER) - -class AsyncTest(unittest.TestCase): - def setUp(self): - logging.basicConfig(filename='AsyncTest.log', level=logging.DEBUG) - - def test_async(self): - log = logging.getLogger(__name__) - log.debug(sys._getframe().f_code.co_name) - - async_client = tpm2.Client(tpm2.Client.FLAG_NONBLOCK) - log.debug("Calling get_cap in a NON_BLOCKING mode") - async_client.get_cap(tpm2.TPM2_CAP_HANDLES, tpm2.HR_LOADED_SESSION) - async_client.close() - - def test_flush_invalid_context(self): - log = logging.getLogger(__name__) - log.debug(sys._getframe().f_code.co_name) - - async_client = tpm2.Client(tpm2.Client.FLAG_SPACE | tpm2.Client.FLAG_NONBLOCK) - log.debug("Calling flush_context passing in an invalid handle ") - handle = 0x80123456 - rc = 0 - try: - async_client.flush_context(handle) - except OSError as e: - rc = e.errno - - self.assertEqual(rc, 22) - async_client.close() diff --git a/BM/tpmi/tests b/BM/tpmi/tests old mode 100644 new mode 100755 diff --git a/BM/tpmi/tpmi_fms_list b/BM/tpmi/tpmi_fms_list old mode 100644 new mode 100755 diff --git a/BM/ufs/tests b/BM/ufs/tests old mode 100644 new mode 100755 diff --git a/BM/ufs/ufs_fms_list b/BM/ufs/ufs_fms_list old mode 100644 new mode 100755 diff --git a/BM/umip/tests b/BM/umip/tests old mode 100644 new mode 100755 diff --git a/KVM/qemu/boot_check.cfg b/KVM/qemu/boot_check.cfg new file mode 100644 index 00000000..72c89bf7 --- /dev/null +++ b/KVM/qemu/boot_check.cfg @@ -0,0 +1,46 @@ +- boot_check: + type = boot_check + virt_test_type = qemu + vm_accelerator = kvm + # Don't create/remove guest images + force_create_image = no + remove_image = no + # Automatically start VM + start_vm = yes + # Stop VM after testing + kill_vm = yes + shell_prompt = "^\[.*\][\#\$]\s*$" + vga = std + variants: + - vm: + - tdvm: + machine_type_extra_params = "kernel-irqchip=split" + vm_secure_guest_type = tdx + auto_cpu_model = "no" + cpu_model = host + variants: + - 1_cpu: + smp = 1 + - 2_cpu: + smp = 2 + - 4_cpu: + smp = 4 + - 8_cpu: + smp = 8 + - 16_cpu: + smp = 16 + - 208_cpu: + smp = 208 + - 256_cpu: + smp = 256 + - 288_cpu: + only q35 + machine_type_extra_params = "kernel-irqchip=split" + smp = 288 + variants: + - 1G: + mem = 1024 + - 4G: + mem = 4096 + - 16G: + mem = 16384 diff --git a/KVM/qemu/tests/boot_check.py b/KVM/qemu/tests/boot_check.py new file mode 100644 index 00000000..576b7d00 --- /dev/null +++ b/KVM/qemu/tests/boot_check.py @@ -0,0 +1,36 @@ +#!/usr/bin/python3 + +# SPDX-License-Identifier: GPL-2.0-only +# Copyright (c) 2024 Intel Corporation + +# Author: Xudong Hao +# +# History: July. 2024 - Xudong Hao - creation + +from virttest import error_context + + +@error_context.context_aware +def run(test, params, env): + """ + VM boot test and check resource of cpu and memeory: + 1. Boot VM + 2. Check if guest cpu and memory are expected as configured + 3. Destroy VM + + :param test: QEMU test object + :param params: Dictionary with the test parameters + :param env: Dictionary with test environment. + """ + vm = env.get_vm(params["main_vm"]) + vm.verify_alive() + timeout = params.get_numeric("login_timeout", 240) + session = vm.wait_for_login(timeout=timeout) + + vcpus = params.get_numeric("smp") + if vm.get_cpu_count() != vcpus: + test.fail("CPU number in guest is not same as configured vcpus number") + memory = params.get_numeric("mem") + if vm.get_totalmem_sys()//1024 != memory: + test.fail("Memory in guest is not same as configured") + session.close() diff --git a/scenario/emr-oa/tests-amx b/scenario/emr-oa/tests-amx index 317262b4..eb54899a 100644 --- a/scenario/emr-oa/tests-amx +++ b/scenario/emr-oa/tests-amx @@ -17,40 +17,40 @@ # -i, --instruction-type [0:TDPBF16PS 1:TDPBSSD 2:TDPBSUD 3:TDPBUSD 4:TDPBUUD] # functional tests -tmul -b 0 -t 2 -c 2 -i 0 -tmul -b 1 -t 2 -c 2 -i 0 -tmul -b 2 -t 2 -c 2 -i 0 -tmul -b 3 -t 2 -c 2 -i 0 -tmul -b 4 -t 2 -c 10 -i 0 -tmul -b 5 -t 2 -c 2 -i 0 -tmul -b 0 -t 2 -c 2 -i 1 -tmul -b 1 -t 2 -c 2 -i 1 -tmul -b 2 -t 2 -c 2 -i 1 -tmul -b 3 -t 2 -c 2 -i 1 -tmul -b 4 -t 2 -c 10 -i 1 -tmul -b 5 -t 2 -c 2 -i 1 -tmul -b 0 -t 2 -c 2 -i 2 -tmul -b 1 -t 2 -c 2 -i 2 -tmul -b 2 -t 2 -c 2 -i 2 -tmul -b 3 -t 2 -c 2 -i 2 -tmul -b 4 -t 2 -c 10 -i 2 -tmul -b 5 -t 2 -c 2 -i 2 -tmul -b 0 -t 2 -c 2 -i 3 -tmul -b 1 -t 2 -c 2 -i 3 -tmul -b 2 -t 2 -c 2 -i 3 -tmul -b 3 -t 2 -c 2 -i 3 -tmul -b 4 -t 2 -c 10 -i 3 -tmul -b 5 -t 2 -c 2 -i 3 -tmul -b 0 -t 2 -c 2 -i 4 -tmul -b 1 -t 2 -c 2 -i 4 -tmul -b 2 -t 2 -c 2 -i 4 -tmul -b 3 -t 2 -c 2 -i 4 -tmul -b 4 -t 2 -c 10 -i 4 -tmul -b 5 -t 2 -c 2 -i 4 +tmul -b 0 -t 10 -c 10 -i 0 +tmul -b 1 -t 10 -c 10 -i 0 +tmul -b 2 -t 10 -c 10 -i 0 +tmul -b 3 -t 10 -c 10 -i 0 +tmul -b 4 -t 10 -c 100000 -i 0 +tmul -b 5 -t 10 -c 10 -i 0 +tmul -b 0 -t 10 -c 10 -i 1 +tmul -b 1 -t 10 -c 10 -i 1 +tmul -b 2 -t 10 -c 10 -i 1 +tmul -b 3 -t 10 -c 10 -i 1 +tmul -b 4 -t 10 -c 100000 -i 1 +tmul -b 5 -t 10 -c 10 -i 1 +tmul -b 0 -t 10 -c 10 -i 2 +tmul -b 1 -t 10 -c 10 -i 2 +tmul -b 2 -t 10 -c 10 -i 2 +tmul -b 3 -t 10 -c 10 -i 2 +tmul -b 4 -t 10 -c 100000 -i 2 +tmul -b 5 -t 10 -c 10 -i 2 +tmul -b 0 -t 10 -c 10 -i 3 +tmul -b 1 -t 10 -c 10 -i 3 +tmul -b 2 -t 10 -c 10 -i 3 +tmul -b 3 -t 10 -c 10 -i 3 +tmul -b 4 -t 10 -c 100000 -i 3 +tmul -b 5 -t 10 -c 10 -i 3 +tmul -b 0 -t 10 -c 10 -i 4 +tmul -b 1 -t 10 -c 10 -i 4 +tmul -b 2 -t 10 -c 10 -i 4 +tmul -b 3 -t 10 -c 10 -i 4 +tmul -b 4 -t 10 -c 100000 -i 4 +tmul -b 5 -t 10 -c 10 -i 4 -# stress tests all skipped to simplify test execution -# tmul -b 1 -t 10000 -c 10 -i 0 -# tmul -b 1 -t 10000 -c 10 -i 1 -# tmul -b 1 -t 10000 -c 10 -i 2 -# tmul -b 1 -t 10000 -c 10 -i 3 -# tmul -b 1 -t 10000 -c 10 -i 4 \ No newline at end of file +# stress tests +tmul -b 1 -t 10000 -c 10 -i 0 +tmul -b 1 -t 10000 -c 10 -i 1 +tmul -b 1 -t 10000 -c 10 -i 2 +tmul -b 1 -t 10000 -c 10 -i 3 +tmul -b 1 -t 10000 -c 10 -i 4 \ No newline at end of file diff --git a/scenario/emr-oa/tests-cstate b/scenario/emr-oa/tests-cstate old mode 100644 new mode 100755 diff --git a/scenario/emr-oa/tests-ifs b/scenario/emr-oa/tests-ifs old mode 100644 new mode 100755 index e4186c2a..868eba43 --- a/scenario/emr-oa/tests-ifs +++ b/scenario/emr-oa/tests-ifs @@ -19,6 +19,3 @@ ifs_tests.sh -m 1 -p ran -n ifs_array_off_sib -t 10 ifs_tests.sh -m 1 -p ran -n ifs_array_offran -t 5 ifs_tests.sh -m 1 -p ran -n ifs_array_cpuran_fullload -t 10 ifs_tests.sh -m 1 -p ran -b 1 -n ifs_loop -t 500 - -# Test ifs_0 all available image scan and ifs_1 scan -test_ifs.sh diff --git a/scenario/emr-oe/tests-amx b/scenario/emr-oe/tests-amx index 317262b4..eb54899a 100644 --- a/scenario/emr-oe/tests-amx +++ b/scenario/emr-oe/tests-amx @@ -17,40 +17,40 @@ # -i, --instruction-type [0:TDPBF16PS 1:TDPBSSD 2:TDPBSUD 3:TDPBUSD 4:TDPBUUD] # functional tests -tmul -b 0 -t 2 -c 2 -i 0 -tmul -b 1 -t 2 -c 2 -i 0 -tmul -b 2 -t 2 -c 2 -i 0 -tmul -b 3 -t 2 -c 2 -i 0 -tmul -b 4 -t 2 -c 10 -i 0 -tmul -b 5 -t 2 -c 2 -i 0 -tmul -b 0 -t 2 -c 2 -i 1 -tmul -b 1 -t 2 -c 2 -i 1 -tmul -b 2 -t 2 -c 2 -i 1 -tmul -b 3 -t 2 -c 2 -i 1 -tmul -b 4 -t 2 -c 10 -i 1 -tmul -b 5 -t 2 -c 2 -i 1 -tmul -b 0 -t 2 -c 2 -i 2 -tmul -b 1 -t 2 -c 2 -i 2 -tmul -b 2 -t 2 -c 2 -i 2 -tmul -b 3 -t 2 -c 2 -i 2 -tmul -b 4 -t 2 -c 10 -i 2 -tmul -b 5 -t 2 -c 2 -i 2 -tmul -b 0 -t 2 -c 2 -i 3 -tmul -b 1 -t 2 -c 2 -i 3 -tmul -b 2 -t 2 -c 2 -i 3 -tmul -b 3 -t 2 -c 2 -i 3 -tmul -b 4 -t 2 -c 10 -i 3 -tmul -b 5 -t 2 -c 2 -i 3 -tmul -b 0 -t 2 -c 2 -i 4 -tmul -b 1 -t 2 -c 2 -i 4 -tmul -b 2 -t 2 -c 2 -i 4 -tmul -b 3 -t 2 -c 2 -i 4 -tmul -b 4 -t 2 -c 10 -i 4 -tmul -b 5 -t 2 -c 2 -i 4 +tmul -b 0 -t 10 -c 10 -i 0 +tmul -b 1 -t 10 -c 10 -i 0 +tmul -b 2 -t 10 -c 10 -i 0 +tmul -b 3 -t 10 -c 10 -i 0 +tmul -b 4 -t 10 -c 100000 -i 0 +tmul -b 5 -t 10 -c 10 -i 0 +tmul -b 0 -t 10 -c 10 -i 1 +tmul -b 1 -t 10 -c 10 -i 1 +tmul -b 2 -t 10 -c 10 -i 1 +tmul -b 3 -t 10 -c 10 -i 1 +tmul -b 4 -t 10 -c 100000 -i 1 +tmul -b 5 -t 10 -c 10 -i 1 +tmul -b 0 -t 10 -c 10 -i 2 +tmul -b 1 -t 10 -c 10 -i 2 +tmul -b 2 -t 10 -c 10 -i 2 +tmul -b 3 -t 10 -c 10 -i 2 +tmul -b 4 -t 10 -c 100000 -i 2 +tmul -b 5 -t 10 -c 10 -i 2 +tmul -b 0 -t 10 -c 10 -i 3 +tmul -b 1 -t 10 -c 10 -i 3 +tmul -b 2 -t 10 -c 10 -i 3 +tmul -b 3 -t 10 -c 10 -i 3 +tmul -b 4 -t 10 -c 100000 -i 3 +tmul -b 5 -t 10 -c 10 -i 3 +tmul -b 0 -t 10 -c 10 -i 4 +tmul -b 1 -t 10 -c 10 -i 4 +tmul -b 2 -t 10 -c 10 -i 4 +tmul -b 3 -t 10 -c 10 -i 4 +tmul -b 4 -t 10 -c 100000 -i 4 +tmul -b 5 -t 10 -c 10 -i 4 -# stress tests all skipped to simplify test execution -# tmul -b 1 -t 10000 -c 10 -i 0 -# tmul -b 1 -t 10000 -c 10 -i 1 -# tmul -b 1 -t 10000 -c 10 -i 2 -# tmul -b 1 -t 10000 -c 10 -i 3 -# tmul -b 1 -t 10000 -c 10 -i 4 \ No newline at end of file +# stress tests +tmul -b 1 -t 10000 -c 10 -i 0 +tmul -b 1 -t 10000 -c 10 -i 1 +tmul -b 1 -t 10000 -c 10 -i 2 +tmul -b 1 -t 10000 -c 10 -i 3 +tmul -b 1 -t 10000 -c 10 -i 4 \ No newline at end of file diff --git a/scenario/emr-oe/tests-cstate b/scenario/emr-oe/tests-cstate old mode 100644 new mode 100755 diff --git a/scenario/emr-oe/tests-dsa1 b/scenario/emr-oe/tests-dsa1 index b3dad43f..66a882b2 100644 --- a/scenario/emr-oe/tests-dsa1 +++ b/scenario/emr-oe/tests-dsa1 @@ -1,23 +1,63 @@ #DSA_XS_FUNC_USER_MEMMOVE_1D2G2Q dsa_user_test.sh -c 1d2g2q_user -o 0x03 +#DSA_XS_FUNC_USER_MEMMOVE_1D4G8Q +dsa_user_test.sh -c 1d4g8q_user -o 0x03 #DSA_XS_FUNC_USER_MEMMOVE_4D4G4Q dsa_user_test.sh -c 4d4g4q_user -o 0x03 +#DSA_XS_FUNC_USER_MEMMOVE_4D16G32Q +dsa_user_test.sh -c 4d16g32q_user -o 0x03 +#DSA_XS_FUNC_USER_MEMMOVE_8D8G8Q +dsa_user_test.sh -c 8d8g8q_user -o 0x03 +#DSA_XS_FUNC_USER_MEMMOVE_8D32G64Q +dsa_user_test.sh -c 8d32g64q_user -o 0x03 #DSA_XS_FUNC_USER_MEMFILL_1D2G2Q dsa_user_test.sh -c 1d2g2q_user -o 0x04 +#DSA_XS_FUNC_USER_MEMFILL_1D4G8Q +dsa_user_test.sh -c 1d4g8q_user -o 0x04 #DSA_XS_FUNC_USER_MEMFILL_4D4G4Q dsa_user_test.sh -c 4d4g4q_user -o 0x04 +#DSA_XS_FUNC_USER_MEMFILL_4D16G32Q +dsa_user_test.sh -c 4d16g32q_user -o 0x04 +#DSA_XS_FUNC_USER_MEMFILL_8D8G8Q +dsa_user_test.sh -c 8d8g8q_user -o 0x04 +#DSA_XS_FUNC_USER_MEMFILL_8D32G64Q +dsa_user_test.sh -c 8d32g64q_user -o 0x04 #DSA_XS_FUNC_USER_COMPARE_1D2G2Q dsa_user_test.sh -c 1d2g2q_user -o 0x05 +#DSA_XS_FUNC_USER_COMPARE_1D4G8Q +dsa_user_test.sh -c 1d4g8q_user -o 0x05 #DSA_XS_FUNC_USER_COMPARE_4D4G4Q dsa_user_test.sh -c 4d4g4q_user -o 0x05 +#DSA_XS_FUNC_USER_COMPARE_4D16G32Q +dsa_user_test.sh -c 4d16g32q_user -o 0x05 +#DSA_XS_FUNC_USER_COMPARE_8D8G8Q +dsa_user_test.sh -c 8d8g8q_user -o 0x05 +#DSA_XS_FUNC_USER_COMPARE_8D32G64Q +dsa_user_test.sh -c 8d32g64q_user -o 0x05 #DSA_XS_FUNC_USER_COMPVAL_1D2G2Q dsa_user_test.sh -c 1d2g2q_user -o 0x06 +#DSA_XS_FUNC_USER_COMPVAL_1D4G8Q +dsa_user_test.sh -c 1d4g8q_user -o 0x06 #DSA_XS_FUNC_USER_COMPVAL_4D4G4Q dsa_user_test.sh -c 4d4g4q_user -o 0x06 +#DSA_XS_FUNC_USER_COMPVAL_4D16G32Q +dsa_user_test.sh -c 4d16g32q_user -o 0x06 +#DSA_XS_FUNC_USER_COMPVAL_8D8G8Q +dsa_user_test.sh -c 8d8g8q_user -o 0x06 +#DSA_XS_FUNC_USER_COMPVAL_8D32G64Q +dsa_user_test.sh -c 8d32g64q_user -o 0x06 #DSA_XS_FUNC_USER_DUALCAST_1D2G2Q dsa_user_test.sh -c 1d2g2q_user -o 0x09 +#DSA_XS_FUNC_USER_DUALCAST_1D4G8Q +dsa_user_test.sh -c 1d4g8q_user -o 0x09 #DSA_XS_FUNC_USER_DUALCAST_4D4G4Q dsa_user_test.sh -c 4d4g4q_user -o 0x09 +#DSA_XS_FUNC_USER_DUALCAST_4D16G32Q +dsa_user_test.sh -c 4d16g32q_user -o 0x09 +#DSA_XS_FUNC_USER_DUALCAST_8D8G8Q +dsa_user_test.sh -c 8d8g8q_user -o 0x09 +#DSA_XS_FUNC_USER_DUALCAST_8D32G64Q +dsa_user_test.sh -c 8d32g64q_user -o 0x09 #DSA_XS_FUNC_USER_NOOP_1D2G2Q dsa_user_test.sh -c 1d2g2q_user -o 0x0 #DSA_XS_FUNC_USER_NOOP_1D4G8Q diff --git a/scenario/emr-oe/tests-iax b/scenario/emr-oe/tests-iax index b3807dfe..9826261e 100644 --- a/scenario/emr-oe/tests-iax +++ b/scenario/emr-oe/tests-iax @@ -5,25 +5,25 @@ iax_user_test.sh -c 2g2q_user_2 -o 0x43 -w 0 #IAX_XS_FUNC_USER_CRC64_DEDICATED iax_user_test.sh -c 2g2q_user_2 -o 0x44 -w 0 #IAX_XS_FUNC_USER_ZDECOMPRESS32_DEDICATED -## iax_user_test.sh -c 2g2q_user_2 -o 0x48 -w 0 +iax_user_test.sh -c 2g2q_user_2 -o 0x48 -w 0 #IAX_XS_FUNC_USER_ZDECOMPRESS16_DEDICATED -## iax_user_test.sh -c 2g2q_user_2 -o 0x49 -w 0 +iax_user_test.sh -c 2g2q_user_2 -o 0x49 -w 0 #IAX_XS_FUNC_USER_ZCOMPRESS32_DEDICATED -## iax_user_test.sh -c 2g2q_user_2 -o 0x4c -w 0 +iax_user_test.sh -c 2g2q_user_2 -o 0x4c -w 0 #IAX_XS_FUNC_USER_ZCOMPRESS16_DEDICATED -## iax_user_test.sh -c 2g2q_user_2 -o 0x4d -w 0 +iax_user_test.sh -c 2g2q_user_2 -o 0x4d -w 0 #IAX_XS_FUNC_USER_SCAN_DEDICATED iax_user_test.sh -c 2g2q_user_2 -o 0x50 -w 0 #IAX_XS_FUNC_USER_SET_DEDICATED -## iax_user_test.sh -c 2g2q_user_2 -o 0x51 -w 0 +iax_user_test.sh -c 2g2q_user_2 -o 0x51 -w 0 #IAX_XS_FUNC_USER_EXTRACT_DEDICATED iax_user_test.sh -c 2g2q_user_2 -o 0x52 -w 0 #IAX_XS_FUNC_USER_SELECT_DEDICATED iax_user_test.sh -c 2g2q_user_2 -o 0x53 -w 0 #IAX_XS_FUNC_USER_RLE_DEDICATED -## iax_user_test.sh -c 2g2q_user_2 -o 0x54 -w 0 +iax_user_test.sh -c 2g2q_user_2 -o 0x54 -w 0 #IAX_XS_FUNC_USER_FIND_DEDICATED -## iax_user_test.sh -c 2g2q_user_2 -o 0x55 -w 0 +iax_user_test.sh -c 2g2q_user_2 -o 0x55 -w 0 #IAX_XS_FUNC_USER_EXPAND_DEDICATED iax_user_test.sh -c 2g2q_user_2 -o 0x56 -w 0 #IAX_XS_FUNC_USER_DECOMPRESS_SHARED @@ -33,24 +33,24 @@ iax_user_test.sh -c 2g2q_user_2 -o 0x43 -w 1 #IAX_XS_FUNC_USER_CRC64_SHARED iax_user_test.sh -c 2g2q_user_2 -o 0x44 -w 1 #IAX_XS_FUNC_USER_ZDECOMPRESS32_SHARED -## iax_user_test.sh -c 2g2q_user_2 -o 0x48 -w 1 +iax_user_test.sh -c 2g2q_user_2 -o 0x48 -w 1 #IAX_XS_FUNC_USER_ZDECOMPRESS16_SHARED -## iax_user_test.sh -c 2g2q_user_2 -o 0x49 -w 1 +iax_user_test.sh -c 2g2q_user_2 -o 0x49 -w 1 #IAX_XS_FUNC_USER_ZCOMPRESS32_SHARED -## iax_user_test.sh -c 2g2q_user_2 -o 0x4c -w 1 +iax_user_test.sh -c 2g2q_user_2 -o 0x4c -w 1 #IAX_XS_FUNC_USER_ZCOMPRESS16_SHARED -## iax_user_test.sh -c 2g2q_user_2 -o 0x4d -w 1 +iax_user_test.sh -c 2g2q_user_2 -o 0x4d -w 1 #IAX_XS_FUNC_USER_SCAN_SHARED iax_user_test.sh -c 2g2q_user_2 -o 0x50 -w 1 #IAX_XS_FUNC_USER_SET_SHARED -## iax_user_test.sh -c 2g2q_user_2 -o 0x51 -w 1 +iax_user_test.sh -c 2g2q_user_2 -o 0x51 -w 1 #IAX_XS_FUNC_USER_EXTRACT_SHARED iax_user_test.sh -c 2g2q_user_2 -o 0x52 -w 1 #IAX_XS_FUNC_USER_SELECT_SHARED iax_user_test.sh -c 2g2q_user_2 -o 0x53 -w 1 #IAX_XS_FUNC_USER_RLE_SHARED -## iax_user_test.sh -c 2g2q_user_2 -o 0x54 -w 1 +iax_user_test.sh -c 2g2q_user_2 -o 0x54 -w 1 #IAX_XS_FUNC_USER_FIND_SHARED -## iax_user_test.sh -c 2g2q_user_2 -o 0x55 -w 1 +iax_user_test.sh -c 2g2q_user_2 -o 0x55 -w 1 #IAX_XS_FUNC_USER_EXPAND_SHARED iax_user_test.sh -c 2g2q_user_2 -o 0x56 -w 1 diff --git a/scenario/emr-oe/tests-ifs b/scenario/emr-oe/tests-ifs old mode 100644 new mode 100755 index e4186c2a..868eba43 --- a/scenario/emr-oe/tests-ifs +++ b/scenario/emr-oe/tests-ifs @@ -19,6 +19,3 @@ ifs_tests.sh -m 1 -p ran -n ifs_array_off_sib -t 10 ifs_tests.sh -m 1 -p ran -n ifs_array_offran -t 5 ifs_tests.sh -m 1 -p ran -n ifs_array_cpuran_fullload -t 10 ifs_tests.sh -m 1 -p ran -b 1 -n ifs_loop -t 500 - -# Test ifs_0 all available image scan and ifs_1 scan -test_ifs.sh diff --git a/scenario/emr-oe/tests-pstate b/scenario/emr-oe/tests-pstate old mode 100644 new mode 100755 diff --git a/scenario/emr-oe/tests-rapl b/scenario/emr-oe/tests-rapl old mode 100644 new mode 100755 diff --git a/scenario/emr-oe/tests-topology b/scenario/emr-oe/tests-topology deleted file mode 100644 index a64a6669..00000000 --- a/scenario/emr-oe/tests-topology +++ /dev/null @@ -1,11 +0,0 @@ -# This file collects basic cases which verify CPU Topology -# on Intel® Architecture-based server platforms. -# @hw_dep: -# @other_dep: -# @other_warn: which cpuid 2>/dev/null @ cpuid tool is required -# @other_warn: which lstopo 2>/dev/null @ Please install hwloc-gui.x86_64 package or hwloc.x86_64 to get lstopo tool - -cpu_topology.sh -t verify_thread_per_core -cpu_topology.sh -t verify_cores_per_socket -cpu_topology.sh -t verify_level_type -cpu_topology.sh -t verify_sched_domain_names diff --git a/scenario/emr-oe/tests-topology b/scenario/emr-oe/tests-topology new file mode 120000 index 00000000..aa612053 --- /dev/null +++ b/scenario/emr-oe/tests-topology @@ -0,0 +1 @@ +../../BM/topology/tests-server \ No newline at end of file diff --git a/scenario/gnr-oe/tests-amx b/scenario/gnr-oe/tests-amx deleted file mode 100644 index 067141db..00000000 --- a/scenario/gnr-oe/tests-amx +++ /dev/null @@ -1,69 +0,0 @@ -# This file collects the AMX(Advanced Matrix eXtension) related instruction tests on -# Intel® Architecture-based platforms. -# @hw_dep: cpuid_check 7 0 0 0 d 24 @ CPU doesn't support AMX-TILE - CPUID.(7.0).EDX[24] -# @hw_dep: cpuid_check 7 0 0 0 d 25 @ CPU doesn't support AMX-INT8 - CPUID.(7.0).EDX[25] -# @hw_dep: cpuid_check 7 0 0 0 d 22 @ CPU doesn't support AMX-BF16 - CPUID.(7.0).EDX[22] -# @hw_dep: cpuid_check 7 0 1 0 a 21 @ CPU doesn't support AMX-FP16 - CPUID.(7.1).EAX[21] -# @hw_dep: cpuid_check d 0 1 0 a 4 @ CPU doesn't support AMX XFD - CPUID.(d.1).EAX[4] -# @other_warn: echo 'int main() { asm volatile("tdpfp16ps %tmm2, %tmm1, %tmm0"); return 0; }' | gcc -x c -o /dev/null - \ -# @ gcc no support AMX_FP16 ins., refer to README for compile option, amx_fp16 related tests can't be executed - -# Usage:./tmul [OPTIONS] -# -b, --break-reason [1 - 5] -# 0: break by nothing -# 1: break by yield -# 2: break by sleep -# 3: break by trap -# 4: break by signal -# 5: break by futex -# -t, --thread-count [Should not be less than 1] -# -c, --cycle-number [Should not be less than 1] -# -i, --instruction-type [0:TDPBF16PS 1:TDPBSSD 2:TDPBSUD 3:TDPBUSD 4:TDPBUUD 5:TDPFP16PS] - -# functional tests -tmul -b 0 -t 2 -c 2 -i 0 -tmul -b 1 -t 2 -c 2 -i 0 -tmul -b 2 -t 2 -c 2 -i 0 -tmul -b 3 -t 2 -c 2 -i 0 -tmul -b 4 -t 2 -c 10 -i 0 -tmul -b 5 -t 2 -c 2 -i 0 -tmul -b 0 -t 2 -c 2 -i 1 -tmul -b 1 -t 2 -c 2 -i 1 -tmul -b 2 -t 2 -c 2 -i 1 -tmul -b 3 -t 2 -c 2 -i 1 -tmul -b 4 -t 2 -c 10 -i 1 -tmul -b 5 -t 2 -c 2 -i 1 -tmul -b 0 -t 2 -c 2 -i 2 -tmul -b 1 -t 2 -c 2 -i 2 -tmul -b 2 -t 2 -c 2 -i 2 -tmul -b 3 -t 2 -c 2 -i 2 -tmul -b 4 -t 2 -c 10 -i 2 -tmul -b 5 -t 2 -c 2 -i 2 -tmul -b 0 -t 2 -c 2 -i 3 -tmul -b 1 -t 2 -c 2 -i 3 -tmul -b 2 -t 2 -c 2 -i 3 -tmul -b 3 -t 2 -c 2 -i 3 -tmul -b 4 -t 2 -c 10 -i 3 -tmul -b 5 -t 2 -c 2 -i 3 -tmul -b 0 -t 2 -c 2 -i 4 -tmul -b 1 -t 2 -c 2 -i 4 -tmul -b 2 -t 2 -c 2 -i 4 -tmul -b 3 -t 2 -c 2 -i 4 -tmul -b 4 -t 2 -c 10 -i 4 -tmul -b 5 -t 2 -c 2 -i 4 -# amx_fp16 instruction based tests -tmul -b 0 -t 2 -c 2 -i 5 -tmul -b 1 -t 2 -c 2 -i 5 -tmul -b 2 -t 2 -c 2 -i 5 -tmul -b 3 -t 2 -c 2 -i 5 -tmul -b 4 -t 2 -c 10 -i 5 -tmul -b 5 -t 2 -c 2 -i 5 - -# stress tests all skipped to simplify test execution -# tmul -b 1 -t 10000 -c 10 -i 0 -# tmul -b 1 -t 10000 -c 10 -i 1 -# tmul -b 1 -t 10000 -c 10 -i 2 -# tmul -b 1 -t 10000 -c 10 -i 3 -# tmul -b 1 -t 10000 -c 10 -i 4 -# amx_fp16 instruction based tests -# tmul -b 1 -t 10000 -c 10 -i 5 \ No newline at end of file diff --git a/scenario/gnr-oe/tests-cstate b/scenario/gnr-oe/tests-cstate old mode 100644 new mode 100755 diff --git a/scenario/gnr-oe/tests-ifs b/scenario/gnr-oe/tests-ifs old mode 100644 new mode 100755 index e4186c2a..868eba43 --- a/scenario/gnr-oe/tests-ifs +++ b/scenario/gnr-oe/tests-ifs @@ -19,6 +19,3 @@ ifs_tests.sh -m 1 -p ran -n ifs_array_off_sib -t 10 ifs_tests.sh -m 1 -p ran -n ifs_array_offran -t 5 ifs_tests.sh -m 1 -p ran -n ifs_array_cpuran_fullload -t 10 ifs_tests.sh -m 1 -p ran -b 1 -n ifs_loop -t 500 - -# Test ifs_0 all available image scan and ifs_1 scan -test_ifs.sh diff --git a/scenario/gnr-oe/tests-isst b/scenario/gnr-oe/tests-isst old mode 100644 new mode 100755 diff --git a/scenario/gnr-oe/tests-pstate b/scenario/gnr-oe/tests-pstate old mode 100644 new mode 100755 diff --git a/scenario/gnr-oe/tests-rapl b/scenario/gnr-oe/tests-rapl old mode 100644 new mode 100755 diff --git a/scenario/gnr-oe/tests-sdsi b/scenario/gnr-oe/tests-sdsi old mode 100644 new mode 100755 diff --git a/scenario/gnr-oe/tests-topology b/scenario/gnr-oe/tests-topology old mode 100644 new mode 100755 diff --git a/scenario/gnr-oe/tests-tpmi b/scenario/gnr-oe/tests-tpmi old mode 100644 new mode 100755 diff --git a/scenario/gnr-oe/tests-ufs b/scenario/gnr-oe/tests-ufs old mode 100644 new mode 100755