Signed-off-by: Tim Wiederhake <twiederh(a)redhat.com>
---
src/cpu_map/sync_qemu_i386.py | 291 +++++++++++++++++-----------------
1 file changed, 149 insertions(+), 142 deletions(-)
diff --git a/src/cpu_map/sync_qemu_i386.py b/src/cpu_map/sync_qemu_i386.py
index fe95f26511..6a5a02dbd1 100755
--- a/src/cpu_map/sync_qemu_i386.py
+++ b/src/cpu_map/sync_qemu_i386.py
@@ -7,146 +7,6 @@ import os
import re
-T = {
- # translating qemu -> libvirt cpu feature names
- "CPUID_6_EAX_ARAT": "arat",
- "CPUID_7_0_EBX_ADX": "adx",
- "CPUID_7_0_EBX_AVX2": "avx2",
- "CPUID_7_0_EBX_AVX512BW": "avx512bw",
- "CPUID_7_0_EBX_AVX512CD": "avx512cd",
- "CPUID_7_0_EBX_AVX512DQ": "avx512dq",
- "CPUID_7_0_EBX_AVX512ER": "avx512er",
- "CPUID_7_0_EBX_AVX512F": "avx512f",
- "CPUID_7_0_EBX_AVX512PF": "avx512pf",
- "CPUID_7_0_EBX_AVX512VL": "avx512vl",
- "CPUID_7_0_EBX_BMI1": "bmi1",
- "CPUID_7_0_EBX_BMI2": "bmi2",
- "CPUID_7_0_EBX_CLFLUSHOPT": "clflushopt",
- "CPUID_7_0_EBX_CLWB": "clwb",
- "CPUID_7_0_EBX_ERMS": "erms",
- "CPUID_7_0_EBX_FSGSBASE": "fsgsbase",
- "CPUID_7_0_EBX_HLE": "hle",
- "CPUID_7_0_EBX_INVPCID": "invpcid",
- "CPUID_7_0_EBX_MPX": "mpx",
- "CPUID_7_0_EBX_RDSEED": "rdseed",
- "CPUID_7_0_EBX_RTM": "rtm",
- "CPUID_7_0_EBX_SHA_NI": "sha-ni",
- "CPUID_7_0_EBX_SMAP": "smap",
- "CPUID_7_0_EBX_SMEP": "smep",
- "CPUID_7_0_ECX_AVX512BITALG": "avx512bitalg",
- "CPUID_7_0_ECX_AVX512_VBMI2": "avx512vbmi2",
- "CPUID_7_0_ECX_AVX512_VBMI": "avx512vbmi",
- "CPUID_7_0_ECX_AVX512VNNI": "avx512vnni",
- "CPUID_7_0_ECX_AVX512_VPOPCNTDQ": "avx512-vpopcntdq",
- "CPUID_7_0_ECX_CLDEMOTE": "cldemote",
- "CPUID_7_0_ECX_GFNI": "gfni",
- "CPUID_7_0_ECX_LA57": "la57",
- "CPUID_7_0_ECX_MOVDIR64B": "movdir64b",
- "CPUID_7_0_ECX_MOVDIRI": "movdiri",
- "CPUID_7_0_ECX_PKU": "pku",
- "CPUID_7_0_ECX_RDPID": "rdpid",
- "CPUID_7_0_ECX_UMIP": "umip",
- "CPUID_7_0_ECX_VAES": "vaes",
- "CPUID_7_0_ECX_VPCLMULQDQ": "vpclmulqdq",
- "CPUID_7_0_EDX_ARCH_CAPABILITIES": "arch-capabilities",
- "CPUID_7_0_EDX_AVX512_4FMAPS": "avx512-4fmaps",
- "CPUID_7_0_EDX_AVX512_4VNNIW": "avx512-4vnniw",
- "CPUID_7_0_EDX_CORE_CAPABILITY": "core-capability",
- "CPUID_7_0_EDX_SPEC_CTRL": "spec-ctrl",
- "CPUID_7_0_EDX_SPEC_CTRL_SSBD": "ssbd",
- "CPUID_7_0_EDX_STIBP": "stibp",
- "CPUID_7_1_EAX_AVX512_BF16": "avx512-bf16",
- "CPUID_8000_0008_EBX_CLZERO": "clzero",
- "CPUID_8000_0008_EBX_IBPB": "ibpb",
- "CPUID_8000_0008_EBX_STIBP": "amd-stibp",
- "CPUID_8000_0008_EBX_WBNOINVD": "wbnoinvd",
- "CPUID_8000_0008_EBX_XSAVEERPTR": "xsaveerptr",
- "CPUID_ACPI": "acpi",
- "CPUID_APIC": "apic",
- "CPUID_CLFLUSH": "clflush",
- "CPUID_CMOV": "cmov",
- "CPUID_CX8": "cx8",
- "CPUID_DE": "de",
- "CPUID_EXT2_3DNOW": "3dnow",
- "CPUID_EXT2_3DNOWEXT": "3dnowext",
- "CPUID_EXT2_FFXSR": "fxsr_opt",
- "CPUID_EXT2_LM": "lm",
- "CPUID_EXT2_MMXEXT": "mmxext",
- "CPUID_EXT2_NX": "nx",
- "CPUID_EXT2_PDPE1GB": "pdpe1gb",
- "CPUID_EXT2_RDTSCP": "rdtscp",
- "CPUID_EXT2_SYSCALL": "syscall",
- "CPUID_EXT3_3DNOWPREFETCH": "3dnowprefetch",
- "CPUID_EXT3_ABM": "abm",
- "CPUID_EXT3_CR8LEG": "cr8legacy",
- "CPUID_EXT3_FMA4": "fma4",
- "CPUID_EXT3_LAHF_LM": "lahf_lm",
- "CPUID_EXT3_MISALIGNSSE": "misalignsse",
- "CPUID_EXT3_OSVW": "osvw",
- "CPUID_EXT3_PERFCORE": "perfctr_core",
- "CPUID_EXT3_SSE4A": "sse4a",
- "CPUID_EXT3_SVM": "svm",
- "CPUID_EXT3_TBM": "tbm",
- "CPUID_EXT3_XOP": "xop",
- "CPUID_EXT_AES": "aes",
- "CPUID_EXT_AVX": "avx",
- "CPUID_EXT_CX16": "cx16",
- "CPUID_EXT_F16C": "f16c",
- "CPUID_EXT_FMA": "fma",
- "CPUID_EXT_MOVBE": "movbe",
- "CPUID_EXT_PCID": "pcid",
- "CPUID_EXT_PCLMULQDQ": "pclmuldq",
- "CPUID_EXT_POPCNT": "popcnt",
- "CPUID_EXT_RDRAND": "rdrand",
- "CPUID_EXT_SSE3": "pni",
- "CPUID_EXT_SSE41": "sse4.1",
- "CPUID_EXT_SSE42": "sse4.2",
- "CPUID_EXT_SSSE3": "ssse3",
- "CPUID_EXT_TSC_DEADLINE_TIMER": "tsc-deadline",
- "CPUID_EXT_X2APIC": "x2apic",
- "CPUID_EXT_XSAVE": "xsave",
- "CPUID_FP87": "fpu",
- "CPUID_FXSR": "fxsr",
- "CPUID_MCA": "mca",
- "CPUID_MCE": "mce",
- "CPUID_MMX": "mmx",
- "CPUID_MSR": "msr",
- "CPUID_MTRR": "mtrr",
- "CPUID_PAE": "pae",
- "CPUID_PAT": "pat",
- "CPUID_PGE": "pge",
- "CPUID_PSE36": "pse36",
- "CPUID_PSE": "pse",
- "CPUID_SEP": "sep",
- "CPUID_SSE2": "sse2",
- "CPUID_SSE": "sse",
- "CPUID_SS": "ss",
- "CPUID_SVM_NPT": "npt",
- "CPUID_SVM_NRIPSAVE": "nrip-save",
- "CPUID_TSC": "tsc",
- "CPUID_VME": "vme",
- "CPUID_XSAVE_XGETBV1": "xgetbv1",
- "CPUID_XSAVE_XSAVEC": "xsavec",
- "CPUID_XSAVE_XSAVEOPT": "xsaveopt",
- "CPUID_XSAVE_XSAVES": "xsaves",
- "MSR_ARCH_CAP_IBRS_ALL": "ibrs-all",
- "MSR_ARCH_CAP_MDS_NO": "mds-no",
- "MSR_ARCH_CAP_PSCHANGE_MC_NO": "pschange-mc-no",
- "MSR_ARCH_CAP_RDCL_NO": "rdctl-no",
- "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,
-}
-
-
def translate_vendor(name):
T = {
"CPUID_VENDOR_AMD": "AMD",
@@ -161,6 +21,153 @@ def translate_vendor(name):
return 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",
+ "CPUID_7_0_EBX_AVX512BW": "avx512bw",
+ "CPUID_7_0_EBX_AVX512CD": "avx512cd",
+ "CPUID_7_0_EBX_AVX512DQ": "avx512dq",
+ "CPUID_7_0_EBX_AVX512ER": "avx512er",
+ "CPUID_7_0_EBX_AVX512F": "avx512f",
+ "CPUID_7_0_EBX_AVX512PF": "avx512pf",
+ "CPUID_7_0_EBX_AVX512VL": "avx512vl",
+ "CPUID_7_0_EBX_BMI1": "bmi1",
+ "CPUID_7_0_EBX_BMI2": "bmi2",
+ "CPUID_7_0_EBX_CLFLUSHOPT": "clflushopt",
+ "CPUID_7_0_EBX_CLWB": "clwb",
+ "CPUID_7_0_EBX_ERMS": "erms",
+ "CPUID_7_0_EBX_FSGSBASE": "fsgsbase",
+ "CPUID_7_0_EBX_HLE": "hle",
+ "CPUID_7_0_EBX_INVPCID": "invpcid",
+ "CPUID_7_0_EBX_MPX": "mpx",
+ "CPUID_7_0_EBX_RDSEED": "rdseed",
+ "CPUID_7_0_EBX_RTM": "rtm",
+ "CPUID_7_0_EBX_SHA_NI": "sha-ni",
+ "CPUID_7_0_EBX_SMAP": "smap",
+ "CPUID_7_0_EBX_SMEP": "smep",
+ "CPUID_7_0_ECX_AVX512BITALG": "avx512bitalg",
+ "CPUID_7_0_ECX_AVX512_VBMI2": "avx512vbmi2",
+ "CPUID_7_0_ECX_AVX512_VBMI": "avx512vbmi",
+ "CPUID_7_0_ECX_AVX512VNNI": "avx512vnni",
+ "CPUID_7_0_ECX_AVX512_VPOPCNTDQ": "avx512-vpopcntdq",
+ "CPUID_7_0_ECX_CLDEMOTE": "cldemote",
+ "CPUID_7_0_ECX_GFNI": "gfni",
+ "CPUID_7_0_ECX_LA57": "la57",
+ "CPUID_7_0_ECX_MOVDIR64B": "movdir64b",
+ "CPUID_7_0_ECX_MOVDIRI": "movdiri",
+ "CPUID_7_0_ECX_PKU": "pku",
+ "CPUID_7_0_ECX_RDPID": "rdpid",
+ "CPUID_7_0_ECX_UMIP": "umip",
+ "CPUID_7_0_ECX_VAES": "vaes",
+ "CPUID_7_0_ECX_VPCLMULQDQ": "vpclmulqdq",
+ "CPUID_7_0_EDX_ARCH_CAPABILITIES": "arch-capabilities",
+ "CPUID_7_0_EDX_AVX512_4FMAPS": "avx512-4fmaps",
+ "CPUID_7_0_EDX_AVX512_4VNNIW": "avx512-4vnniw",
+ "CPUID_7_0_EDX_CORE_CAPABILITY": "core-capability",
+ "CPUID_7_0_EDX_SPEC_CTRL": "spec-ctrl",
+ "CPUID_7_0_EDX_SPEC_CTRL_SSBD": "ssbd",
+ "CPUID_7_0_EDX_STIBP": "stibp",
+ "CPUID_7_1_EAX_AVX512_BF16": "avx512-bf16",
+ "CPUID_8000_0008_EBX_CLZERO": "clzero",
+ "CPUID_8000_0008_EBX_IBPB": "ibpb",
+ "CPUID_8000_0008_EBX_STIBP": "amd-stibp",
+ "CPUID_8000_0008_EBX_WBNOINVD": "wbnoinvd",
+ "CPUID_8000_0008_EBX_XSAVEERPTR": "xsaveerptr",
+ "CPUID_ACPI": "acpi",
+ "CPUID_APIC": "apic",
+ "CPUID_CLFLUSH": "clflush",
+ "CPUID_CMOV": "cmov",
+ "CPUID_CX8": "cx8",
+ "CPUID_DE": "de",
+ "CPUID_EXT2_3DNOW": "3dnow",
+ "CPUID_EXT2_3DNOWEXT": "3dnowext",
+ "CPUID_EXT2_FFXSR": "fxsr_opt",
+ "CPUID_EXT2_LM": "lm",
+ "CPUID_EXT2_MMXEXT": "mmxext",
+ "CPUID_EXT2_NX": "nx",
+ "CPUID_EXT2_PDPE1GB": "pdpe1gb",
+ "CPUID_EXT2_RDTSCP": "rdtscp",
+ "CPUID_EXT2_SYSCALL": "syscall",
+ "CPUID_EXT3_3DNOWPREFETCH": "3dnowprefetch",
+ "CPUID_EXT3_ABM": "abm",
+ "CPUID_EXT3_CR8LEG": "cr8legacy",
+ "CPUID_EXT3_FMA4": "fma4",
+ "CPUID_EXT3_LAHF_LM": "lahf_lm",
+ "CPUID_EXT3_MISALIGNSSE": "misalignsse",
+ "CPUID_EXT3_OSVW": "osvw",
+ "CPUID_EXT3_PERFCORE": "perfctr_core",
+ "CPUID_EXT3_SSE4A": "sse4a",
+ "CPUID_EXT3_SVM": "svm",
+ "CPUID_EXT3_TBM": "tbm",
+ "CPUID_EXT3_XOP": "xop",
+ "CPUID_EXT_AES": "aes",
+ "CPUID_EXT_AVX": "avx",
+ "CPUID_EXT_CX16": "cx16",
+ "CPUID_EXT_F16C": "f16c",
+ "CPUID_EXT_FMA": "fma",
+ "CPUID_EXT_MOVBE": "movbe",
+ "CPUID_EXT_PCID": "pcid",
+ "CPUID_EXT_PCLMULQDQ": "pclmuldq",
+ "CPUID_EXT_POPCNT": "popcnt",
+ "CPUID_EXT_RDRAND": "rdrand",
+ "CPUID_EXT_SSE3": "pni",
+ "CPUID_EXT_SSE41": "sse4.1",
+ "CPUID_EXT_SSE42": "sse4.2",
+ "CPUID_EXT_SSSE3": "ssse3",
+ "CPUID_EXT_TSC_DEADLINE_TIMER": "tsc-deadline",
+ "CPUID_EXT_X2APIC": "x2apic",
+ "CPUID_EXT_XSAVE": "xsave",
+ "CPUID_FP87": "fpu",
+ "CPUID_FXSR": "fxsr",
+ "CPUID_MCA": "mca",
+ "CPUID_MCE": "mce",
+ "CPUID_MMX": "mmx",
+ "CPUID_MSR": "msr",
+ "CPUID_MTRR": "mtrr",
+ "CPUID_PAE": "pae",
+ "CPUID_PAT": "pat",
+ "CPUID_PGE": "pge",
+ "CPUID_PSE36": "pse36",
+ "CPUID_PSE": "pse",
+ "CPUID_SEP": "sep",
+ "CPUID_SSE2": "sse2",
+ "CPUID_SSE": "sse",
+ "CPUID_SS": "ss",
+ "CPUID_SVM_NPT": "npt",
+ "CPUID_SVM_NRIPSAVE": "nrip-save",
+ "CPUID_TSC": "tsc",
+ "CPUID_VME": "vme",
+ "CPUID_XSAVE_XGETBV1": "xgetbv1",
+ "CPUID_XSAVE_XSAVEC": "xsavec",
+ "CPUID_XSAVE_XSAVEOPT": "xsaveopt",
+ "CPUID_XSAVE_XSAVES": "xsaves",
+ "MSR_ARCH_CAP_IBRS_ALL": "ibrs-all",
+ "MSR_ARCH_CAP_MDS_NO": "mds-no",
+ "MSR_ARCH_CAP_PSCHANGE_MC_NO": "pschange-mc-no",
+ "MSR_ARCH_CAP_RDCL_NO": "rdctl-no",
+ "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,
+ }
+
+ if name in T:
+ return T[name]
+
+ print("warning: Unknown feature '{}'".format(name))
+ return name
+
+
def readline_cont(f):
"""Read one logical line from a file `f` i.e. continues lines that end
in
a backslash."""
@@ -286,7 +293,7 @@ def expand_model(model):
for feature in v.split():
if feature.startswith("VMX_") or
feature.startswith("MSR_VMX_"):
continue
- translated = T.get(feature, feature)
+ translated = translate_feature(feature)
if translated:
result["features"].add(translated)
@@ -302,7 +309,7 @@ def expand_model(model):
props = version.pop(".props", dict())
for k, v in props:
if k not in ("model-id", "stepping", "model"):
- k = T.get(k, k)
+ k = translate_feature(k)
if v == "on":
result["features"].add(k)
elif v == "off" and k in result["features"]:
--
2.26.2