From 0feef374c82c27311858923fc41267b09d9e12ae Mon Sep 17 00:00:00 2001 From: Tim Wiederhake Date: Mon, 23 Nov 2020 15:14:27 +0100 Subject: [PATCH] cpu_map: sync_qemu_cpu_i386: Simplify ignore features Signed-off-by: Tim Wiederhake Reviewed-by: Jiri Denemark --- src/cpu_map/sync_qemu_i386.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/cpu_map/sync_qemu_i386.py b/src/cpu_map/sync_qemu_i386.py index 93630f1a55..acf27d2bec 100755 --- a/src/cpu_map/sync_qemu_i386.py +++ b/src/cpu_map/sync_qemu_i386.py @@ -23,7 +23,6 @@ def translate_vendor(name): def translate_feature(name): T = { - # translating qemu -> libvirt cpu feature names "CPUID_6_EAX_ARAT": "arat", "CPUID_7_0_EBX_ADX": "adx", "CPUID_7_0_EBX_AVX2": "avx2", @@ -151,16 +150,21 @@ def translate_feature(name): "MSR_ARCH_CAP_SKIP_L1DFL_VMENTRY": "skip-l1dfl-vmentry", "MSR_ARCH_CAP_TAA_NO": "taa-no", "MSR_CORE_CAP_SPLIT_LOCK_DETECT": "split-lock-detect", - - # always disabled features - "CPUID_EXT_MONITOR": None, - "0": None, - - # set to "no auto enable" by qemu - "CPUID_EXT3_TOPOEXT": None, - "MSR_VMX_BASIC_DUAL_MONITOR": None, } + ignore = any([ + name.startswith("VMX_"), + name.startswith("vmx-"), + name.startswith("MSR_VMX_"), + name in ("0", "model", "model-id", "stepping"), + name in ("CPUID_EXT_MONITOR", "monitor"), + name in ("MSR_VMX_BASIC_DUAL_MONITOR", "dual-monitor"), + name in ("CPUID_EXT3_TOPOEXT", "topoext"), + ]) + + if ignore: + return None + if name in T: return T[name] @@ -295,8 +299,6 @@ def expand_model(model): for k in [k for k in model if k.startswith(".features")]: v = model.pop(k) for feature in v.split(): - if feature.startswith("VMX_") or feature.startswith("MSR_VMX_"): - continue translated = translate_feature(feature) if translated: result["features"].add(translated)