From 20ed3456a275b3ae82345d229d00f964fb246271 Mon Sep 17 00:00:00 2001 From: Liang Cong Date: Thu, 27 Nov 2025 02:02:26 -0500 Subject: [PATCH] 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 --- libvirt/tests/cfg/cpu/vcpu_feature.cfg | 3 ++- libvirt/tests/src/cpu/vcpu_feature.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/libvirt/tests/cfg/cpu/vcpu_feature.cfg b/libvirt/tests/cfg/cpu/vcpu_feature.cfg index 2af78e5267b..98f63e225dc 100644 --- a/libvirt/tests/cfg/cpu/vcpu_feature.cfg +++ b/libvirt/tests/cfg/cpu/vcpu_feature.cfg @@ -19,7 +19,7 @@ func_supported_since_libvirt_ver = (10, 7, 0) host_supported_feature = "yes" feature_name = "pauth" - feature_check_name = "paca" + feature_check_pattern = "paca" check_vm_feature = "yes" check_qemu_pattern = "-cpu host,pauth=off" cpu_check = "none" @@ -37,5 +37,6 @@ only policy_require host_supported_feature = "no" feature_name = "cr8legacy" + feature_check_pattern = "'cr8legacy\|cr8_legacy'" err_msg = "guest CPU doesn't match specification: missing features: .*${feature_name}" diff --git a/libvirt/tests/src/cpu/vcpu_feature.py b/libvirt/tests/src/cpu/vcpu_feature.py index 2577e31f8d6..efb316d29a2 100644 --- a/libvirt/tests/src/cpu/vcpu_feature.py +++ b/libvirt/tests/src/cpu/vcpu_feature.py @@ -49,7 +49,7 @@ def update_cpu_xml(): cpu_mode = params.get('cpu_mode', "host-passthrough") cpu_check = params.get('cpu_check', "full") feature_name = params.get('feature_name', "vmx") - feature_check_name = params.get('feature_check_name', feature_name) + feature_check_pattern = params.get('feature_check_pattern', feature_name) feature_policy = params.get('feature_policy', "require") host_supported_feature = "yes" == params.get("host_supported_feature", "no") check_vm_feature = "yes" == params.get("check_vm_feature", "no") @@ -61,7 +61,7 @@ def update_cpu_xml(): try: libvirt_version.is_libvirt_feature_supported(params) - flags_cmd = "grep -qw %s /proc/cpuinfo" % feature_check_name + flags_cmd = "grep -qw %s /proc/cpuinfo" % feature_check_pattern res = process.run(flags_cmd, shell=True, ignore_status=True).exit_status if host_supported_feature == bool(res): test.cancel('The host does not support current test!')