Skip to content

Commit 20ed345

Browse files
vcpu_feature:Add support for AMD CPU feature naming variants
Some AMD CPUs (e.g., EPYC 7542) display the cr8legacy feature as "cr8_legacy". This commit extends the grep pattern matching to accommodate both naming conventions, ensuring proper feature detection across different CPU models. Signed-off-by: Liang Cong <lcong@redhat.com>
1 parent 284c323 commit 20ed345

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

libvirt/tests/cfg/cpu/vcpu_feature.cfg

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
func_supported_since_libvirt_ver = (10, 7, 0)
2020
host_supported_feature = "yes"
2121
feature_name = "pauth"
22-
feature_check_name = "paca"
22+
feature_check_pattern = "paca"
2323
check_vm_feature = "yes"
2424
check_qemu_pattern = "-cpu host,pauth=off"
2525
cpu_check = "none"
@@ -37,5 +37,6 @@
3737
only policy_require
3838
host_supported_feature = "no"
3939
feature_name = "cr8legacy"
40+
feature_check_pattern = "'cr8legacy\|cr8_legacy'"
4041
err_msg = "guest CPU doesn't match specification: missing features: .*${feature_name}"
4142

libvirt/tests/src/cpu/vcpu_feature.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def update_cpu_xml():
4949
cpu_mode = params.get('cpu_mode', "host-passthrough")
5050
cpu_check = params.get('cpu_check', "full")
5151
feature_name = params.get('feature_name', "vmx")
52-
feature_check_name = params.get('feature_check_name', feature_name)
52+
feature_check_pattern = params.get('feature_check_pattern', feature_name)
5353
feature_policy = params.get('feature_policy', "require")
5454
host_supported_feature = "yes" == params.get("host_supported_feature", "no")
5555
check_vm_feature = "yes" == params.get("check_vm_feature", "no")
@@ -61,7 +61,7 @@ def update_cpu_xml():
6161
try:
6262
libvirt_version.is_libvirt_feature_supported(params)
6363

64-
flags_cmd = "grep -qw %s /proc/cpuinfo" % feature_check_name
64+
flags_cmd = "grep -qw %s /proc/cpuinfo" % feature_check_pattern
6565
res = process.run(flags_cmd, shell=True, ignore_status=True).exit_status
6666
if host_supported_feature == bool(res):
6767
test.cancel('The host does not support current test!')

0 commit comments

Comments
 (0)