Skip to content

Commit

Permalink
general_test: add the family model stepping check function
Browse files Browse the repository at this point in the history
Add the family model stepping check function, it could be used to get
the test platform CPU family model stepping, and check if this type of
family model is in the family model list for target feature.

Signed-off-by: Pengfei Xu <[email protected]>
  • Loading branch information
xupengfe authored and ysun committed May 17, 2024
1 parent abad967 commit 4f244e6
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 16 deletions.
37 changes: 37 additions & 0 deletions BM/common/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ BIN_OUTPUT=""
BIN_DMESG=""
BIN_RET=""
export LAST_DMESG_TIMESTAMP=""
export FML=""
export MODEL=""
export STEPPING=""
export CPU_MODEL=""

readonly CPU_SYSFS_FOLDER="/sys/devices/system/cpu"

Expand Down Expand Up @@ -537,6 +541,39 @@ online_all_cpu()
fi
}

# Get the cpu model info, like spr sample: 06-8f-06
# Input: NA
# Output: 0 otherwise failure or die
get_cpu_model() {
FML=$(grep -m 1 "family" /proc/cpuinfo | awk -F ":" '{printf "%02x",$2;}')
[[ -n "$FML" ]] || block_test "No CPU family found:$FML"
MODEL=$(grep -m 1 "model" /proc/cpuinfo | awk -F ":" '{printf "%02x",$2;}')
[[ -n "$MODEL" ]] || block_test "No CPU model found:$MODEL"
STEPPING=$(grep -m 1 "stepping" /proc/cpuinfo | awk -F ":" '{printf "%02x",$2;}')
export CPU_MODEL="${FML}-${MODEL}-${STEPPING}"
}

# From the family model stepping list, judge the test platform is in the list
# Input: family model stepping list file like "ifs_fms_list" under ifs folder
# Output: 0 otherwise failure or die
check_fms_list() {
local fms_list_file=$1
local list_file=""
local check_fms=""

get_cpu_model
list_file=$(which "$fms_list_file" 2>/dev/null)
[[ -n "$list_file" ]] || block_test "No family model stepping list file:$fms_list_file found"
check_fms=$(grep -v "^#" "$list_file" | grep "^$FML" \
| awk -F "$FML:" '{print $2}' \
| grep "$MODEL")
if [[ -n "$check_fms" ]]; then
test_print_trc "Find family:$FML model:$MODEL in $list_file"
else
block_test "No family:$FML model:$MODEL found in $list_file"
fi
}

# Check specified pattern in dmesg
# Arguments:
# $1: bin name
Expand Down
3 changes: 2 additions & 1 deletion BM/common/general_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ general_test() {
;;
# family model stepping check
fms)
#TODO, will add the fms check function
get_cpu_model
check_fms_list "$PARM"
;;
dmesg)
key1=$(echo "$KEYWORD" | awk -F '&' '{print $1}')
Expand Down
14 changes: 0 additions & 14 deletions BM/ifs/ifs_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ IFS_DMESG=""
IFS_LOG=""
WARN_LOG=""
IFS_CSV=""
CPU_MODEL=""
FML=""
MODEL=""
STEPPING=""
BATCH_FILE=""

LOG_MAX_LINES="20"
Expand Down Expand Up @@ -117,16 +113,6 @@ ifs_teardown() {
fi
}

# Get the cpu model info, like spr sample: 06-8f-06
# Input: NA
# Output: 0 otherwise failure or die
get_cpu_model() {
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;}')
export CPU_MODEL="${FML}-${MODEL}-${STEPPING}"
}

# CPUID check ATOM, IS_ATOM=true, if no IS_ATOM=false
# CPUID EAX=0x1a, and then output EAX bit29 is 1:ATOM, bit29:0 not atom
# Input: NA
Expand Down
3 changes: 3 additions & 0 deletions BM/ifs/ifs_fms_list
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Family 06 CPUs from arch/x86/include/asm/intel-family.h
# SPR EMR GNR_X GNR_D SRF
06:8f cf ad ae af
2 changes: 1 addition & 1 deletion BM/ifs/tests
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file collects Intel IFS(In Field SCAN) tests on
# Intel® Architecture-based platforms.
# @hw_dep:
# @hw_dep: general_test.sh -t fms -p "ifs_fms_list" @ CPU doesn't support ifs, family model not in ifs/ifs_fms_list
# @other_dep: general_test.sh -t kconfig -k "CONFIG_INTEL_IFS=m"
# @other_warn: ifs_tests.sh -m 0 -p all -b 1 -n ifs_batch @ check if SGX init ok and DIMM proper set as IFS relies on enabled SGX
# ifs_0 scan test cases, it works on SPR(Sapphire Rapids) platform and future server
Expand Down

0 comments on commit 4f244e6

Please sign in to comment.