qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] Generate x86 cpu features
@ 2023-08-11 13:50 Tim Wiederhake
  2023-08-11 13:50 ` [PATCH 1/4] target/i386: Split out feature_word_info Tim Wiederhake
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Tim Wiederhake @ 2023-08-11 13:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: Tim Wiederhake

Synchronizing the list of cpu features and models with qemu is a recurring
task in libvirt. For x86, this is done by reading qom-list-properties for
max-x86_64-cpu and manually filtering out everthing that does not look like
a feature name, as well as parsing target/i386/cpu.c for cpu models.

This is a flawed, tedious and error-prone procedure. Ideally, qemu
and libvirt would query a common source for cpu feature and model
related information. Meanwhile, converting this information into an easier
to parse format would help libvirt a lot.

This patch series converts the cpu feature information present in
target/i386/cpu.c (`feature_word_info`) into an xml file and adds a
script to generate the c code from this xml.

A patch set to convert the cpu model data (`builtin_x86_defs`) in the
same way will follow.

Tim Wiederhake (4):
  target/i386: Split out feature_word_info
  target/i386: Translate feature_word_info to xml
  target/i386: Format feature_word_info.c.inc
  target/i386: Autogenerate feature_word_info.c.inc

 target/i386/cpu.c                   |  677 +----------
 target/i386/feature_word_info.c.inc |  704 ++++++++++++
 target/i386/feature_word_info.py    |  110 ++
 target/i386/feature_word_info.xml   | 1610 +++++++++++++++++++++++++++
 4 files changed, 2425 insertions(+), 676 deletions(-)
 create mode 100644 target/i386/feature_word_info.c.inc
 create mode 100755 target/i386/feature_word_info.py
 create mode 100644 target/i386/feature_word_info.xml

-- 
2.39.2



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/4] target/i386: Split out feature_word_info
  2023-08-11 13:50 [PATCH 0/4] Generate x86 cpu features Tim Wiederhake
@ 2023-08-11 13:50 ` Tim Wiederhake
  2023-09-06 14:34   ` Philippe Mathieu-Daudé
  2023-08-11 13:50 ` [PATCH 2/4] target/i386: Translate feature_word_info to xml Tim Wiederhake
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Tim Wiederhake @ 2023-08-11 13:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: Tim Wiederhake

The isolated part will be generated by a script.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
---
 target/i386/cpu.c                   | 677 +---------------------------
 target/i386/feature_word_info.c.inc | 676 +++++++++++++++++++++++++++
 2 files changed, 677 insertions(+), 676 deletions(-)
 create mode 100644 target/i386/feature_word_info.c.inc

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 97ad229d8b..d44a5b300e 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -762,682 +762,7 @@ void x86_cpu_vendor_words2str(char *dst, uint32_t vendor1,
 #define TCG_8000_0008_EBX  (CPUID_8000_0008_EBX_XSAVEERPTR | \
           CPUID_8000_0008_EBX_WBNOINVD | CPUID_8000_0008_EBX_KERNEL_FEATURES)
 
-FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
-    [FEAT_1_EDX] = {
-        .type = CPUID_FEATURE_WORD,
-        .feat_names = {
-            "fpu", "vme", "de", "pse",
-            "tsc", "msr", "pae", "mce",
-            "cx8", "apic", NULL, "sep",
-            "mtrr", "pge", "mca", "cmov",
-            "pat", "pse36", "pn" /* Intel psn */, "clflush" /* Intel clfsh */,
-            NULL, "ds" /* Intel dts */, "acpi", "mmx",
-            "fxsr", "sse", "sse2", "ss",
-            "ht" /* Intel htt */, "tm", "ia64", "pbe",
-        },
-        .cpuid = {.eax = 1, .reg = R_EDX, },
-        .tcg_features = TCG_FEATURES,
-    },
-    [FEAT_1_ECX] = {
-        .type = CPUID_FEATURE_WORD,
-        .feat_names = {
-            "pni" /* Intel,AMD sse3 */, "pclmulqdq", "dtes64", "monitor",
-            "ds-cpl", "vmx", "smx", "est",
-            "tm2", "ssse3", "cid", NULL,
-            "fma", "cx16", "xtpr", "pdcm",
-            NULL, "pcid", "dca", "sse4.1",
-            "sse4.2", "x2apic", "movbe", "popcnt",
-            "tsc-deadline", "aes", "xsave", NULL /* osxsave */,
-            "avx", "f16c", "rdrand", "hypervisor",
-        },
-        .cpuid = { .eax = 1, .reg = R_ECX, },
-        .tcg_features = TCG_EXT_FEATURES,
-    },
-    /* Feature names that are already defined on feature_name[] but
-     * are set on CPUID[8000_0001].EDX on AMD CPUs don't have their
-     * names on feat_names below. They are copied automatically
-     * to features[FEAT_8000_0001_EDX] if and only if CPU vendor is AMD.
-     */
-    [FEAT_8000_0001_EDX] = {
-        .type = CPUID_FEATURE_WORD,
-        .feat_names = {
-            NULL /* fpu */, NULL /* vme */, NULL /* de */, NULL /* pse */,
-            NULL /* tsc */, NULL /* msr */, NULL /* pae */, NULL /* mce */,
-            NULL /* cx8 */, NULL /* apic */, NULL, "syscall",
-            NULL /* mtrr */, NULL /* pge */, NULL /* mca */, NULL /* cmov */,
-            NULL /* pat */, NULL /* pse36 */, NULL, NULL /* Linux mp */,
-            "nx", NULL, "mmxext", NULL /* mmx */,
-            NULL /* fxsr */, "fxsr-opt", "pdpe1gb", "rdtscp",
-            NULL, "lm", "3dnowext", "3dnow",
-        },
-        .cpuid = { .eax = 0x80000001, .reg = R_EDX, },
-        .tcg_features = TCG_EXT2_FEATURES,
-    },
-    [FEAT_8000_0001_ECX] = {
-        .type = CPUID_FEATURE_WORD,
-        .feat_names = {
-            "lahf-lm", "cmp-legacy", "svm", "extapic",
-            "cr8legacy", "abm", "sse4a", "misalignsse",
-            "3dnowprefetch", "osvw", "ibs", "xop",
-            "skinit", "wdt", NULL, "lwp",
-            "fma4", "tce", NULL, "nodeid-msr",
-            NULL, "tbm", "topoext", "perfctr-core",
-            "perfctr-nb", NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-        },
-        .cpuid = { .eax = 0x80000001, .reg = R_ECX, },
-        .tcg_features = TCG_EXT3_FEATURES,
-        /*
-         * TOPOEXT is always allowed but can't be enabled blindly by
-         * "-cpu host", as it requires consistent cache topology info
-         * to be provided so it doesn't confuse guests.
-         */
-        .no_autoenable_flags = CPUID_EXT3_TOPOEXT,
-    },
-    [FEAT_C000_0001_EDX] = {
-        .type = CPUID_FEATURE_WORD,
-        .feat_names = {
-            NULL, NULL, "xstore", "xstore-en",
-            NULL, NULL, "xcrypt", "xcrypt-en",
-            "ace2", "ace2-en", "phe", "phe-en",
-            "pmm", "pmm-en", NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-        },
-        .cpuid = { .eax = 0xC0000001, .reg = R_EDX, },
-        .tcg_features = TCG_EXT4_FEATURES,
-    },
-    [FEAT_KVM] = {
-        .type = CPUID_FEATURE_WORD,
-        .feat_names = {
-            "kvmclock", "kvm-nopiodelay", "kvm-mmu", "kvmclock",
-            "kvm-asyncpf", "kvm-steal-time", "kvm-pv-eoi", "kvm-pv-unhalt",
-            NULL, "kvm-pv-tlb-flush", NULL, "kvm-pv-ipi",
-            "kvm-poll-control", "kvm-pv-sched-yield", "kvm-asyncpf-int", "kvm-msi-ext-dest-id",
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            "kvmclock-stable-bit", NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-        },
-        .cpuid = { .eax = KVM_CPUID_FEATURES, .reg = R_EAX, },
-        .tcg_features = TCG_KVM_FEATURES,
-    },
-    [FEAT_KVM_HINTS] = {
-        .type = CPUID_FEATURE_WORD,
-        .feat_names = {
-            "kvm-hint-dedicated", NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-        },
-        .cpuid = { .eax = KVM_CPUID_FEATURES, .reg = R_EDX, },
-        .tcg_features = TCG_KVM_FEATURES,
-        /*
-         * KVM hints aren't auto-enabled by -cpu host, they need to be
-         * explicitly enabled in the command-line.
-         */
-        .no_autoenable_flags = ~0U,
-    },
-    [FEAT_SVM] = {
-        .type = CPUID_FEATURE_WORD,
-        .feat_names = {
-            "npt", "lbrv", "svm-lock", "nrip-save",
-            "tsc-scale", "vmcb-clean",  "flushbyasid", "decodeassists",
-            NULL, NULL, "pause-filter", NULL,
-            "pfthreshold", "avic", NULL, "v-vmsave-vmload",
-            "vgif", NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, "vnmi", NULL, NULL,
-            "svme-addr-chk", NULL, NULL, NULL,
-        },
-        .cpuid = { .eax = 0x8000000A, .reg = R_EDX, },
-        .tcg_features = TCG_SVM_FEATURES,
-    },
-    [FEAT_7_0_EBX] = {
-        .type = CPUID_FEATURE_WORD,
-        .feat_names = {
-            "fsgsbase", "tsc-adjust", "sgx", "bmi1",
-            "hle", "avx2", NULL, "smep",
-            "bmi2", "erms", "invpcid", "rtm",
-            NULL, NULL, "mpx", NULL,
-            "avx512f", "avx512dq", "rdseed", "adx",
-            "smap", "avx512ifma", "pcommit", "clflushopt",
-            "clwb", "intel-pt", "avx512pf", "avx512er",
-            "avx512cd", "sha-ni", "avx512bw", "avx512vl",
-        },
-        .cpuid = {
-            .eax = 7,
-            .needs_ecx = true, .ecx = 0,
-            .reg = R_EBX,
-        },
-        .tcg_features = TCG_7_0_EBX_FEATURES,
-    },
-    [FEAT_7_0_ECX] = {
-        .type = CPUID_FEATURE_WORD,
-        .feat_names = {
-            NULL, "avx512vbmi", "umip", "pku",
-            NULL /* ospke */, "waitpkg", "avx512vbmi2", NULL,
-            "gfni", "vaes", "vpclmulqdq", "avx512vnni",
-            "avx512bitalg", NULL, "avx512-vpopcntdq", NULL,
-            "la57", NULL, NULL, NULL,
-            NULL, NULL, "rdpid", NULL,
-            "bus-lock-detect", "cldemote", NULL, "movdiri",
-            "movdir64b", NULL, "sgxlc", "pks",
-        },
-        .cpuid = {
-            .eax = 7,
-            .needs_ecx = true, .ecx = 0,
-            .reg = R_ECX,
-        },
-        .tcg_features = TCG_7_0_ECX_FEATURES,
-    },
-    [FEAT_7_0_EDX] = {
-        .type = CPUID_FEATURE_WORD,
-        .feat_names = {
-            NULL, NULL, "avx512-4vnniw", "avx512-4fmaps",
-            "fsrm", NULL, NULL, NULL,
-            "avx512-vp2intersect", NULL, "md-clear", NULL,
-            NULL, NULL, "serialize", NULL,
-            "tsx-ldtrk", NULL, NULL /* pconfig */, "arch-lbr",
-            NULL, NULL, "amx-bf16", "avx512-fp16",
-            "amx-tile", "amx-int8", "spec-ctrl", "stibp",
-            "flush-l1d", "arch-capabilities", "core-capability", "ssbd",
-        },
-        .cpuid = {
-            .eax = 7,
-            .needs_ecx = true, .ecx = 0,
-            .reg = R_EDX,
-        },
-        .tcg_features = TCG_7_0_EDX_FEATURES,
-    },
-    [FEAT_7_1_EAX] = {
-        .type = CPUID_FEATURE_WORD,
-        .feat_names = {
-            NULL, NULL, NULL, NULL,
-            "avx-vnni", "avx512-bf16", NULL, "cmpccxadd",
-            NULL, NULL, "fzrm", "fsrs",
-            "fsrc", NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, "amx-fp16", NULL, "avx-ifma",
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-        },
-        .cpuid = {
-            .eax = 7,
-            .needs_ecx = true, .ecx = 1,
-            .reg = R_EAX,
-        },
-        .tcg_features = TCG_7_1_EAX_FEATURES,
-    },
-    [FEAT_7_1_EDX] = {
-        .type = CPUID_FEATURE_WORD,
-        .feat_names = {
-            NULL, NULL, NULL, NULL,
-            "avx-vnni-int8", "avx-ne-convert", NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, "prefetchiti", NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-        },
-        .cpuid = {
-            .eax = 7,
-            .needs_ecx = true, .ecx = 1,
-            .reg = R_EDX,
-        },
-        .tcg_features = TCG_7_1_EDX_FEATURES,
-    },
-    [FEAT_7_2_EDX] = {
-        .type = CPUID_FEATURE_WORD,
-        .feat_names = {
-            NULL, NULL, NULL, NULL,
-            NULL, "mcdt-no", NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-        },
-        .cpuid = {
-            .eax = 7,
-            .needs_ecx = true, .ecx = 2,
-            .reg = R_EDX,
-        },
-        .tcg_features = TCG_7_2_EDX_FEATURES,
-    },
-    [FEAT_8000_0007_EDX] = {
-        .type = CPUID_FEATURE_WORD,
-        .feat_names = {
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            "invtsc", NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-        },
-        .cpuid = { .eax = 0x80000007, .reg = R_EDX, },
-        .tcg_features = TCG_APM_FEATURES,
-        .unmigratable_flags = CPUID_APM_INVTSC,
-    },
-    [FEAT_8000_0008_EBX] = {
-        .type = CPUID_FEATURE_WORD,
-        .feat_names = {
-            "clzero", NULL, "xsaveerptr", NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, "wbnoinvd", NULL, NULL,
-            "ibpb", NULL, "ibrs", "amd-stibp",
-            NULL, "stibp-always-on", NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            "amd-ssbd", "virt-ssbd", "amd-no-ssb", NULL,
-            "amd-psfd", NULL, NULL, NULL,
-        },
-        .cpuid = { .eax = 0x80000008, .reg = R_EBX, },
-        .tcg_features = TCG_8000_0008_EBX,
-        .unmigratable_flags = 0,
-    },
-    [FEAT_8000_0021_EAX] = {
-        .type = CPUID_FEATURE_WORD,
-        .feat_names = {
-            "no-nested-data-bp", NULL, "lfence-always-serializing", NULL,
-            NULL, NULL, "null-sel-clr-base", NULL,
-            "auto-ibrs", NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-        },
-        .cpuid = { .eax = 0x80000021, .reg = R_EAX, },
-        .tcg_features = 0,
-        .unmigratable_flags = 0,
-    },
-    [FEAT_XSAVE] = {
-        .type = CPUID_FEATURE_WORD,
-        .feat_names = {
-            "xsaveopt", "xsavec", "xgetbv1", "xsaves",
-            "xfd", NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-        },
-        .cpuid = {
-            .eax = 0xd,
-            .needs_ecx = true, .ecx = 1,
-            .reg = R_EAX,
-        },
-        .tcg_features = TCG_XSAVE_FEATURES,
-    },
-    [FEAT_XSAVE_XSS_LO] = {
-        .type = CPUID_FEATURE_WORD,
-        .feat_names = {
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-        },
-        .cpuid = {
-            .eax = 0xD,
-            .needs_ecx = true,
-            .ecx = 1,
-            .reg = R_ECX,
-        },
-    },
-    [FEAT_XSAVE_XSS_HI] = {
-        .type = CPUID_FEATURE_WORD,
-        .cpuid = {
-            .eax = 0xD,
-            .needs_ecx = true,
-            .ecx = 1,
-            .reg = R_EDX
-        },
-    },
-    [FEAT_6_EAX] = {
-        .type = CPUID_FEATURE_WORD,
-        .feat_names = {
-            NULL, NULL, "arat", NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-        },
-        .cpuid = { .eax = 6, .reg = R_EAX, },
-        .tcg_features = TCG_6_EAX_FEATURES,
-    },
-    [FEAT_XSAVE_XCR0_LO] = {
-        .type = CPUID_FEATURE_WORD,
-        .cpuid = {
-            .eax = 0xD,
-            .needs_ecx = true, .ecx = 0,
-            .reg = R_EAX,
-        },
-        .tcg_features = ~0U,
-        .migratable_flags = XSTATE_FP_MASK | XSTATE_SSE_MASK |
-            XSTATE_YMM_MASK | XSTATE_BNDREGS_MASK | XSTATE_BNDCSR_MASK |
-            XSTATE_OPMASK_MASK | XSTATE_ZMM_Hi256_MASK | XSTATE_Hi16_ZMM_MASK |
-            XSTATE_PKRU_MASK,
-    },
-    [FEAT_XSAVE_XCR0_HI] = {
-        .type = CPUID_FEATURE_WORD,
-        .cpuid = {
-            .eax = 0xD,
-            .needs_ecx = true, .ecx = 0,
-            .reg = R_EDX,
-        },
-        .tcg_features = ~0U,
-    },
-    /*Below are MSR exposed features*/
-    [FEAT_ARCH_CAPABILITIES] = {
-        .type = MSR_FEATURE_WORD,
-        .feat_names = {
-            "rdctl-no", "ibrs-all", "rsba", "skip-l1dfl-vmentry",
-            "ssb-no", "mds-no", "pschange-mc-no", "tsx-ctrl",
-            "taa-no", NULL, NULL, NULL,
-            NULL, "sbdr-ssdp-no", "fbsdp-no", "psdp-no",
-            NULL, "fb-clear", NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            "pbrsb-no", NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-        },
-        .msr = {
-            .index = MSR_IA32_ARCH_CAPABILITIES,
-        },
-        /*
-         * FEAT_ARCH_CAPABILITIES only affects a read-only MSR, which
-         * cannot be read from user mode.  Therefore, it has no impact
-         > on any user-mode operation, and warnings about unsupported
-         * features do not matter.
-         */
-        .tcg_features = ~0U,
-    },
-    [FEAT_CORE_CAPABILITY] = {
-        .type = MSR_FEATURE_WORD,
-        .feat_names = {
-            NULL, NULL, NULL, NULL,
-            NULL, "split-lock-detect", NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-        },
-        .msr = {
-            .index = MSR_IA32_CORE_CAPABILITY,
-        },
-    },
-    [FEAT_PERF_CAPABILITIES] = {
-        .type = MSR_FEATURE_WORD,
-        .feat_names = {
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, "full-width-write", NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-        },
-        .msr = {
-            .index = MSR_IA32_PERF_CAPABILITIES,
-        },
-    },
-
-    [FEAT_VMX_PROCBASED_CTLS] = {
-        .type = MSR_FEATURE_WORD,
-        .feat_names = {
-            NULL, NULL, "vmx-vintr-pending", "vmx-tsc-offset",
-            NULL, NULL, NULL, "vmx-hlt-exit",
-            NULL, "vmx-invlpg-exit", "vmx-mwait-exit", "vmx-rdpmc-exit",
-            "vmx-rdtsc-exit", NULL, NULL, "vmx-cr3-load-noexit",
-            "vmx-cr3-store-noexit", NULL, NULL, "vmx-cr8-load-exit",
-            "vmx-cr8-store-exit", "vmx-flexpriority", "vmx-vnmi-pending", "vmx-movdr-exit",
-            "vmx-io-exit", "vmx-io-bitmap", NULL, "vmx-mtf",
-            "vmx-msr-bitmap", "vmx-monitor-exit", "vmx-pause-exit", "vmx-secondary-ctls",
-        },
-        .msr = {
-            .index = MSR_IA32_VMX_TRUE_PROCBASED_CTLS,
-        }
-    },
-
-    [FEAT_VMX_SECONDARY_CTLS] = {
-        .type = MSR_FEATURE_WORD,
-        .feat_names = {
-            "vmx-apicv-xapic", "vmx-ept", "vmx-desc-exit", "vmx-rdtscp-exit",
-            "vmx-apicv-x2apic", "vmx-vpid", "vmx-wbinvd-exit", "vmx-unrestricted-guest",
-            "vmx-apicv-register", "vmx-apicv-vid", "vmx-ple", "vmx-rdrand-exit",
-            "vmx-invpcid-exit", "vmx-vmfunc", "vmx-shadow-vmcs", "vmx-encls-exit",
-            "vmx-rdseed-exit", "vmx-pml", NULL, NULL,
-            "vmx-xsaves", NULL, NULL, NULL,
-            NULL, "vmx-tsc-scaling", NULL, NULL,
-            NULL, NULL, NULL, NULL,
-        },
-        .msr = {
-            .index = MSR_IA32_VMX_PROCBASED_CTLS2,
-        }
-    },
-
-    [FEAT_VMX_PINBASED_CTLS] = {
-        .type = MSR_FEATURE_WORD,
-        .feat_names = {
-            "vmx-intr-exit", NULL, NULL, "vmx-nmi-exit",
-            NULL, "vmx-vnmi", "vmx-preemption-timer", "vmx-posted-intr",
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-        },
-        .msr = {
-            .index = MSR_IA32_VMX_TRUE_PINBASED_CTLS,
-        }
-    },
-
-    [FEAT_VMX_EXIT_CTLS] = {
-        .type = MSR_FEATURE_WORD,
-        /*
-         * VMX_VM_EXIT_HOST_ADDR_SPACE_SIZE is copied from
-         * the LM CPUID bit.
-         */
-        .feat_names = {
-            NULL, NULL, "vmx-exit-nosave-debugctl", NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL /* vmx-exit-host-addr-space-size */, NULL, NULL,
-            "vmx-exit-load-perf-global-ctrl", NULL, NULL, "vmx-exit-ack-intr",
-            NULL, NULL, "vmx-exit-save-pat", "vmx-exit-load-pat",
-            "vmx-exit-save-efer", "vmx-exit-load-efer",
-                "vmx-exit-save-preemption-timer", "vmx-exit-clear-bndcfgs",
-            NULL, "vmx-exit-clear-rtit-ctl", NULL, NULL,
-            NULL, "vmx-exit-load-pkrs", NULL, NULL,
-        },
-        .msr = {
-            .index = MSR_IA32_VMX_TRUE_EXIT_CTLS,
-        }
-    },
-
-    [FEAT_VMX_ENTRY_CTLS] = {
-        .type = MSR_FEATURE_WORD,
-        .feat_names = {
-            NULL, NULL, "vmx-entry-noload-debugctl", NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, "vmx-entry-ia32e-mode", NULL, NULL,
-            NULL, "vmx-entry-load-perf-global-ctrl", "vmx-entry-load-pat", "vmx-entry-load-efer",
-            "vmx-entry-load-bndcfgs", NULL, "vmx-entry-load-rtit-ctl", NULL,
-            NULL, NULL, "vmx-entry-load-pkrs", NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-        },
-        .msr = {
-            .index = MSR_IA32_VMX_TRUE_ENTRY_CTLS,
-        }
-    },
-
-    [FEAT_VMX_MISC] = {
-        .type = MSR_FEATURE_WORD,
-        .feat_names = {
-            NULL, NULL, NULL, NULL,
-            NULL, "vmx-store-lma", "vmx-activity-hlt", "vmx-activity-shutdown",
-            "vmx-activity-wait-sipi", NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, "vmx-vmwrite-vmexit-fields", "vmx-zero-len-inject", NULL,
-        },
-        .msr = {
-            .index = MSR_IA32_VMX_MISC,
-        }
-    },
-
-    [FEAT_VMX_EPT_VPID_CAPS] = {
-        .type = MSR_FEATURE_WORD,
-        .feat_names = {
-            "vmx-ept-execonly", NULL, NULL, NULL,
-            NULL, NULL, "vmx-page-walk-4", "vmx-page-walk-5",
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            "vmx-ept-2mb", "vmx-ept-1gb", NULL, NULL,
-            "vmx-invept", "vmx-eptad", "vmx-ept-advanced-exitinfo", NULL,
-            NULL, "vmx-invept-single-context", "vmx-invept-all-context", NULL,
-            NULL, NULL, NULL, NULL,
-            "vmx-invvpid", NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            "vmx-invvpid-single-addr", "vmx-invept-single-context",
-                "vmx-invvpid-all-context", "vmx-invept-single-context-noglobals",
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-        },
-        .msr = {
-            .index = MSR_IA32_VMX_EPT_VPID_CAP,
-        }
-    },
-
-    [FEAT_VMX_BASIC] = {
-        .type = MSR_FEATURE_WORD,
-        .feat_names = {
-            [54] = "vmx-ins-outs",
-            [55] = "vmx-true-ctls",
-        },
-        .msr = {
-            .index = MSR_IA32_VMX_BASIC,
-        },
-        /* Just to be safe - we don't support setting the MSEG version field.  */
-        .no_autoenable_flags = MSR_VMX_BASIC_DUAL_MONITOR,
-    },
-
-    [FEAT_VMX_VMFUNC] = {
-        .type = MSR_FEATURE_WORD,
-        .feat_names = {
-            [0] = "vmx-eptp-switching",
-        },
-        .msr = {
-            .index = MSR_IA32_VMX_VMFUNC,
-        }
-    },
-
-    [FEAT_14_0_ECX] = {
-        .type = CPUID_FEATURE_WORD,
-        .feat_names = {
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, "intel-pt-lip",
-        },
-        .cpuid = {
-            .eax = 0x14,
-            .needs_ecx = true, .ecx = 0,
-            .reg = R_ECX,
-        },
-        .tcg_features = TCG_14_0_ECX_FEATURES,
-     },
-
-    [FEAT_SGX_12_0_EAX] = {
-        .type = CPUID_FEATURE_WORD,
-        .feat_names = {
-            "sgx1", "sgx2", NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, "sgx-edeccssa",
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-        },
-        .cpuid = {
-            .eax = 0x12,
-            .needs_ecx = true, .ecx = 0,
-            .reg = R_EAX,
-        },
-        .tcg_features = TCG_SGX_12_0_EAX_FEATURES,
-    },
-
-    [FEAT_SGX_12_0_EBX] = {
-        .type = CPUID_FEATURE_WORD,
-        .feat_names = {
-            "sgx-exinfo" , NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-        },
-        .cpuid = {
-            .eax = 0x12,
-            .needs_ecx = true, .ecx = 0,
-            .reg = R_EBX,
-        },
-        .tcg_features = TCG_SGX_12_0_EBX_FEATURES,
-    },
-
-    [FEAT_SGX_12_1_EAX] = {
-        .type = CPUID_FEATURE_WORD,
-        .feat_names = {
-            NULL, "sgx-debug", "sgx-mode64", NULL,
-            "sgx-provisionkey", "sgx-tokenkey", NULL, "sgx-kss",
-            NULL, NULL, "sgx-aex-notify", NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
-        },
-        .cpuid = {
-            .eax = 0x12,
-            .needs_ecx = true, .ecx = 1,
-            .reg = R_EAX,
-        },
-        .tcg_features = TCG_SGX_12_1_EAX_FEATURES,
-    },
-};
+#include "feature_word_info.c.inc"
 
 typedef struct FeatureMask {
     FeatureWord index;
diff --git a/target/i386/feature_word_info.c.inc b/target/i386/feature_word_info.c.inc
new file mode 100644
index 0000000000..bba7975eab
--- /dev/null
+++ b/target/i386/feature_word_info.c.inc
@@ -0,0 +1,676 @@
+FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
+    [FEAT_1_EDX] = {
+        .type = CPUID_FEATURE_WORD,
+        .feat_names = {
+            "fpu", "vme", "de", "pse",
+            "tsc", "msr", "pae", "mce",
+            "cx8", "apic", NULL, "sep",
+            "mtrr", "pge", "mca", "cmov",
+            "pat", "pse36", "pn" /* Intel psn */, "clflush" /* Intel clfsh */,
+            NULL, "ds" /* Intel dts */, "acpi", "mmx",
+            "fxsr", "sse", "sse2", "ss",
+            "ht" /* Intel htt */, "tm", "ia64", "pbe",
+        },
+        .cpuid = {.eax = 1, .reg = R_EDX, },
+        .tcg_features = TCG_FEATURES,
+    },
+    [FEAT_1_ECX] = {
+        .type = CPUID_FEATURE_WORD,
+        .feat_names = {
+            "pni" /* Intel,AMD sse3 */, "pclmulqdq", "dtes64", "monitor",
+            "ds-cpl", "vmx", "smx", "est",
+            "tm2", "ssse3", "cid", NULL,
+            "fma", "cx16", "xtpr", "pdcm",
+            NULL, "pcid", "dca", "sse4.1",
+            "sse4.2", "x2apic", "movbe", "popcnt",
+            "tsc-deadline", "aes", "xsave", NULL /* osxsave */,
+            "avx", "f16c", "rdrand", "hypervisor",
+        },
+        .cpuid = { .eax = 1, .reg = R_ECX, },
+        .tcg_features = TCG_EXT_FEATURES,
+    },
+    /* Feature names that are already defined on feature_name[] but
+     * are set on CPUID[8000_0001].EDX on AMD CPUs don't have their
+     * names on feat_names below. They are copied automatically
+     * to features[FEAT_8000_0001_EDX] if and only if CPU vendor is AMD.
+     */
+    [FEAT_8000_0001_EDX] = {
+        .type = CPUID_FEATURE_WORD,
+        .feat_names = {
+            NULL /* fpu */, NULL /* vme */, NULL /* de */, NULL /* pse */,
+            NULL /* tsc */, NULL /* msr */, NULL /* pae */, NULL /* mce */,
+            NULL /* cx8 */, NULL /* apic */, NULL, "syscall",
+            NULL /* mtrr */, NULL /* pge */, NULL /* mca */, NULL /* cmov */,
+            NULL /* pat */, NULL /* pse36 */, NULL, NULL /* Linux mp */,
+            "nx", NULL, "mmxext", NULL /* mmx */,
+            NULL /* fxsr */, "fxsr-opt", "pdpe1gb", "rdtscp",
+            NULL, "lm", "3dnowext", "3dnow",
+        },
+        .cpuid = { .eax = 0x80000001, .reg = R_EDX, },
+        .tcg_features = TCG_EXT2_FEATURES,
+    },
+    [FEAT_8000_0001_ECX] = {
+        .type = CPUID_FEATURE_WORD,
+        .feat_names = {
+            "lahf-lm", "cmp-legacy", "svm", "extapic",
+            "cr8legacy", "abm", "sse4a", "misalignsse",
+            "3dnowprefetch", "osvw", "ibs", "xop",
+            "skinit", "wdt", NULL, "lwp",
+            "fma4", "tce", NULL, "nodeid-msr",
+            NULL, "tbm", "topoext", "perfctr-core",
+            "perfctr-nb", NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+        },
+        .cpuid = { .eax = 0x80000001, .reg = R_ECX, },
+        .tcg_features = TCG_EXT3_FEATURES,
+        /*
+         * TOPOEXT is always allowed but can't be enabled blindly by
+         * "-cpu host", as it requires consistent cache topology info
+         * to be provided so it doesn't confuse guests.
+         */
+        .no_autoenable_flags = CPUID_EXT3_TOPOEXT,
+    },
+    [FEAT_C000_0001_EDX] = {
+        .type = CPUID_FEATURE_WORD,
+        .feat_names = {
+            NULL, NULL, "xstore", "xstore-en",
+            NULL, NULL, "xcrypt", "xcrypt-en",
+            "ace2", "ace2-en", "phe", "phe-en",
+            "pmm", "pmm-en", NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+        },
+        .cpuid = { .eax = 0xC0000001, .reg = R_EDX, },
+        .tcg_features = TCG_EXT4_FEATURES,
+    },
+    [FEAT_KVM] = {
+        .type = CPUID_FEATURE_WORD,
+        .feat_names = {
+            "kvmclock", "kvm-nopiodelay", "kvm-mmu", "kvmclock",
+            "kvm-asyncpf", "kvm-steal-time", "kvm-pv-eoi", "kvm-pv-unhalt",
+            NULL, "kvm-pv-tlb-flush", NULL, "kvm-pv-ipi",
+            "kvm-poll-control", "kvm-pv-sched-yield", "kvm-asyncpf-int", "kvm-msi-ext-dest-id",
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            "kvmclock-stable-bit", NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+        },
+        .cpuid = { .eax = KVM_CPUID_FEATURES, .reg = R_EAX, },
+        .tcg_features = TCG_KVM_FEATURES,
+    },
+    [FEAT_KVM_HINTS] = {
+        .type = CPUID_FEATURE_WORD,
+        .feat_names = {
+            "kvm-hint-dedicated", NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+        },
+        .cpuid = { .eax = KVM_CPUID_FEATURES, .reg = R_EDX, },
+        .tcg_features = TCG_KVM_FEATURES,
+        /*
+         * KVM hints aren't auto-enabled by -cpu host, they need to be
+         * explicitly enabled in the command-line.
+         */
+        .no_autoenable_flags = ~0U,
+    },
+    [FEAT_SVM] = {
+        .type = CPUID_FEATURE_WORD,
+        .feat_names = {
+            "npt", "lbrv", "svm-lock", "nrip-save",
+            "tsc-scale", "vmcb-clean",  "flushbyasid", "decodeassists",
+            NULL, NULL, "pause-filter", NULL,
+            "pfthreshold", "avic", NULL, "v-vmsave-vmload",
+            "vgif", NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, "vnmi", NULL, NULL,
+            "svme-addr-chk", NULL, NULL, NULL,
+        },
+        .cpuid = { .eax = 0x8000000A, .reg = R_EDX, },
+        .tcg_features = TCG_SVM_FEATURES,
+    },
+    [FEAT_7_0_EBX] = {
+        .type = CPUID_FEATURE_WORD,
+        .feat_names = {
+            "fsgsbase", "tsc-adjust", "sgx", "bmi1",
+            "hle", "avx2", NULL, "smep",
+            "bmi2", "erms", "invpcid", "rtm",
+            NULL, NULL, "mpx", NULL,
+            "avx512f", "avx512dq", "rdseed", "adx",
+            "smap", "avx512ifma", "pcommit", "clflushopt",
+            "clwb", "intel-pt", "avx512pf", "avx512er",
+            "avx512cd", "sha-ni", "avx512bw", "avx512vl",
+        },
+        .cpuid = {
+            .eax = 7,
+            .needs_ecx = true, .ecx = 0,
+            .reg = R_EBX,
+        },
+        .tcg_features = TCG_7_0_EBX_FEATURES,
+    },
+    [FEAT_7_0_ECX] = {
+        .type = CPUID_FEATURE_WORD,
+        .feat_names = {
+            NULL, "avx512vbmi", "umip", "pku",
+            NULL /* ospke */, "waitpkg", "avx512vbmi2", NULL,
+            "gfni", "vaes", "vpclmulqdq", "avx512vnni",
+            "avx512bitalg", NULL, "avx512-vpopcntdq", NULL,
+            "la57", NULL, NULL, NULL,
+            NULL, NULL, "rdpid", NULL,
+            "bus-lock-detect", "cldemote", NULL, "movdiri",
+            "movdir64b", NULL, "sgxlc", "pks",
+        },
+        .cpuid = {
+            .eax = 7,
+            .needs_ecx = true, .ecx = 0,
+            .reg = R_ECX,
+        },
+        .tcg_features = TCG_7_0_ECX_FEATURES,
+    },
+    [FEAT_7_0_EDX] = {
+        .type = CPUID_FEATURE_WORD,
+        .feat_names = {
+            NULL, NULL, "avx512-4vnniw", "avx512-4fmaps",
+            "fsrm", NULL, NULL, NULL,
+            "avx512-vp2intersect", NULL, "md-clear", NULL,
+            NULL, NULL, "serialize", NULL,
+            "tsx-ldtrk", NULL, NULL /* pconfig */, "arch-lbr",
+            NULL, NULL, "amx-bf16", "avx512-fp16",
+            "amx-tile", "amx-int8", "spec-ctrl", "stibp",
+            "flush-l1d", "arch-capabilities", "core-capability", "ssbd",
+        },
+        .cpuid = {
+            .eax = 7,
+            .needs_ecx = true, .ecx = 0,
+            .reg = R_EDX,
+        },
+        .tcg_features = TCG_7_0_EDX_FEATURES,
+    },
+    [FEAT_7_1_EAX] = {
+        .type = CPUID_FEATURE_WORD,
+        .feat_names = {
+            NULL, NULL, NULL, NULL,
+            "avx-vnni", "avx512-bf16", NULL, "cmpccxadd",
+            NULL, NULL, "fzrm", "fsrs",
+            "fsrc", NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, "amx-fp16", NULL, "avx-ifma",
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+        },
+        .cpuid = {
+            .eax = 7,
+            .needs_ecx = true, .ecx = 1,
+            .reg = R_EAX,
+        },
+        .tcg_features = TCG_7_1_EAX_FEATURES,
+    },
+    [FEAT_7_1_EDX] = {
+        .type = CPUID_FEATURE_WORD,
+        .feat_names = {
+            NULL, NULL, NULL, NULL,
+            "avx-vnni-int8", "avx-ne-convert", NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, "prefetchiti", NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+        },
+        .cpuid = {
+            .eax = 7,
+            .needs_ecx = true, .ecx = 1,
+            .reg = R_EDX,
+        },
+        .tcg_features = TCG_7_1_EDX_FEATURES,
+    },
+    [FEAT_7_2_EDX] = {
+        .type = CPUID_FEATURE_WORD,
+        .feat_names = {
+            NULL, NULL, NULL, NULL,
+            NULL, "mcdt-no", NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+        },
+        .cpuid = {
+            .eax = 7,
+            .needs_ecx = true, .ecx = 2,
+            .reg = R_EDX,
+        },
+        .tcg_features = TCG_7_2_EDX_FEATURES,
+    },
+    [FEAT_8000_0007_EDX] = {
+        .type = CPUID_FEATURE_WORD,
+        .feat_names = {
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            "invtsc", NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+        },
+        .cpuid = { .eax = 0x80000007, .reg = R_EDX, },
+        .tcg_features = TCG_APM_FEATURES,
+        .unmigratable_flags = CPUID_APM_INVTSC,
+    },
+    [FEAT_8000_0008_EBX] = {
+        .type = CPUID_FEATURE_WORD,
+        .feat_names = {
+            "clzero", NULL, "xsaveerptr", NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, "wbnoinvd", NULL, NULL,
+            "ibpb", NULL, "ibrs", "amd-stibp",
+            NULL, "stibp-always-on", NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            "amd-ssbd", "virt-ssbd", "amd-no-ssb", NULL,
+            "amd-psfd", NULL, NULL, NULL,
+        },
+        .cpuid = { .eax = 0x80000008, .reg = R_EBX, },
+        .tcg_features = TCG_8000_0008_EBX,
+        .unmigratable_flags = 0,
+    },
+    [FEAT_8000_0021_EAX] = {
+        .type = CPUID_FEATURE_WORD,
+        .feat_names = {
+            "no-nested-data-bp", NULL, "lfence-always-serializing", NULL,
+            NULL, NULL, "null-sel-clr-base", NULL,
+            "auto-ibrs", NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+        },
+        .cpuid = { .eax = 0x80000021, .reg = R_EAX, },
+        .tcg_features = 0,
+        .unmigratable_flags = 0,
+    },
+    [FEAT_XSAVE] = {
+        .type = CPUID_FEATURE_WORD,
+        .feat_names = {
+            "xsaveopt", "xsavec", "xgetbv1", "xsaves",
+            "xfd", NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+        },
+        .cpuid = {
+            .eax = 0xd,
+            .needs_ecx = true, .ecx = 1,
+            .reg = R_EAX,
+        },
+        .tcg_features = TCG_XSAVE_FEATURES,
+    },
+    [FEAT_XSAVE_XSS_LO] = {
+        .type = CPUID_FEATURE_WORD,
+        .feat_names = {
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+        },
+        .cpuid = {
+            .eax = 0xD,
+            .needs_ecx = true,
+            .ecx = 1,
+            .reg = R_ECX,
+        },
+    },
+    [FEAT_XSAVE_XSS_HI] = {
+        .type = CPUID_FEATURE_WORD,
+        .cpuid = {
+            .eax = 0xD,
+            .needs_ecx = true,
+            .ecx = 1,
+            .reg = R_EDX
+        },
+    },
+    [FEAT_6_EAX] = {
+        .type = CPUID_FEATURE_WORD,
+        .feat_names = {
+            NULL, NULL, "arat", NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+        },
+        .cpuid = { .eax = 6, .reg = R_EAX, },
+        .tcg_features = TCG_6_EAX_FEATURES,
+    },
+    [FEAT_XSAVE_XCR0_LO] = {
+        .type = CPUID_FEATURE_WORD,
+        .cpuid = {
+            .eax = 0xD,
+            .needs_ecx = true, .ecx = 0,
+            .reg = R_EAX,
+        },
+        .tcg_features = ~0U,
+        .migratable_flags = XSTATE_FP_MASK | XSTATE_SSE_MASK |
+            XSTATE_YMM_MASK | XSTATE_BNDREGS_MASK | XSTATE_BNDCSR_MASK |
+            XSTATE_OPMASK_MASK | XSTATE_ZMM_Hi256_MASK | XSTATE_Hi16_ZMM_MASK |
+            XSTATE_PKRU_MASK,
+    },
+    [FEAT_XSAVE_XCR0_HI] = {
+        .type = CPUID_FEATURE_WORD,
+        .cpuid = {
+            .eax = 0xD,
+            .needs_ecx = true, .ecx = 0,
+            .reg = R_EDX,
+        },
+        .tcg_features = ~0U,
+    },
+    /*Below are MSR exposed features*/
+    [FEAT_ARCH_CAPABILITIES] = {
+        .type = MSR_FEATURE_WORD,
+        .feat_names = {
+            "rdctl-no", "ibrs-all", "rsba", "skip-l1dfl-vmentry",
+            "ssb-no", "mds-no", "pschange-mc-no", "tsx-ctrl",
+            "taa-no", NULL, NULL, NULL,
+            NULL, "sbdr-ssdp-no", "fbsdp-no", "psdp-no",
+            NULL, "fb-clear", NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            "pbrsb-no", NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+        },
+        .msr = {
+            .index = MSR_IA32_ARCH_CAPABILITIES,
+        },
+        /*
+         * FEAT_ARCH_CAPABILITIES only affects a read-only MSR, which
+         * cannot be read from user mode.  Therefore, it has no impact
+         > on any user-mode operation, and warnings about unsupported
+         * features do not matter.
+         */
+        .tcg_features = ~0U,
+    },
+    [FEAT_CORE_CAPABILITY] = {
+        .type = MSR_FEATURE_WORD,
+        .feat_names = {
+            NULL, NULL, NULL, NULL,
+            NULL, "split-lock-detect", NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+        },
+        .msr = {
+            .index = MSR_IA32_CORE_CAPABILITY,
+        },
+    },
+    [FEAT_PERF_CAPABILITIES] = {
+        .type = MSR_FEATURE_WORD,
+        .feat_names = {
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, "full-width-write", NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+        },
+        .msr = {
+            .index = MSR_IA32_PERF_CAPABILITIES,
+        },
+    },
+
+    [FEAT_VMX_PROCBASED_CTLS] = {
+        .type = MSR_FEATURE_WORD,
+        .feat_names = {
+            NULL, NULL, "vmx-vintr-pending", "vmx-tsc-offset",
+            NULL, NULL, NULL, "vmx-hlt-exit",
+            NULL, "vmx-invlpg-exit", "vmx-mwait-exit", "vmx-rdpmc-exit",
+            "vmx-rdtsc-exit", NULL, NULL, "vmx-cr3-load-noexit",
+            "vmx-cr3-store-noexit", NULL, NULL, "vmx-cr8-load-exit",
+            "vmx-cr8-store-exit", "vmx-flexpriority", "vmx-vnmi-pending", "vmx-movdr-exit",
+            "vmx-io-exit", "vmx-io-bitmap", NULL, "vmx-mtf",
+            "vmx-msr-bitmap", "vmx-monitor-exit", "vmx-pause-exit", "vmx-secondary-ctls",
+        },
+        .msr = {
+            .index = MSR_IA32_VMX_TRUE_PROCBASED_CTLS,
+        }
+    },
+
+    [FEAT_VMX_SECONDARY_CTLS] = {
+        .type = MSR_FEATURE_WORD,
+        .feat_names = {
+            "vmx-apicv-xapic", "vmx-ept", "vmx-desc-exit", "vmx-rdtscp-exit",
+            "vmx-apicv-x2apic", "vmx-vpid", "vmx-wbinvd-exit", "vmx-unrestricted-guest",
+            "vmx-apicv-register", "vmx-apicv-vid", "vmx-ple", "vmx-rdrand-exit",
+            "vmx-invpcid-exit", "vmx-vmfunc", "vmx-shadow-vmcs", "vmx-encls-exit",
+            "vmx-rdseed-exit", "vmx-pml", NULL, NULL,
+            "vmx-xsaves", NULL, NULL, NULL,
+            NULL, "vmx-tsc-scaling", NULL, NULL,
+            NULL, NULL, NULL, NULL,
+        },
+        .msr = {
+            .index = MSR_IA32_VMX_PROCBASED_CTLS2,
+        }
+    },
+
+    [FEAT_VMX_PINBASED_CTLS] = {
+        .type = MSR_FEATURE_WORD,
+        .feat_names = {
+            "vmx-intr-exit", NULL, NULL, "vmx-nmi-exit",
+            NULL, "vmx-vnmi", "vmx-preemption-timer", "vmx-posted-intr",
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+        },
+        .msr = {
+            .index = MSR_IA32_VMX_TRUE_PINBASED_CTLS,
+        }
+    },
+
+    [FEAT_VMX_EXIT_CTLS] = {
+        .type = MSR_FEATURE_WORD,
+        /*
+         * VMX_VM_EXIT_HOST_ADDR_SPACE_SIZE is copied from
+         * the LM CPUID bit.
+         */
+        .feat_names = {
+            NULL, NULL, "vmx-exit-nosave-debugctl", NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL /* vmx-exit-host-addr-space-size */, NULL, NULL,
+            "vmx-exit-load-perf-global-ctrl", NULL, NULL, "vmx-exit-ack-intr",
+            NULL, NULL, "vmx-exit-save-pat", "vmx-exit-load-pat",
+            "vmx-exit-save-efer", "vmx-exit-load-efer",
+                "vmx-exit-save-preemption-timer", "vmx-exit-clear-bndcfgs",
+            NULL, "vmx-exit-clear-rtit-ctl", NULL, NULL,
+            NULL, "vmx-exit-load-pkrs", NULL, NULL,
+        },
+        .msr = {
+            .index = MSR_IA32_VMX_TRUE_EXIT_CTLS,
+        }
+    },
+
+    [FEAT_VMX_ENTRY_CTLS] = {
+        .type = MSR_FEATURE_WORD,
+        .feat_names = {
+            NULL, NULL, "vmx-entry-noload-debugctl", NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, "vmx-entry-ia32e-mode", NULL, NULL,
+            NULL, "vmx-entry-load-perf-global-ctrl", "vmx-entry-load-pat", "vmx-entry-load-efer",
+            "vmx-entry-load-bndcfgs", NULL, "vmx-entry-load-rtit-ctl", NULL,
+            NULL, NULL, "vmx-entry-load-pkrs", NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+        },
+        .msr = {
+            .index = MSR_IA32_VMX_TRUE_ENTRY_CTLS,
+        }
+    },
+
+    [FEAT_VMX_MISC] = {
+        .type = MSR_FEATURE_WORD,
+        .feat_names = {
+            NULL, NULL, NULL, NULL,
+            NULL, "vmx-store-lma", "vmx-activity-hlt", "vmx-activity-shutdown",
+            "vmx-activity-wait-sipi", NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, "vmx-vmwrite-vmexit-fields", "vmx-zero-len-inject", NULL,
+        },
+        .msr = {
+            .index = MSR_IA32_VMX_MISC,
+        }
+    },
+
+    [FEAT_VMX_EPT_VPID_CAPS] = {
+        .type = MSR_FEATURE_WORD,
+        .feat_names = {
+            "vmx-ept-execonly", NULL, NULL, NULL,
+            NULL, NULL, "vmx-page-walk-4", "vmx-page-walk-5",
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            "vmx-ept-2mb", "vmx-ept-1gb", NULL, NULL,
+            "vmx-invept", "vmx-eptad", "vmx-ept-advanced-exitinfo", NULL,
+            NULL, "vmx-invept-single-context", "vmx-invept-all-context", NULL,
+            NULL, NULL, NULL, NULL,
+            "vmx-invvpid", NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            "vmx-invvpid-single-addr", "vmx-invept-single-context",
+                "vmx-invvpid-all-context", "vmx-invept-single-context-noglobals",
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+        },
+        .msr = {
+            .index = MSR_IA32_VMX_EPT_VPID_CAP,
+        }
+    },
+
+    [FEAT_VMX_BASIC] = {
+        .type = MSR_FEATURE_WORD,
+        .feat_names = {
+            [54] = "vmx-ins-outs",
+            [55] = "vmx-true-ctls",
+        },
+        .msr = {
+            .index = MSR_IA32_VMX_BASIC,
+        },
+        /* Just to be safe - we don't support setting the MSEG version field.  */
+        .no_autoenable_flags = MSR_VMX_BASIC_DUAL_MONITOR,
+    },
+
+    [FEAT_VMX_VMFUNC] = {
+        .type = MSR_FEATURE_WORD,
+        .feat_names = {
+            [0] = "vmx-eptp-switching",
+        },
+        .msr = {
+            .index = MSR_IA32_VMX_VMFUNC,
+        }
+    },
+
+    [FEAT_14_0_ECX] = {
+        .type = CPUID_FEATURE_WORD,
+        .feat_names = {
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, "intel-pt-lip",
+        },
+        .cpuid = {
+            .eax = 0x14,
+            .needs_ecx = true, .ecx = 0,
+            .reg = R_ECX,
+        },
+        .tcg_features = TCG_14_0_ECX_FEATURES,
+     },
+
+    [FEAT_SGX_12_0_EAX] = {
+        .type = CPUID_FEATURE_WORD,
+        .feat_names = {
+            "sgx1", "sgx2", NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, "sgx-edeccssa",
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+        },
+        .cpuid = {
+            .eax = 0x12,
+            .needs_ecx = true, .ecx = 0,
+            .reg = R_EAX,
+        },
+        .tcg_features = TCG_SGX_12_0_EAX_FEATURES,
+    },
+
+    [FEAT_SGX_12_0_EBX] = {
+        .type = CPUID_FEATURE_WORD,
+        .feat_names = {
+            "sgx-exinfo" , NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+        },
+        .cpuid = {
+            .eax = 0x12,
+            .needs_ecx = true, .ecx = 0,
+            .reg = R_EBX,
+        },
+        .tcg_features = TCG_SGX_12_0_EBX_FEATURES,
+    },
+
+    [FEAT_SGX_12_1_EAX] = {
+        .type = CPUID_FEATURE_WORD,
+        .feat_names = {
+            NULL, "sgx-debug", "sgx-mode64", NULL,
+            "sgx-provisionkey", "sgx-tokenkey", NULL, "sgx-kss",
+            NULL, NULL, "sgx-aex-notify", NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+        },
+        .cpuid = {
+            .eax = 0x12,
+            .needs_ecx = true, .ecx = 1,
+            .reg = R_EAX,
+        },
+        .tcg_features = TCG_SGX_12_1_EAX_FEATURES,
+    },
+};
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/4] target/i386: Translate feature_word_info to xml
  2023-08-11 13:50 [PATCH 0/4] Generate x86 cpu features Tim Wiederhake
  2023-08-11 13:50 ` [PATCH 1/4] target/i386: Split out feature_word_info Tim Wiederhake
@ 2023-08-11 13:50 ` Tim Wiederhake
  2023-08-17 11:07   ` Daniel P. Berrangé
  2023-09-06 14:21   ` Michael S. Tsirkin
  2023-08-11 13:50 ` [PATCH 3/4] target/i386: Format feature_word_info.c.inc Tim Wiederhake
  2023-08-11 13:50 ` [PATCH 4/4] target/i386: Autogenerate feature_word_info.c.inc Tim Wiederhake
  3 siblings, 2 replies; 10+ messages in thread
From: Tim Wiederhake @ 2023-08-11 13:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: Tim Wiederhake

This is the data file that will be used to generate the C code.
All information, including the comments, is preserved.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
---
 target/i386/feature_word_info.xml | 1607 +++++++++++++++++++++++++++++
 1 file changed, 1607 insertions(+)
 create mode 100644 target/i386/feature_word_info.xml

diff --git a/target/i386/feature_word_info.xml b/target/i386/feature_word_info.xml
new file mode 100644
index 0000000000..ff741b9f5a
--- /dev/null
+++ b/target/i386/feature_word_info.xml
@@ -0,0 +1,1607 @@
+<feature_words>
+    <feature_word index="FEAT_1_EDX">
+        <type>CPUID_FEATURE_WORD</type>
+        <feat_names>
+            <feature>"fpu"</feature>
+            <feature>"vme"</feature>
+            <feature>"de"</feature>
+            <feature>"pse"</feature>
+            <feature>"tsc"</feature>
+            <feature>"msr"</feature>
+            <feature>"pae"</feature>
+            <feature>"mce"</feature>
+            <feature>"cx8"</feature>
+            <feature>"apic"</feature>
+            <feature></feature>
+            <feature>"sep"</feature>
+            <feature>"mtrr"</feature>
+            <feature>"pge"</feature>
+            <feature>"mca"</feature>
+            <feature>"cmov"</feature>
+            <feature>"pat"</feature>
+            <feature>"pse36"</feature>
+            <feature>"pn"</feature><!-- Intel psn -->
+            <feature>"clflush"</feature><!-- Intel clfsh -->
+            <feature></feature>
+            <feature>"ds"</feature><!-- Intel dts -->
+            <feature>"acpi"</feature>
+            <feature>"mmx"</feature>
+            <feature>"fxsr"</feature>
+            <feature>"sse"</feature>
+            <feature>"sse2"</feature>
+            <feature>"ss"</feature>
+            <feature>"ht"</feature><!-- Intel htt -->
+            <feature>"tm"</feature>
+            <feature>"ia64"</feature>
+            <feature>"pbe"</feature>
+        </feat_names>
+        <cpuid>
+            <eax>1</eax>
+            <reg>R_EDX</reg>
+        </cpuid>
+        <tcg_features>TCG_FEATURES</tcg_features>
+    </feature_word>
+    <feature_word index="FEAT_1_ECX">
+        <type>CPUID_FEATURE_WORD</type>
+        <feat_names>
+            <feature>"pni"</feature><!-- Intel,AMD sse3 -->
+            <feature>"pclmulqdq"</feature>
+            <feature>"dtes64"</feature>
+            <feature>"monitor"</feature>
+            <feature>"ds-cpl"</feature>
+            <feature>"vmx"</feature>
+            <feature>"smx"</feature>
+            <feature>"est"</feature>
+            <feature>"tm2"</feature>
+            <feature>"ssse3"</feature>
+            <feature>"cid"</feature>
+            <feature></feature>
+            <feature>"fma"</feature>
+            <feature>"cx16"</feature>
+            <feature>"xtpr"</feature>
+            <feature>"pdcm"</feature>
+            <feature></feature>
+            <feature>"pcid"</feature>
+            <feature>"dca"</feature>
+            <feature>"sse4.1"</feature>
+            <feature>"sse4.2"</feature>
+            <feature>"x2apic"</feature>
+            <feature>"movbe"</feature>
+            <feature>"popcnt"</feature>
+            <feature>"tsc-deadline"</feature>
+            <feature>"aes"</feature>
+            <feature>"xsave"</feature>
+            <feature></feature><!-- osxsave -->
+            <feature>"avx"</feature>
+            <feature>"f16c"</feature>
+            <feature>"rdrand"</feature>
+            <feature>"hypervisor"</feature>
+        </feat_names>
+        <cpuid>
+            <eax>1</eax>
+            <reg>R_ECX</reg>
+        </cpuid>
+        <tcg_features>TCG_EXT_FEATURES</tcg_features>
+    </feature_word>
+    <!-- Feature names that are already defined on feature_name[] but
+     * are set on CPUID[8000_0001].EDX on AMD CPUs don't have their
+     * names on feat_names below. They are copied automatically
+     * to features[FEAT_8000_0001_EDX] if and only if CPU vendor is AMD. -->
+    <feature_word index="FEAT_8000_0001_EDX">
+        <type>CPUID_FEATURE_WORD</type>
+        <feat_names>
+            <feature></feature><!-- fpu -->
+            <feature></feature><!-- vme -->
+            <feature></feature><!-- de -->
+            <feature></feature><!-- pse -->
+            <feature></feature><!-- tsc -->
+            <feature></feature><!-- msr -->
+            <feature></feature><!-- pae -->
+            <feature></feature><!-- mce -->
+            <feature></feature><!-- cx8 -->
+            <feature></feature><!-- apic -->
+            <feature></feature>
+            <feature>"syscall"</feature>
+            <feature></feature><!-- mtrr -->
+            <feature></feature><!-- pge -->
+            <feature></feature><!-- mca -->
+            <feature></feature><!-- cmov -->
+            <feature></feature><!-- pat -->
+            <feature></feature><!-- pse36 -->
+            <feature></feature>
+            <feature></feature><!-- Linux mp -->
+            <feature>"nx"</feature>
+            <feature></feature>
+            <feature>"mmxext"</feature>
+            <feature></feature><!-- mmx -->
+            <feature></feature><!-- fxsr -->
+            <feature>"fxsr-opt"</feature>
+            <feature>"pdpe1gb"</feature>
+            <feature>"rdtscp"</feature>
+            <feature></feature>
+            <feature>"lm"</feature>
+            <feature>"3dnowext"</feature>
+            <feature>"3dnow"</feature>
+        </feat_names>
+        <cpuid>
+            <eax>0x80000001</eax>
+            <reg>R_EDX</reg>
+        </cpuid>
+        <tcg_features>TCG_EXT2_FEATURES</tcg_features>
+    </feature_word>
+    <feature_word index="FEAT_8000_0001_ECX">
+        <type>CPUID_FEATURE_WORD</type>
+        <feat_names>
+            <feature>"lahf-lm"</feature>
+            <feature>"cmp-legacy"</feature>
+            <feature>"svm"</feature>
+            <feature>"extapic"</feature>
+            <feature>"cr8legacy"</feature>
+            <feature>"abm"</feature>
+            <feature>"sse4a"</feature>
+            <feature>"misalignsse"</feature>
+            <feature>"3dnowprefetch"</feature>
+            <feature>"osvw"</feature>
+            <feature>"ibs"</feature>
+            <feature>"xop"</feature>
+            <feature>"skinit"</feature>
+            <feature>"wdt"</feature>
+            <feature></feature>
+            <feature>"lwp"</feature>
+            <feature>"fma4"</feature>
+            <feature>"tce"</feature>
+            <feature></feature>
+            <feature>"nodeid-msr"</feature>
+            <feature></feature>
+            <feature>"tbm"</feature>
+            <feature>"topoext"</feature>
+            <feature>"perfctr-core"</feature>
+            <feature>"perfctr-nb"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+        </feat_names>
+        <cpuid>
+            <eax>0x80000001</eax>
+            <reg>R_ECX</reg>
+        </cpuid>
+        <tcg_features>TCG_EXT3_FEATURES</tcg_features>
+        <!-- * TOPOEXT is always allowed but can't be enabled blindly by
+         * "-cpu host", as it requires consistent cache topology info
+         * to be provided so it doesn't confuse guests. -->
+        <no_autoenable_flags>CPUID_EXT3_TOPOEXT</no_autoenable_flags>
+    </feature_word>
+    <feature_word index="FEAT_C000_0001_EDX">
+        <type>CPUID_FEATURE_WORD</type>
+        <feat_names>
+            <feature></feature>
+            <feature></feature>
+            <feature>"xstore"</feature>
+            <feature>"xstore-en"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"xcrypt"</feature>
+            <feature>"xcrypt-en"</feature>
+            <feature>"ace2"</feature>
+            <feature>"ace2-en"</feature>
+            <feature>"phe"</feature>
+            <feature>"phe-en"</feature>
+            <feature>"pmm"</feature>
+            <feature>"pmm-en"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+        </feat_names>
+        <cpuid>
+            <eax>0xC0000001</eax>
+            <reg>R_EDX</reg>
+        </cpuid>
+        <tcg_features>TCG_EXT4_FEATURES</tcg_features>
+    </feature_word>
+    <feature_word index="FEAT_KVM">
+        <type>CPUID_FEATURE_WORD</type>
+        <feat_names>
+            <feature>"kvmclock"</feature>
+            <feature>"kvm-nopiodelay"</feature>
+            <feature>"kvm-mmu"</feature>
+            <feature>"kvmclock"</feature>
+            <feature>"kvm-asyncpf"</feature>
+            <feature>"kvm-steal-time"</feature>
+            <feature>"kvm-pv-eoi"</feature>
+            <feature>"kvm-pv-unhalt"</feature>
+            <feature></feature>
+            <feature>"kvm-pv-tlb-flush"</feature>
+            <feature></feature>
+            <feature>"kvm-pv-ipi"</feature>
+            <feature>"kvm-poll-control"</feature>
+            <feature>"kvm-pv-sched-yield"</feature>
+            <feature>"kvm-asyncpf-int"</feature>
+            <feature>"kvm-msi-ext-dest-id"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"kvmclock-stable-bit"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+        </feat_names>
+        <cpuid>
+            <eax>KVM_CPUID_FEATURES</eax>
+            <reg>R_EAX</reg>
+        </cpuid>
+        <tcg_features>TCG_KVM_FEATURES</tcg_features>
+    </feature_word>
+    <feature_word index="FEAT_KVM_HINTS">
+        <type>CPUID_FEATURE_WORD</type>
+        <feat_names>
+            <feature>"kvm-hint-dedicated"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+        </feat_names>
+        <cpuid>
+            <eax>KVM_CPUID_FEATURES</eax>
+            <reg>R_EDX</reg>
+        </cpuid>
+        <tcg_features>TCG_KVM_FEATURES</tcg_features>
+        <!-- * KVM hints aren't auto-enabled by -cpu host, they need to be
+         * explicitly enabled in the command-line. -->
+        <no_autoenable_flags>~0U</no_autoenable_flags>
+    </feature_word>
+    <feature_word index="FEAT_SVM">
+        <type>CPUID_FEATURE_WORD</type>
+        <feat_names>
+            <feature>"npt"</feature>
+            <feature>"lbrv"</feature>
+            <feature>"svm-lock"</feature>
+            <feature>"nrip-save"</feature>
+            <feature>"tsc-scale"</feature>
+            <feature>"vmcb-clean"</feature>
+            <feature>"flushbyasid"</feature>
+            <feature>"decodeassists"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"pause-filter"</feature>
+            <feature></feature>
+            <feature>"pfthreshold"</feature>
+            <feature>"avic"</feature>
+            <feature></feature>
+            <feature>"v-vmsave-vmload"</feature>
+            <feature>"vgif"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"vnmi"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"svme-addr-chk"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+        </feat_names>
+        <cpuid>
+            <eax>0x8000000A</eax>
+            <reg>R_EDX</reg>
+        </cpuid>
+        <tcg_features>TCG_SVM_FEATURES</tcg_features>
+    </feature_word>
+    <feature_word index="FEAT_7_0_EBX">
+        <type>CPUID_FEATURE_WORD</type>
+        <feat_names>
+            <feature>"fsgsbase"</feature>
+            <feature>"tsc-adjust"</feature>
+            <feature>"sgx"</feature>
+            <feature>"bmi1"</feature>
+            <feature>"hle"</feature>
+            <feature>"avx2"</feature>
+            <feature></feature>
+            <feature>"smep"</feature>
+            <feature>"bmi2"</feature>
+            <feature>"erms"</feature>
+            <feature>"invpcid"</feature>
+            <feature>"rtm"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"mpx"</feature>
+            <feature></feature>
+            <feature>"avx512f"</feature>
+            <feature>"avx512dq"</feature>
+            <feature>"rdseed"</feature>
+            <feature>"adx"</feature>
+            <feature>"smap"</feature>
+            <feature>"avx512ifma"</feature>
+            <feature>"pcommit"</feature>
+            <feature>"clflushopt"</feature>
+            <feature>"clwb"</feature>
+            <feature>"intel-pt"</feature>
+            <feature>"avx512pf"</feature>
+            <feature>"avx512er"</feature>
+            <feature>"avx512cd"</feature>
+            <feature>"sha-ni"</feature>
+            <feature>"avx512bw"</feature>
+            <feature>"avx512vl"</feature>
+        </feat_names>
+        <cpuid>
+            <eax>7</eax>
+            <needs_ecx>true</needs_ecx>
+            <ecx>0</ecx>
+            <reg>R_EBX</reg>
+        </cpuid>
+        <tcg_features>TCG_7_0_EBX_FEATURES</tcg_features>
+    </feature_word>
+    <feature_word index="FEAT_7_0_ECX">
+        <type>CPUID_FEATURE_WORD</type>
+        <feat_names>
+            <feature></feature>
+            <feature>"avx512vbmi"</feature>
+            <feature>"umip"</feature>
+            <feature>"pku"</feature>
+            <feature></feature><!-- ospke -->
+            <feature>"waitpkg"</feature>
+            <feature>"avx512vbmi2"</feature>
+            <feature></feature>
+            <feature>"gfni"</feature>
+            <feature>"vaes"</feature>
+            <feature>"vpclmulqdq"</feature>
+            <feature>"avx512vnni"</feature>
+            <feature>"avx512bitalg"</feature>
+            <feature></feature>
+            <feature>"avx512-vpopcntdq"</feature>
+            <feature></feature>
+            <feature>"la57"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"rdpid"</feature>
+            <feature></feature>
+            <feature>"bus-lock-detect"</feature>
+            <feature>"cldemote"</feature>
+            <feature></feature>
+            <feature>"movdiri"</feature>
+            <feature>"movdir64b"</feature>
+            <feature></feature>
+            <feature>"sgxlc"</feature>
+            <feature>"pks"</feature>
+        </feat_names>
+        <cpuid>
+            <eax>7</eax>
+            <needs_ecx>true</needs_ecx>
+            <ecx>0</ecx>
+            <reg>R_ECX</reg>
+        </cpuid>
+        <tcg_features>TCG_7_0_ECX_FEATURES</tcg_features>
+    </feature_word>
+    <feature_word index="FEAT_7_0_EDX">
+        <type>CPUID_FEATURE_WORD</type>
+        <feat_names>
+            <feature></feature>
+            <feature></feature>
+            <feature>"avx512-4vnniw"</feature>
+            <feature>"avx512-4fmaps"</feature>
+            <feature>"fsrm"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"avx512-vp2intersect"</feature>
+            <feature></feature>
+            <feature>"md-clear"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"serialize"</feature>
+            <feature></feature>
+            <feature>"tsx-ldtrk"</feature>
+            <feature></feature>
+            <feature></feature><!-- pconfig -->
+            <feature>"arch-lbr"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"amx-bf16"</feature>
+            <feature>"avx512-fp16"</feature>
+            <feature>"amx-tile"</feature>
+            <feature>"amx-int8"</feature>
+            <feature>"spec-ctrl"</feature>
+            <feature>"stibp"</feature>
+            <feature>"flush-l1d"</feature>
+            <feature>"arch-capabilities"</feature>
+            <feature>"core-capability"</feature>
+            <feature>"ssbd"</feature>
+        </feat_names>
+        <cpuid>
+            <eax>7</eax>
+            <needs_ecx>true</needs_ecx>
+            <ecx>0</ecx>
+            <reg>R_EDX</reg>
+        </cpuid>
+        <tcg_features>TCG_7_0_EDX_FEATURES</tcg_features>
+    </feature_word>
+    <feature_word index="FEAT_7_1_EAX">
+        <type>CPUID_FEATURE_WORD</type>
+        <feat_names>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"avx-vnni"</feature>
+            <feature>"avx512-bf16"</feature>
+            <feature></feature>
+            <feature>"cmpccxadd"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"fzrm"</feature>
+            <feature>"fsrs"</feature>
+            <feature>"fsrc"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"amx-fp16"</feature>
+            <feature></feature>
+            <feature>"avx-ifma"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+        </feat_names>
+        <cpuid>
+            <eax>7</eax>
+            <needs_ecx>true</needs_ecx>
+            <ecx>1</ecx>
+            <reg>R_EAX</reg>
+        </cpuid>
+        <tcg_features>TCG_7_1_EAX_FEATURES</tcg_features>
+    </feature_word>
+    <feature_word index="FEAT_7_1_EDX">
+        <type>CPUID_FEATURE_WORD</type>
+        <feat_names>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"avx-vnni-int8"</feature>
+            <feature>"avx-ne-convert"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"prefetchiti"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+        </feat_names>
+        <cpuid>
+            <eax>7</eax>
+            <needs_ecx>true</needs_ecx>
+            <ecx>1</ecx>
+            <reg>R_EDX</reg>
+        </cpuid>
+        <tcg_features>TCG_7_1_EDX_FEATURES</tcg_features>
+    </feature_word>
+    <feature_word index="FEAT_7_2_EDX">
+        <type>CPUID_FEATURE_WORD</type>
+        <feat_names>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"mcdt-no"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+        </feat_names>
+        <cpuid>
+            <eax>7</eax>
+            <needs_ecx>true</needs_ecx>
+            <ecx>2</ecx>
+            <reg>R_EDX</reg>
+        </cpuid>
+        <tcg_features>TCG_7_2_EDX_FEATURES</tcg_features>
+    </feature_word>
+    <feature_word index="FEAT_8000_0007_EDX">
+        <type>CPUID_FEATURE_WORD</type>
+        <feat_names>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"invtsc"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+        </feat_names>
+        <cpuid>
+            <eax>0x80000007</eax>
+            <reg>R_EDX</reg>
+        </cpuid>
+        <tcg_features>TCG_APM_FEATURES</tcg_features>
+        <unmigratable_flags>CPUID_APM_INVTSC</unmigratable_flags>
+    </feature_word>
+    <feature_word index="FEAT_8000_0008_EBX">
+        <type>CPUID_FEATURE_WORD</type>
+        <feat_names>
+            <feature>"clzero"</feature>
+            <feature></feature>
+            <feature>"xsaveerptr"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"wbnoinvd"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"ibpb"</feature>
+            <feature></feature>
+            <feature>"ibrs"</feature>
+            <feature>"amd-stibp"</feature>
+            <feature></feature>
+            <feature>"stibp-always-on"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"amd-ssbd"</feature>
+            <feature>"virt-ssbd"</feature>
+            <feature>"amd-no-ssb"</feature>
+            <feature></feature>
+            <feature>"amd-psfd"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+        </feat_names>
+        <cpuid>
+            <eax>0x80000008</eax>
+            <reg>R_EBX</reg>
+        </cpuid>
+        <tcg_features>TCG_8000_0008_EBX</tcg_features>
+        <unmigratable_flags>0</unmigratable_flags>
+    </feature_word>
+    <feature_word index="FEAT_8000_0021_EAX">
+        <type>CPUID_FEATURE_WORD</type>
+        <feat_names>
+            <feature>"no-nested-data-bp"</feature>
+            <feature></feature>
+            <feature>"lfence-always-serializing"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"null-sel-clr-base"</feature>
+            <feature></feature>
+            <feature>"auto-ibrs"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+        </feat_names>
+        <cpuid>
+            <eax>0x80000021</eax>
+            <reg>R_EAX</reg>
+        </cpuid>
+        <tcg_features>0</tcg_features>
+        <unmigratable_flags>0</unmigratable_flags>
+    </feature_word>
+    <feature_word index="FEAT_XSAVE">
+        <type>CPUID_FEATURE_WORD</type>
+        <feat_names>
+            <feature>"xsaveopt"</feature>
+            <feature>"xsavec"</feature>
+            <feature>"xgetbv1"</feature>
+            <feature>"xsaves"</feature>
+            <feature>"xfd"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+        </feat_names>
+        <cpuid>
+            <eax>0xd</eax>
+            <needs_ecx>true</needs_ecx>
+            <ecx>1</ecx>
+            <reg>R_EAX</reg>
+        </cpuid>
+        <tcg_features>TCG_XSAVE_FEATURES</tcg_features>
+    </feature_word>
+    <feature_word index="FEAT_XSAVE_XSS_LO">
+        <type>CPUID_FEATURE_WORD</type>
+        <feat_names>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+        </feat_names>
+        <cpuid>
+            <eax>0xD</eax>
+            <needs_ecx>true</needs_ecx>
+            <ecx>1</ecx>
+            <reg>R_ECX</reg>
+        </cpuid>
+    </feature_word>
+    <feature_word index="FEAT_XSAVE_XSS_HI">
+        <type>CPUID_FEATURE_WORD</type>
+        <cpuid>
+            <eax>0xD</eax>
+            <needs_ecx>true</needs_ecx>
+            <ecx>1</ecx>
+            <reg>R_EDX</reg>
+        </cpuid>
+    </feature_word>
+    <feature_word index="FEAT_6_EAX">
+        <type>CPUID_FEATURE_WORD</type>
+        <feat_names>
+            <feature></feature>
+            <feature></feature>
+            <feature>"arat"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+        </feat_names>
+        <cpuid>
+            <eax>6</eax>
+            <reg>R_EAX</reg>
+        </cpuid>
+        <tcg_features>TCG_6_EAX_FEATURES</tcg_features>
+    </feature_word>
+    <feature_word index="FEAT_XSAVE_XCR0_LO">
+        <type>CPUID_FEATURE_WORD</type>
+        <cpuid>
+            <eax>0xD</eax>
+            <needs_ecx>true</needs_ecx>
+            <ecx>0</ecx>
+            <reg>R_EAX</reg>
+        </cpuid>
+        <tcg_features>~0U</tcg_features>
+        <migratable_flags>XSTATE_FP_MASK | XSTATE_SSE_MASK | XSTATE_YMM_MASK | XSTATE_BNDREGS_MASK | XSTATE_BNDCSR_MASK | XSTATE_OPMASK_MASK | XSTATE_ZMM_Hi256_MASK | XSTATE_Hi16_ZMM_MASK | XSTATE_PKRU_MASK</migratable_flags>
+    </feature_word>
+    <feature_word index="FEAT_XSAVE_XCR0_HI">
+        <type>CPUID_FEATURE_WORD</type>
+        <cpuid>
+            <eax>0xD</eax>
+            <needs_ecx>true</needs_ecx>
+            <ecx>0</ecx>
+            <reg>R_EDX</reg>
+        </cpuid>
+        <tcg_features>~0U</tcg_features>
+    </feature_word>
+    <!-- Below are MSR exposed features -->
+    <feature_word index="FEAT_ARCH_CAPABILITIES">
+        <type>MSR_FEATURE_WORD</type>
+        <feat_names>
+            <feature>"rdctl-no"</feature>
+            <feature>"ibrs-all"</feature>
+            <feature>"rsba"</feature>
+            <feature>"skip-l1dfl-vmentry"</feature>
+            <feature>"ssb-no"</feature>
+            <feature>"mds-no"</feature>
+            <feature>"pschange-mc-no"</feature>
+            <feature>"tsx-ctrl"</feature>
+            <feature>"taa-no"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"sbdr-ssdp-no"</feature>
+            <feature>"fbsdp-no"</feature>
+            <feature>"psdp-no"</feature>
+            <feature></feature>
+            <feature>"fb-clear"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"pbrsb-no"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+        </feat_names>
+        <msr>MSR_IA32_ARCH_CAPABILITIES</msr>
+        <!-- * FEAT_ARCH_CAPABILITIES only affects a read-only MSR, which
+         * cannot be read from user mode.  Therefore, it has no impact
+         > on any user-mode operation, and warnings about unsupported
+         * features do not matter. -->
+        <tcg_features>~0U</tcg_features>
+    </feature_word>
+    <feature_word index="FEAT_CORE_CAPABILITY">
+        <type>MSR_FEATURE_WORD</type>
+        <feat_names>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"split-lock-detect"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+        </feat_names>
+        <msr>MSR_IA32_CORE_CAPABILITY</msr>
+    </feature_word>
+    <feature_word index="FEAT_PERF_CAPABILITIES">
+        <type>MSR_FEATURE_WORD</type>
+        <feat_names>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"full-width-write"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+        </feat_names>
+        <msr>MSR_IA32_PERF_CAPABILITIES</msr>
+    </feature_word>
+    <feature_word index="FEAT_VMX_PROCBASED_CTLS">
+        <type>MSR_FEATURE_WORD</type>
+        <feat_names>
+            <feature></feature>
+            <feature></feature>
+            <feature>"vmx-vintr-pending"</feature>
+            <feature>"vmx-tsc-offset"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"vmx-hlt-exit"</feature>
+            <feature></feature>
+            <feature>"vmx-invlpg-exit"</feature>
+            <feature>"vmx-mwait-exit"</feature>
+            <feature>"vmx-rdpmc-exit"</feature>
+            <feature>"vmx-rdtsc-exit"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"vmx-cr3-load-noexit"</feature>
+            <feature>"vmx-cr3-store-noexit"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"vmx-cr8-load-exit"</feature>
+            <feature>"vmx-cr8-store-exit"</feature>
+            <feature>"vmx-flexpriority"</feature>
+            <feature>"vmx-vnmi-pending"</feature>
+            <feature>"vmx-movdr-exit"</feature>
+            <feature>"vmx-io-exit"</feature>
+            <feature>"vmx-io-bitmap"</feature>
+            <feature></feature>
+            <feature>"vmx-mtf"</feature>
+            <feature>"vmx-msr-bitmap"</feature>
+            <feature>"vmx-monitor-exit"</feature>
+            <feature>"vmx-pause-exit"</feature>
+            <feature>"vmx-secondary-ctls"</feature>
+        </feat_names>
+        <msr>MSR_IA32_VMX_TRUE_PROCBASED_CTLS</msr>
+    </feature_word>
+    <feature_word index="FEAT_VMX_SECONDARY_CTLS">
+        <type>MSR_FEATURE_WORD</type>
+        <feat_names>
+            <feature>"vmx-apicv-xapic"</feature>
+            <feature>"vmx-ept"</feature>
+            <feature>"vmx-desc-exit"</feature>
+            <feature>"vmx-rdtscp-exit"</feature>
+            <feature>"vmx-apicv-x2apic"</feature>
+            <feature>"vmx-vpid"</feature>
+            <feature>"vmx-wbinvd-exit"</feature>
+            <feature>"vmx-unrestricted-guest"</feature>
+            <feature>"vmx-apicv-register"</feature>
+            <feature>"vmx-apicv-vid"</feature>
+            <feature>"vmx-ple"</feature>
+            <feature>"vmx-rdrand-exit"</feature>
+            <feature>"vmx-invpcid-exit"</feature>
+            <feature>"vmx-vmfunc"</feature>
+            <feature>"vmx-shadow-vmcs"</feature>
+            <feature>"vmx-encls-exit"</feature>
+            <feature>"vmx-rdseed-exit"</feature>
+            <feature>"vmx-pml"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"vmx-xsaves"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"vmx-tsc-scaling"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+        </feat_names>
+        <msr>MSR_IA32_VMX_PROCBASED_CTLS2</msr>
+    </feature_word>
+    <feature_word index="FEAT_VMX_PINBASED_CTLS">
+        <type>MSR_FEATURE_WORD</type>
+        <feat_names>
+            <feature>"vmx-intr-exit"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"vmx-nmi-exit"</feature>
+            <feature></feature>
+            <feature>"vmx-vnmi"</feature>
+            <feature>"vmx-preemption-timer"</feature>
+            <feature>"vmx-posted-intr"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+        </feat_names>
+        <msr>MSR_IA32_VMX_TRUE_PINBASED_CTLS</msr>
+    </feature_word>
+    <feature_word index="FEAT_VMX_EXIT_CTLS">
+        <type>MSR_FEATURE_WORD</type>
+        <!-- * VMX_VM_EXIT_HOST_ADDR_SPACE_SIZE is copied from
+         * the LM CPUID bit. -->
+        <feat_names>
+            <feature></feature>
+            <feature></feature>
+            <feature>"vmx-exit-nosave-debugctl"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature><!-- vmx-exit-host-addr-space-size -->
+            <feature></feature>
+            <feature></feature>
+            <feature>"vmx-exit-load-perf-global-ctrl"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"vmx-exit-ack-intr"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"vmx-exit-save-pat"</feature>
+            <feature>"vmx-exit-load-pat"</feature>
+            <feature>"vmx-exit-save-efer"</feature>
+            <feature>"vmx-exit-load-efer"</feature>
+            <feature>"vmx-exit-save-preemption-timer"</feature>
+            <feature>"vmx-exit-clear-bndcfgs"</feature>
+            <feature></feature>
+            <feature>"vmx-exit-clear-rtit-ctl"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"vmx-exit-load-pkrs"</feature>
+            <feature></feature>
+            <feature></feature>
+        </feat_names>
+        <msr>MSR_IA32_VMX_TRUE_EXIT_CTLS</msr>
+    </feature_word>
+    <feature_word index="FEAT_VMX_ENTRY_CTLS">
+        <type>MSR_FEATURE_WORD</type>
+        <feat_names>
+            <feature></feature>
+            <feature></feature>
+            <feature>"vmx-entry-noload-debugctl"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"vmx-entry-ia32e-mode"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"vmx-entry-load-perf-global-ctrl"</feature>
+            <feature>"vmx-entry-load-pat"</feature>
+            <feature>"vmx-entry-load-efer"</feature>
+            <feature>"vmx-entry-load-bndcfgs"</feature>
+            <feature></feature>
+            <feature>"vmx-entry-load-rtit-ctl"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"vmx-entry-load-pkrs"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+        </feat_names>
+        <msr>MSR_IA32_VMX_TRUE_ENTRY_CTLS</msr>
+    </feature_word>
+    <feature_word index="FEAT_VMX_MISC">
+        <type>MSR_FEATURE_WORD</type>
+        <feat_names>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"vmx-store-lma"</feature>
+            <feature>"vmx-activity-hlt"</feature>
+            <feature>"vmx-activity-shutdown"</feature>
+            <feature>"vmx-activity-wait-sipi"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"vmx-vmwrite-vmexit-fields"</feature>
+            <feature>"vmx-zero-len-inject"</feature>
+            <feature></feature>
+        </feat_names>
+        <msr>MSR_IA32_VMX_MISC</msr>
+    </feature_word>
+    <feature_word index="FEAT_VMX_EPT_VPID_CAPS">
+        <type>MSR_FEATURE_WORD</type>
+        <feat_names>
+            <feature>"vmx-ept-execonly"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"vmx-page-walk-4"</feature>
+            <feature>"vmx-page-walk-5"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"vmx-ept-2mb"</feature>
+            <feature>"vmx-ept-1gb"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"vmx-invept"</feature>
+            <feature>"vmx-eptad"</feature>
+            <feature>"vmx-ept-advanced-exitinfo"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"vmx-invept-single-context"</feature>
+            <feature>"vmx-invept-all-context"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"vmx-invvpid"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"vmx-invvpid-single-addr"</feature>
+            <feature>"vmx-invept-single-context"</feature>
+            <feature>"vmx-invvpid-all-context"</feature>
+            <feature>"vmx-invept-single-context-noglobals"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+        </feat_names>
+        <msr>MSR_IA32_VMX_EPT_VPID_CAP</msr>
+    </feature_word>
+    <feature_word index="FEAT_VMX_BASIC">
+        <type>MSR_FEATURE_WORD</type>
+        <feat_names>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"vmx-ins-outs"</feature>
+            <feature>"vmx-true-ctls"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+        </feat_names>
+        <msr>MSR_IA32_VMX_BASIC</msr>
+        <!-- Just to be safe - we don't support setting the MSEG version field. -->
+        <no_autoenable_flags>MSR_VMX_BASIC_DUAL_MONITOR</no_autoenable_flags>
+    </feature_word>
+    <feature_word index="FEAT_VMX_VMFUNC">
+        <type>MSR_FEATURE_WORD</type>
+        <feat_names>
+            <feature>"vmx-eptp-switching"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+        </feat_names>
+        <msr>MSR_IA32_VMX_VMFUNC</msr>
+    </feature_word>
+    <feature_word index="FEAT_14_0_ECX">
+        <type>CPUID_FEATURE_WORD</type>
+        <feat_names>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"intel-pt-lip"</feature>
+        </feat_names>
+        <cpuid>
+            <eax>0x14</eax>
+            <needs_ecx>true</needs_ecx>
+            <ecx>0</ecx>
+            <reg>R_ECX</reg>
+        </cpuid>
+        <tcg_features>TCG_14_0_ECX_FEATURES</tcg_features>
+    </feature_word>
+    <feature_word index="FEAT_SGX_12_0_EAX">
+        <type>CPUID_FEATURE_WORD</type>
+        <feat_names>
+            <feature>"sgx1"</feature>
+            <feature>"sgx2"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"sgx-edeccssa"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+        </feat_names>
+        <cpuid>
+            <eax>0x12</eax>
+            <needs_ecx>true</needs_ecx>
+            <ecx>0</ecx>
+            <reg>R_EAX</reg>
+        </cpuid>
+        <tcg_features>TCG_SGX_12_0_EAX_FEATURES</tcg_features>
+    </feature_word>
+    <feature_word index="FEAT_SGX_12_0_EBX">
+        <type>CPUID_FEATURE_WORD</type>
+        <feat_names>
+            <feature>"sgx-exinfo"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+        </feat_names>
+        <cpuid>
+            <eax>0x12</eax>
+            <needs_ecx>true</needs_ecx>
+            <ecx>0</ecx>
+            <reg>R_EBX</reg>
+        </cpuid>
+        <tcg_features>TCG_SGX_12_0_EBX_FEATURES</tcg_features>
+    </feature_word>
+    <feature_word index="FEAT_SGX_12_1_EAX">
+        <type>CPUID_FEATURE_WORD</type>
+        <feat_names>
+            <feature></feature>
+            <feature>"sgx-debug"</feature>
+            <feature>"sgx-mode64"</feature>
+            <feature></feature>
+            <feature>"sgx-provisionkey"</feature>
+            <feature>"sgx-tokenkey"</feature>
+            <feature></feature>
+            <feature>"sgx-kss"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature>"sgx-aex-notify"</feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+            <feature></feature>
+        </feat_names>
+        <cpuid>
+            <eax>0x12</eax>
+            <needs_ecx>true</needs_ecx>
+            <ecx>1</ecx>
+            <reg>R_EAX</reg>
+        </cpuid>
+        <tcg_features>TCG_SGX_12_1_EAX_FEATURES</tcg_features>
+    </feature_word>
+</feature_words>
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/4] target/i386: Format feature_word_info.c.inc
  2023-08-11 13:50 [PATCH 0/4] Generate x86 cpu features Tim Wiederhake
  2023-08-11 13:50 ` [PATCH 1/4] target/i386: Split out feature_word_info Tim Wiederhake
  2023-08-11 13:50 ` [PATCH 2/4] target/i386: Translate feature_word_info to xml Tim Wiederhake
@ 2023-08-11 13:50 ` Tim Wiederhake
  2023-08-11 13:50 ` [PATCH 4/4] target/i386: Autogenerate feature_word_info.c.inc Tim Wiederhake
  3 siblings, 0 replies; 10+ messages in thread
From: Tim Wiederhake @ 2023-08-11 13:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: Tim Wiederhake

Harmonize the formatting: Use trailing commas, fix indentation and
empty line usage, define "cpuid" fields one per line, unwind index-
assignment in arrays, and remove comments. The information in the
comments is preserved in the xml file.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
---
 target/i386/feature_word_info.c.inc | 230 ++++++++++++++++------------
 1 file changed, 128 insertions(+), 102 deletions(-)

diff --git a/target/i386/feature_word_info.c.inc b/target/i386/feature_word_info.c.inc
index bba7975eab..040c3c4e56 100644
--- a/target/i386/feature_word_info.c.inc
+++ b/target/i386/feature_word_info.c.inc
@@ -6,47 +6,51 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
             "tsc", "msr", "pae", "mce",
             "cx8", "apic", NULL, "sep",
             "mtrr", "pge", "mca", "cmov",
-            "pat", "pse36", "pn" /* Intel psn */, "clflush" /* Intel clfsh */,
-            NULL, "ds" /* Intel dts */, "acpi", "mmx",
+            "pat", "pse36", "pn", "clflush",
+            NULL, "ds", "acpi", "mmx",
             "fxsr", "sse", "sse2", "ss",
-            "ht" /* Intel htt */, "tm", "ia64", "pbe",
+            "ht", "tm", "ia64", "pbe",
+        },
+        .cpuid = {
+            .eax = 1,
+            .reg = R_EDX,
         },
-        .cpuid = {.eax = 1, .reg = R_EDX, },
         .tcg_features = TCG_FEATURES,
     },
     [FEAT_1_ECX] = {
         .type = CPUID_FEATURE_WORD,
         .feat_names = {
-            "pni" /* Intel,AMD sse3 */, "pclmulqdq", "dtes64", "monitor",
+            "pni", "pclmulqdq", "dtes64", "monitor",
             "ds-cpl", "vmx", "smx", "est",
             "tm2", "ssse3", "cid", NULL,
             "fma", "cx16", "xtpr", "pdcm",
             NULL, "pcid", "dca", "sse4.1",
             "sse4.2", "x2apic", "movbe", "popcnt",
-            "tsc-deadline", "aes", "xsave", NULL /* osxsave */,
+            "tsc-deadline", "aes", "xsave", NULL,
             "avx", "f16c", "rdrand", "hypervisor",
         },
-        .cpuid = { .eax = 1, .reg = R_ECX, },
+        .cpuid = {
+            .eax = 1,
+            .reg = R_ECX,
+        },
         .tcg_features = TCG_EXT_FEATURES,
     },
-    /* Feature names that are already defined on feature_name[] but
-     * are set on CPUID[8000_0001].EDX on AMD CPUs don't have their
-     * names on feat_names below. They are copied automatically
-     * to features[FEAT_8000_0001_EDX] if and only if CPU vendor is AMD.
-     */
     [FEAT_8000_0001_EDX] = {
         .type = CPUID_FEATURE_WORD,
         .feat_names = {
-            NULL /* fpu */, NULL /* vme */, NULL /* de */, NULL /* pse */,
-            NULL /* tsc */, NULL /* msr */, NULL /* pae */, NULL /* mce */,
-            NULL /* cx8 */, NULL /* apic */, NULL, "syscall",
-            NULL /* mtrr */, NULL /* pge */, NULL /* mca */, NULL /* cmov */,
-            NULL /* pat */, NULL /* pse36 */, NULL, NULL /* Linux mp */,
-            "nx", NULL, "mmxext", NULL /* mmx */,
-            NULL /* fxsr */, "fxsr-opt", "pdpe1gb", "rdtscp",
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, "syscall",
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            "nx", NULL, "mmxext", NULL,
+            NULL, "fxsr-opt", "pdpe1gb", "rdtscp",
             NULL, "lm", "3dnowext", "3dnow",
         },
-        .cpuid = { .eax = 0x80000001, .reg = R_EDX, },
+        .cpuid = {
+            .eax = 0x80000001,
+            .reg = R_EDX,
+        },
         .tcg_features = TCG_EXT2_FEATURES,
     },
     [FEAT_8000_0001_ECX] = {
@@ -61,13 +65,11 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
             "perfctr-nb", NULL, NULL, NULL,
             NULL, NULL, NULL, NULL,
         },
-        .cpuid = { .eax = 0x80000001, .reg = R_ECX, },
+        .cpuid = {
+            .eax = 0x80000001,
+            .reg = R_ECX,
+        },
         .tcg_features = TCG_EXT3_FEATURES,
-        /*
-         * TOPOEXT is always allowed but can't be enabled blindly by
-         * "-cpu host", as it requires consistent cache topology info
-         * to be provided so it doesn't confuse guests.
-         */
         .no_autoenable_flags = CPUID_EXT3_TOPOEXT,
     },
     [FEAT_C000_0001_EDX] = {
@@ -82,7 +84,10 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
             NULL, NULL, NULL, NULL,
             NULL, NULL, NULL, NULL,
         },
-        .cpuid = { .eax = 0xC0000001, .reg = R_EDX, },
+        .cpuid = {
+            .eax = 0xC0000001,
+            .reg = R_EDX,
+        },
         .tcg_features = TCG_EXT4_FEATURES,
     },
     [FEAT_KVM] = {
@@ -97,7 +102,10 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
             "kvmclock-stable-bit", NULL, NULL, NULL,
             NULL, NULL, NULL, NULL,
         },
-        .cpuid = { .eax = KVM_CPUID_FEATURES, .reg = R_EAX, },
+        .cpuid = {
+            .eax = KVM_CPUID_FEATURES,
+            .reg = R_EAX,
+        },
         .tcg_features = TCG_KVM_FEATURES,
     },
     [FEAT_KVM_HINTS] = {
@@ -112,19 +120,18 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
             NULL, NULL, NULL, NULL,
             NULL, NULL, NULL, NULL,
         },
-        .cpuid = { .eax = KVM_CPUID_FEATURES, .reg = R_EDX, },
+        .cpuid = {
+            .eax = KVM_CPUID_FEATURES,
+            .reg = R_EDX,
+        },
         .tcg_features = TCG_KVM_FEATURES,
-        /*
-         * KVM hints aren't auto-enabled by -cpu host, they need to be
-         * explicitly enabled in the command-line.
-         */
         .no_autoenable_flags = ~0U,
     },
     [FEAT_SVM] = {
         .type = CPUID_FEATURE_WORD,
         .feat_names = {
             "npt", "lbrv", "svm-lock", "nrip-save",
-            "tsc-scale", "vmcb-clean",  "flushbyasid", "decodeassists",
+            "tsc-scale", "vmcb-clean", "flushbyasid", "decodeassists",
             NULL, NULL, "pause-filter", NULL,
             "pfthreshold", "avic", NULL, "v-vmsave-vmload",
             "vgif", NULL, NULL, NULL,
@@ -132,7 +139,10 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
             NULL, "vnmi", NULL, NULL,
             "svme-addr-chk", NULL, NULL, NULL,
         },
-        .cpuid = { .eax = 0x8000000A, .reg = R_EDX, },
+        .cpuid = {
+            .eax = 0x8000000A,
+            .reg = R_EDX,
+        },
         .tcg_features = TCG_SVM_FEATURES,
     },
     [FEAT_7_0_EBX] = {
@@ -149,7 +159,8 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
         },
         .cpuid = {
             .eax = 7,
-            .needs_ecx = true, .ecx = 0,
+            .needs_ecx = true,
+            .ecx = 0,
             .reg = R_EBX,
         },
         .tcg_features = TCG_7_0_EBX_FEATURES,
@@ -158,7 +169,7 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
         .type = CPUID_FEATURE_WORD,
         .feat_names = {
             NULL, "avx512vbmi", "umip", "pku",
-            NULL /* ospke */, "waitpkg", "avx512vbmi2", NULL,
+            NULL, "waitpkg", "avx512vbmi2", NULL,
             "gfni", "vaes", "vpclmulqdq", "avx512vnni",
             "avx512bitalg", NULL, "avx512-vpopcntdq", NULL,
             "la57", NULL, NULL, NULL,
@@ -168,7 +179,8 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
         },
         .cpuid = {
             .eax = 7,
-            .needs_ecx = true, .ecx = 0,
+            .needs_ecx = true,
+            .ecx = 0,
             .reg = R_ECX,
         },
         .tcg_features = TCG_7_0_ECX_FEATURES,
@@ -180,14 +192,15 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
             "fsrm", NULL, NULL, NULL,
             "avx512-vp2intersect", NULL, "md-clear", NULL,
             NULL, NULL, "serialize", NULL,
-            "tsx-ldtrk", NULL, NULL /* pconfig */, "arch-lbr",
+            "tsx-ldtrk", NULL, NULL, "arch-lbr",
             NULL, NULL, "amx-bf16", "avx512-fp16",
             "amx-tile", "amx-int8", "spec-ctrl", "stibp",
             "flush-l1d", "arch-capabilities", "core-capability", "ssbd",
         },
         .cpuid = {
             .eax = 7,
-            .needs_ecx = true, .ecx = 0,
+            .needs_ecx = true,
+            .ecx = 0,
             .reg = R_EDX,
         },
         .tcg_features = TCG_7_0_EDX_FEATURES,
@@ -206,7 +219,8 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
         },
         .cpuid = {
             .eax = 7,
-            .needs_ecx = true, .ecx = 1,
+            .needs_ecx = true,
+            .ecx = 1,
             .reg = R_EAX,
         },
         .tcg_features = TCG_7_1_EAX_FEATURES,
@@ -225,7 +239,8 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
         },
         .cpuid = {
             .eax = 7,
-            .needs_ecx = true, .ecx = 1,
+            .needs_ecx = true,
+            .ecx = 1,
             .reg = R_EDX,
         },
         .tcg_features = TCG_7_1_EDX_FEATURES,
@@ -244,7 +259,8 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
         },
         .cpuid = {
             .eax = 7,
-            .needs_ecx = true, .ecx = 2,
+            .needs_ecx = true,
+            .ecx = 2,
             .reg = R_EDX,
         },
         .tcg_features = TCG_7_2_EDX_FEATURES,
@@ -261,7 +277,10 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
             NULL, NULL, NULL, NULL,
             NULL, NULL, NULL, NULL,
         },
-        .cpuid = { .eax = 0x80000007, .reg = R_EDX, },
+        .cpuid = {
+            .eax = 0x80000007,
+            .reg = R_EDX,
+        },
         .tcg_features = TCG_APM_FEATURES,
         .unmigratable_flags = CPUID_APM_INVTSC,
     },
@@ -277,7 +296,10 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
             "amd-ssbd", "virt-ssbd", "amd-no-ssb", NULL,
             "amd-psfd", NULL, NULL, NULL,
         },
-        .cpuid = { .eax = 0x80000008, .reg = R_EBX, },
+        .cpuid = {
+            .eax = 0x80000008,
+            .reg = R_EBX,
+        },
         .tcg_features = TCG_8000_0008_EBX,
         .unmigratable_flags = 0,
     },
@@ -293,7 +315,10 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
             NULL, NULL, NULL, NULL,
             NULL, NULL, NULL, NULL,
         },
-        .cpuid = { .eax = 0x80000021, .reg = R_EAX, },
+        .cpuid = {
+            .eax = 0x80000021,
+            .reg = R_EAX,
+        },
         .tcg_features = 0,
         .unmigratable_flags = 0,
     },
@@ -311,7 +336,8 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
         },
         .cpuid = {
             .eax = 0xd,
-            .needs_ecx = true, .ecx = 1,
+            .needs_ecx = true,
+            .ecx = 1,
             .reg = R_EAX,
         },
         .tcg_features = TCG_XSAVE_FEATURES,
@@ -341,7 +367,7 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
             .eax = 0xD,
             .needs_ecx = true,
             .ecx = 1,
-            .reg = R_EDX
+            .reg = R_EDX,
         },
     },
     [FEAT_6_EAX] = {
@@ -356,32 +382,33 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
             NULL, NULL, NULL, NULL,
             NULL, NULL, NULL, NULL,
         },
-        .cpuid = { .eax = 6, .reg = R_EAX, },
+        .cpuid = {
+            .eax = 6,
+            .reg = R_EAX,
+        },
         .tcg_features = TCG_6_EAX_FEATURES,
     },
     [FEAT_XSAVE_XCR0_LO] = {
         .type = CPUID_FEATURE_WORD,
         .cpuid = {
             .eax = 0xD,
-            .needs_ecx = true, .ecx = 0,
+            .needs_ecx = true,
+            .ecx = 0,
             .reg = R_EAX,
         },
         .tcg_features = ~0U,
-        .migratable_flags = XSTATE_FP_MASK | XSTATE_SSE_MASK |
-            XSTATE_YMM_MASK | XSTATE_BNDREGS_MASK | XSTATE_BNDCSR_MASK |
-            XSTATE_OPMASK_MASK | XSTATE_ZMM_Hi256_MASK | XSTATE_Hi16_ZMM_MASK |
-            XSTATE_PKRU_MASK,
+        .migratable_flags = XSTATE_FP_MASK | XSTATE_SSE_MASK | XSTATE_YMM_MASK | XSTATE_BNDREGS_MASK | XSTATE_BNDCSR_MASK | XSTATE_OPMASK_MASK | XSTATE_ZMM_Hi256_MASK | XSTATE_Hi16_ZMM_MASK | XSTATE_PKRU_MASK,
     },
     [FEAT_XSAVE_XCR0_HI] = {
         .type = CPUID_FEATURE_WORD,
         .cpuid = {
             .eax = 0xD,
-            .needs_ecx = true, .ecx = 0,
+            .needs_ecx = true,
+            .ecx = 0,
             .reg = R_EDX,
         },
         .tcg_features = ~0U,
     },
-    /*Below are MSR exposed features*/
     [FEAT_ARCH_CAPABILITIES] = {
         .type = MSR_FEATURE_WORD,
         .feat_names = {
@@ -397,12 +424,6 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
         .msr = {
             .index = MSR_IA32_ARCH_CAPABILITIES,
         },
-        /*
-         * FEAT_ARCH_CAPABILITIES only affects a read-only MSR, which
-         * cannot be read from user mode.  Therefore, it has no impact
-         > on any user-mode operation, and warnings about unsupported
-         * features do not matter.
-         */
         .tcg_features = ~0U,
     },
     [FEAT_CORE_CAPABILITY] = {
@@ -437,7 +458,6 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
             .index = MSR_IA32_PERF_CAPABILITIES,
         },
     },
-
     [FEAT_VMX_PROCBASED_CTLS] = {
         .type = MSR_FEATURE_WORD,
         .feat_names = {
@@ -452,9 +472,8 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
         },
         .msr = {
             .index = MSR_IA32_VMX_TRUE_PROCBASED_CTLS,
-        }
+        },
     },
-
     [FEAT_VMX_SECONDARY_CTLS] = {
         .type = MSR_FEATURE_WORD,
         .feat_names = {
@@ -469,9 +488,8 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
         },
         .msr = {
             .index = MSR_IA32_VMX_PROCBASED_CTLS2,
-        }
+        },
     },
-
     [FEAT_VMX_PINBASED_CTLS] = {
         .type = MSR_FEATURE_WORD,
         .feat_names = {
@@ -486,31 +504,24 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
         },
         .msr = {
             .index = MSR_IA32_VMX_TRUE_PINBASED_CTLS,
-        }
+        },
     },
-
     [FEAT_VMX_EXIT_CTLS] = {
         .type = MSR_FEATURE_WORD,
-        /*
-         * VMX_VM_EXIT_HOST_ADDR_SPACE_SIZE is copied from
-         * the LM CPUID bit.
-         */
         .feat_names = {
             NULL, NULL, "vmx-exit-nosave-debugctl", NULL,
             NULL, NULL, NULL, NULL,
-            NULL, NULL /* vmx-exit-host-addr-space-size */, NULL, NULL,
+            NULL, NULL, NULL, NULL,
             "vmx-exit-load-perf-global-ctrl", NULL, NULL, "vmx-exit-ack-intr",
             NULL, NULL, "vmx-exit-save-pat", "vmx-exit-load-pat",
-            "vmx-exit-save-efer", "vmx-exit-load-efer",
-                "vmx-exit-save-preemption-timer", "vmx-exit-clear-bndcfgs",
+            "vmx-exit-save-efer", "vmx-exit-load-efer", "vmx-exit-save-preemption-timer", "vmx-exit-clear-bndcfgs",
             NULL, "vmx-exit-clear-rtit-ctl", NULL, NULL,
             NULL, "vmx-exit-load-pkrs", NULL, NULL,
         },
         .msr = {
             .index = MSR_IA32_VMX_TRUE_EXIT_CTLS,
-        }
+        },
     },
-
     [FEAT_VMX_ENTRY_CTLS] = {
         .type = MSR_FEATURE_WORD,
         .feat_names = {
@@ -525,9 +536,8 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
         },
         .msr = {
             .index = MSR_IA32_VMX_TRUE_ENTRY_CTLS,
-        }
+        },
     },
-
     [FEAT_VMX_MISC] = {
         .type = MSR_FEATURE_WORD,
         .feat_names = {
@@ -542,9 +552,8 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
         },
         .msr = {
             .index = MSR_IA32_VMX_MISC,
-        }
+        },
     },
-
     [FEAT_VMX_EPT_VPID_CAPS] = {
         .type = MSR_FEATURE_WORD,
         .feat_names = {
@@ -558,8 +567,7 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
             NULL, NULL, NULL, NULL,
             "vmx-invvpid", NULL, NULL, NULL,
             NULL, NULL, NULL, NULL,
-            "vmx-invvpid-single-addr", "vmx-invept-single-context",
-                "vmx-invvpid-all-context", "vmx-invept-single-context-noglobals",
+            "vmx-invvpid-single-addr", "vmx-invept-single-context", "vmx-invvpid-all-context", "vmx-invept-single-context-noglobals",
             NULL, NULL, NULL, NULL,
             NULL, NULL, NULL, NULL,
             NULL, NULL, NULL, NULL,
@@ -568,32 +576,49 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
         },
         .msr = {
             .index = MSR_IA32_VMX_EPT_VPID_CAP,
-        }
+        },
     },
-
     [FEAT_VMX_BASIC] = {
         .type = MSR_FEATURE_WORD,
         .feat_names = {
-            [54] = "vmx-ins-outs",
-            [55] = "vmx-true-ctls",
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, "vmx-ins-outs", "vmx-true-ctls",
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
         },
         .msr = {
             .index = MSR_IA32_VMX_BASIC,
         },
-        /* Just to be safe - we don't support setting the MSEG version field.  */
         .no_autoenable_flags = MSR_VMX_BASIC_DUAL_MONITOR,
     },
-
     [FEAT_VMX_VMFUNC] = {
         .type = MSR_FEATURE_WORD,
         .feat_names = {
-            [0] = "vmx-eptp-switching",
+            "vmx-eptp-switching", NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
+            NULL, NULL, NULL, NULL,
         },
         .msr = {
             .index = MSR_IA32_VMX_VMFUNC,
-        }
+        },
     },
-
     [FEAT_14_0_ECX] = {
         .type = CPUID_FEATURE_WORD,
         .feat_names = {
@@ -608,12 +633,12 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
         },
         .cpuid = {
             .eax = 0x14,
-            .needs_ecx = true, .ecx = 0,
+            .needs_ecx = true,
+            .ecx = 0,
             .reg = R_ECX,
         },
         .tcg_features = TCG_14_0_ECX_FEATURES,
-     },
-
+    },
     [FEAT_SGX_12_0_EAX] = {
         .type = CPUID_FEATURE_WORD,
         .feat_names = {
@@ -628,16 +653,16 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
         },
         .cpuid = {
             .eax = 0x12,
-            .needs_ecx = true, .ecx = 0,
+            .needs_ecx = true,
+            .ecx = 0,
             .reg = R_EAX,
         },
         .tcg_features = TCG_SGX_12_0_EAX_FEATURES,
     },
-
     [FEAT_SGX_12_0_EBX] = {
         .type = CPUID_FEATURE_WORD,
         .feat_names = {
-            "sgx-exinfo" , NULL, NULL, NULL,
+            "sgx-exinfo", NULL, NULL, NULL,
             NULL, NULL, NULL, NULL,
             NULL, NULL, NULL, NULL,
             NULL, NULL, NULL, NULL,
@@ -648,12 +673,12 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
         },
         .cpuid = {
             .eax = 0x12,
-            .needs_ecx = true, .ecx = 0,
+            .needs_ecx = true,
+            .ecx = 0,
             .reg = R_EBX,
         },
         .tcg_features = TCG_SGX_12_0_EBX_FEATURES,
     },
-
     [FEAT_SGX_12_1_EAX] = {
         .type = CPUID_FEATURE_WORD,
         .feat_names = {
@@ -668,7 +693,8 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
         },
         .cpuid = {
             .eax = 0x12,
-            .needs_ecx = true, .ecx = 1,
+            .needs_ecx = true,
+            .ecx = 1,
             .reg = R_EAX,
         },
         .tcg_features = TCG_SGX_12_1_EAX_FEATURES,
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 4/4] target/i386: Autogenerate feature_word_info.c.inc
  2023-08-11 13:50 [PATCH 0/4] Generate x86 cpu features Tim Wiederhake
                   ` (2 preceding siblings ...)
  2023-08-11 13:50 ` [PATCH 3/4] target/i386: Format feature_word_info.c.inc Tim Wiederhake
@ 2023-08-11 13:50 ` Tim Wiederhake
  3 siblings, 0 replies; 10+ messages in thread
From: Tim Wiederhake @ 2023-08-11 13:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: Tim Wiederhake

This introduces no semantic changes to the file.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
---
 target/i386/feature_word_info.c.inc |   2 +
 target/i386/feature_word_info.py    | 110 ++++++++++++++++++++++++++++
 target/i386/feature_word_info.xml   |   3 +
 3 files changed, 115 insertions(+)
 create mode 100755 target/i386/feature_word_info.py

diff --git a/target/i386/feature_word_info.c.inc b/target/i386/feature_word_info.c.inc
index 040c3c4e56..b8e77ab7e5 100644
--- a/target/i386/feature_word_info.c.inc
+++ b/target/i386/feature_word_info.c.inc
@@ -1,3 +1,5 @@
+/* This file is autogenerated by feature_word_info.py. */
+
 FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
     [FEAT_1_EDX] = {
         .type = CPUID_FEATURE_WORD,
diff --git a/target/i386/feature_word_info.py b/target/i386/feature_word_info.py
new file mode 100755
index 0000000000..95f3931aa0
--- /dev/null
+++ b/target/i386/feature_word_info.py
@@ -0,0 +1,110 @@
+#!/bin/env python3
+
+import lxml.etree
+import os
+
+
+class FeatureWord:
+    def __init__(self, xml):
+        self.index = xml.values()[0]
+        for node in xml:
+            if node.tag == "cpuid":
+                self.cpuid = dict()
+                for child in node:
+                    self.cpuid[child.tag] = child.text
+            elif node.tag == "feat_names":
+                self.feat_names = [child.text for child in node]
+            else:
+                setattr(self, node.tag, node.text)
+
+
+def write_feat_names(f, data):
+    f.write("        .feat_names = {\n")
+    for index, name in enumerate(data):
+        if name is None:
+            name = "NULL"
+        if index % 4 == 0:
+            f.write(" " * 11)
+        f.write(" " + str(name) + ",")
+        if index % 4 == 3:
+            f.write("\n")
+    f.write("        },\n")
+
+
+def write_cpuid(f, data):
+    f.write("        .cpuid = {\n")
+    f.write("            .eax = {},\n".format(data["eax"]))
+    if "ecx" in data:
+        f.write("            .needs_ecx = true,\n")
+        f.write("            .ecx = {},\n".format(data["ecx"]))
+    f.write("            .reg = {},\n".format(data["reg"]))
+    f.write("        },\n")
+
+
+def write_msr(f, data):
+    f.write("        .msr = {\n")
+    f.write("            .index = {},\n".format(data))
+    f.write("        },\n")
+
+
+def write_tcg_features(f, data):
+    f.write("        .tcg_features = {},\n".format(data))
+
+
+def write_unmigratable_flags(f, data):
+    f.write("        .unmigratable_flags = {},\n".format(data))
+
+
+def write_migratable_flags(f, data):
+    f.write("        .migratable_flags = {},\n".format(data))
+
+
+def write_no_autoenable_flags(f, data):
+    f.write("        .no_autoenable_flags = {},\n".format(data))
+
+
+def write_feature_word(f, data):
+    f.write("    [{}] = {{\n".format(data.index))
+    f.write("        .type = {},\n".format(data.type))
+    if hasattr(data, "feat_names"):
+        write_feat_names(f, data.feat_names)
+    if hasattr(data, "cpuid"):
+        write_cpuid(f, data.cpuid)
+    if hasattr(data, "msr"):
+        write_msr(f, data.msr)
+    if hasattr(data, "tcg_features"):
+        write_tcg_features(f, data.tcg_features)
+    if hasattr(data, "unmigratable_flags"):
+        write_unmigratable_flags(f, data.unmigratable_flags)
+    if hasattr(data, "migratable_flags"):
+        write_migratable_flags(f, data.migratable_flags)
+    if hasattr(data, "no_autoenable_flags"):
+        write_no_autoenable_flags(f, data.no_autoenable_flags)
+    f.write("    },\n")
+
+
+def write_feature_words(f, data):
+    f.write("/* This file is autogenerated by feature_word_info.py. */\n\n")
+    f.write("FeatureWordInfo feature_word_info[FEATURE_WORDS] = {\n")
+    for feature_word in data:
+        write_feature_word(f, feature_word)
+    f.write("};\n")
+
+
+def main():
+    dirname = os.path.dirname(__file__)
+    ifile = os.path.join(dirname, "feature_word_info.xml")
+    ofile = os.path.join(dirname, "feature_word_info.c.inc")
+
+    parser = lxml.etree.XMLParser(remove_comments=True, remove_blank_text=True)
+    with open(ifile, "tr") as f:
+        doc = lxml.etree.parse(f, parser=parser)
+
+    feature_words = [FeatureWord(node) for node in doc.getroot()]
+
+    with open(ofile, "tw") as f:
+        write_feature_words(f, feature_words)
+
+
+if __name__ == "__main__":
+    main()
diff --git a/target/i386/feature_word_info.xml b/target/i386/feature_word_info.xml
index ff741b9f5a..662b8b1dfc 100644
--- a/target/i386/feature_word_info.xml
+++ b/target/i386/feature_word_info.xml
@@ -1,3 +1,6 @@
+<!--
+    Run `feature_word_info.py` when you make changes to this file.
+-->
 <feature_words>
     <feature_word index="FEAT_1_EDX">
         <type>CPUID_FEATURE_WORD</type>
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/4] target/i386: Translate feature_word_info to xml
  2023-08-11 13:50 ` [PATCH 2/4] target/i386: Translate feature_word_info to xml Tim Wiederhake
@ 2023-08-17 11:07   ` Daniel P. Berrangé
  2023-08-21  9:54     ` Tim Wiederhake
  2023-09-06 14:21   ` Michael S. Tsirkin
  1 sibling, 1 reply; 10+ messages in thread
From: Daniel P. Berrangé @ 2023-08-17 11:07 UTC (permalink / raw)
  To: Tim Wiederhake; +Cc: qemu-devel

On Fri, Aug 11, 2023 at 03:50:09PM +0200, Tim Wiederhake wrote:
> This is the data file that will be used to generate the C code.
> All information, including the comments, is preserved.
> 
> Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
> ---
>  target/i386/feature_word_info.xml | 1607 +++++++++++++++++++++++++++++
>  1 file changed, 1607 insertions(+)
>  create mode 100644 target/i386/feature_word_info.xml
> 
> diff --git a/target/i386/feature_word_info.xml b/target/i386/feature_word_info.xml
> new file mode 100644
> index 0000000000..ff741b9f5a
> --- /dev/null
> +++ b/target/i386/feature_word_info.xml
> @@ -0,0 +1,1607 @@
> +<feature_words>

I think adding data formats based on XML is pretty undesirable
for QEMU. AFAIK, the only place we've used XML is where we
needed to have interoperability with an external tool.

Can we not just do this using JSON instead, which would avoid
the need to write python parsing code as we can directly load
it into a python object.

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/4] target/i386: Translate feature_word_info to xml
  2023-08-17 11:07   ` Daniel P. Berrangé
@ 2023-08-21  9:54     ` Tim Wiederhake
  2023-09-06 14:33       ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 10+ messages in thread
From: Tim Wiederhake @ 2023-08-21  9:54 UTC (permalink / raw)
  To: Daniel P. Berrangé; +Cc: qemu-devel

On Thu, 2023-08-17 at 12:07 +0100, Daniel P. Berrangé wrote:
> On Fri, Aug 11, 2023 at 03:50:09PM +0200, Tim Wiederhake wrote:
> > This is the data file that will be used to generate the C code.
> > All information, including the comments, is preserved.
> > 
> > Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
> > ---
> >  target/i386/feature_word_info.xml | 1607
> > +++++++++++++++++++++++++++++
> >  1 file changed, 1607 insertions(+)
> >  create mode 100644 target/i386/feature_word_info.xml
> > 
> > diff --git a/target/i386/feature_word_info.xml
> > b/target/i386/feature_word_info.xml
> > new file mode 100644
> > index 0000000000..ff741b9f5a
> > --- /dev/null
> > +++ b/target/i386/feature_word_info.xml
> > @@ -0,0 +1,1607 @@
> > +<feature_words>
> 
> I think adding data formats based on XML is pretty undesirable
> for QEMU. AFAIK, the only place we've used XML is where we
> needed to have interoperability with an external tool.
> 
> Can we not just do this using JSON instead, which would avoid
> the need to write python parsing code as we can directly load
> it into a python object.
> 
> With regards,
> Daniel

I thought of json as well, but that has some drawbacks over xml here:

Integer values, e.g. "eax=0x80000008", would need to be stored in
either decimal form or as a string. Both solutions are not desirable in
my opinion.

Additionally, preserving the comments is not as straight forward.
Comments in json are a non-standard extension and not understood by all
parsers, e.g. python's json module. This would require some regex-
preprocessing that comes with its own problems.

Regards,
Tim



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/4] target/i386: Translate feature_word_info to xml
  2023-08-11 13:50 ` [PATCH 2/4] target/i386: Translate feature_word_info to xml Tim Wiederhake
  2023-08-17 11:07   ` Daniel P. Berrangé
@ 2023-09-06 14:21   ` Michael S. Tsirkin
  1 sibling, 0 replies; 10+ messages in thread
From: Michael S. Tsirkin @ 2023-09-06 14:21 UTC (permalink / raw)
  To: Tim Wiederhake; +Cc: qemu-devel

On Fri, Aug 11, 2023 at 03:50:09PM +0200, Tim Wiederhake wrote:
> This is the data file that will be used to generate the C code.
> All information, including the comments, is preserved.
> 
> Signed-off-by: Tim Wiederhake <twiederh@redhat.com>

I'd use json I think - we don't use xml widely in qemu ATM.

> ---
>  target/i386/feature_word_info.xml | 1607 +++++++++++++++++++++++++++++
>  1 file changed, 1607 insertions(+)
>  create mode 100644 target/i386/feature_word_info.xml
> 
> diff --git a/target/i386/feature_word_info.xml b/target/i386/feature_word_info.xml
> new file mode 100644
> index 0000000000..ff741b9f5a
> --- /dev/null
> +++ b/target/i386/feature_word_info.xml
> @@ -0,0 +1,1607 @@
> +<feature_words>
> +    <feature_word index="FEAT_1_EDX">
> +        <type>CPUID_FEATURE_WORD</type>
> +        <feat_names>
> +            <feature>"fpu"</feature>
> +            <feature>"vme"</feature>
> +            <feature>"de"</feature>
> +            <feature>"pse"</feature>
> +            <feature>"tsc"</feature>
> +            <feature>"msr"</feature>
> +            <feature>"pae"</feature>
> +            <feature>"mce"</feature>
> +            <feature>"cx8"</feature>
> +            <feature>"apic"</feature>
> +            <feature></feature>
> +            <feature>"sep"</feature>
> +            <feature>"mtrr"</feature>
> +            <feature>"pge"</feature>
> +            <feature>"mca"</feature>
> +            <feature>"cmov"</feature>
> +            <feature>"pat"</feature>
> +            <feature>"pse36"</feature>
> +            <feature>"pn"</feature><!-- Intel psn -->
> +            <feature>"clflush"</feature><!-- Intel clfsh -->
> +            <feature></feature>
> +            <feature>"ds"</feature><!-- Intel dts -->
> +            <feature>"acpi"</feature>
> +            <feature>"mmx"</feature>
> +            <feature>"fxsr"</feature>
> +            <feature>"sse"</feature>
> +            <feature>"sse2"</feature>
> +            <feature>"ss"</feature>
> +            <feature>"ht"</feature><!-- Intel htt -->
> +            <feature>"tm"</feature>
> +            <feature>"ia64"</feature>
> +            <feature>"pbe"</feature>
> +        </feat_names>
> +        <cpuid>
> +            <eax>1</eax>
> +            <reg>R_EDX</reg>
> +        </cpuid>
> +        <tcg_features>TCG_FEATURES</tcg_features>
> +    </feature_word>
> +    <feature_word index="FEAT_1_ECX">
> +        <type>CPUID_FEATURE_WORD</type>
> +        <feat_names>
> +            <feature>"pni"</feature><!-- Intel,AMD sse3 -->
> +            <feature>"pclmulqdq"</feature>
> +            <feature>"dtes64"</feature>
> +            <feature>"monitor"</feature>
> +            <feature>"ds-cpl"</feature>
> +            <feature>"vmx"</feature>
> +            <feature>"smx"</feature>
> +            <feature>"est"</feature>
> +            <feature>"tm2"</feature>
> +            <feature>"ssse3"</feature>
> +            <feature>"cid"</feature>
> +            <feature></feature>
> +            <feature>"fma"</feature>
> +            <feature>"cx16"</feature>
> +            <feature>"xtpr"</feature>
> +            <feature>"pdcm"</feature>
> +            <feature></feature>
> +            <feature>"pcid"</feature>
> +            <feature>"dca"</feature>
> +            <feature>"sse4.1"</feature>
> +            <feature>"sse4.2"</feature>
> +            <feature>"x2apic"</feature>
> +            <feature>"movbe"</feature>
> +            <feature>"popcnt"</feature>
> +            <feature>"tsc-deadline"</feature>
> +            <feature>"aes"</feature>
> +            <feature>"xsave"</feature>
> +            <feature></feature><!-- osxsave -->
> +            <feature>"avx"</feature>
> +            <feature>"f16c"</feature>
> +            <feature>"rdrand"</feature>
> +            <feature>"hypervisor"</feature>
> +        </feat_names>
> +        <cpuid>
> +            <eax>1</eax>
> +            <reg>R_ECX</reg>
> +        </cpuid>
> +        <tcg_features>TCG_EXT_FEATURES</tcg_features>
> +    </feature_word>
> +    <!-- Feature names that are already defined on feature_name[] but
> +     * are set on CPUID[8000_0001].EDX on AMD CPUs don't have their
> +     * names on feat_names below. They are copied automatically
> +     * to features[FEAT_8000_0001_EDX] if and only if CPU vendor is AMD. -->
> +    <feature_word index="FEAT_8000_0001_EDX">
> +        <type>CPUID_FEATURE_WORD</type>
> +        <feat_names>
> +            <feature></feature><!-- fpu -->
> +            <feature></feature><!-- vme -->
> +            <feature></feature><!-- de -->
> +            <feature></feature><!-- pse -->
> +            <feature></feature><!-- tsc -->
> +            <feature></feature><!-- msr -->
> +            <feature></feature><!-- pae -->
> +            <feature></feature><!-- mce -->
> +            <feature></feature><!-- cx8 -->
> +            <feature></feature><!-- apic -->
> +            <feature></feature>
> +            <feature>"syscall"</feature>
> +            <feature></feature><!-- mtrr -->
> +            <feature></feature><!-- pge -->
> +            <feature></feature><!-- mca -->
> +            <feature></feature><!-- cmov -->
> +            <feature></feature><!-- pat -->
> +            <feature></feature><!-- pse36 -->
> +            <feature></feature>
> +            <feature></feature><!-- Linux mp -->
> +            <feature>"nx"</feature>
> +            <feature></feature>
> +            <feature>"mmxext"</feature>
> +            <feature></feature><!-- mmx -->
> +            <feature></feature><!-- fxsr -->
> +            <feature>"fxsr-opt"</feature>
> +            <feature>"pdpe1gb"</feature>
> +            <feature>"rdtscp"</feature>
> +            <feature></feature>
> +            <feature>"lm"</feature>
> +            <feature>"3dnowext"</feature>
> +            <feature>"3dnow"</feature>
> +        </feat_names>
> +        <cpuid>
> +            <eax>0x80000001</eax>
> +            <reg>R_EDX</reg>
> +        </cpuid>
> +        <tcg_features>TCG_EXT2_FEATURES</tcg_features>
> +    </feature_word>
> +    <feature_word index="FEAT_8000_0001_ECX">
> +        <type>CPUID_FEATURE_WORD</type>
> +        <feat_names>
> +            <feature>"lahf-lm"</feature>
> +            <feature>"cmp-legacy"</feature>
> +            <feature>"svm"</feature>
> +            <feature>"extapic"</feature>
> +            <feature>"cr8legacy"</feature>
> +            <feature>"abm"</feature>
> +            <feature>"sse4a"</feature>
> +            <feature>"misalignsse"</feature>
> +            <feature>"3dnowprefetch"</feature>
> +            <feature>"osvw"</feature>
> +            <feature>"ibs"</feature>
> +            <feature>"xop"</feature>
> +            <feature>"skinit"</feature>
> +            <feature>"wdt"</feature>
> +            <feature></feature>
> +            <feature>"lwp"</feature>
> +            <feature>"fma4"</feature>
> +            <feature>"tce"</feature>
> +            <feature></feature>
> +            <feature>"nodeid-msr"</feature>
> +            <feature></feature>
> +            <feature>"tbm"</feature>
> +            <feature>"topoext"</feature>
> +            <feature>"perfctr-core"</feature>
> +            <feature>"perfctr-nb"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +        </feat_names>
> +        <cpuid>
> +            <eax>0x80000001</eax>
> +            <reg>R_ECX</reg>
> +        </cpuid>
> +        <tcg_features>TCG_EXT3_FEATURES</tcg_features>
> +        <!-- * TOPOEXT is always allowed but can't be enabled blindly by
> +         * "-cpu host", as it requires consistent cache topology info
> +         * to be provided so it doesn't confuse guests. -->
> +        <no_autoenable_flags>CPUID_EXT3_TOPOEXT</no_autoenable_flags>
> +    </feature_word>
> +    <feature_word index="FEAT_C000_0001_EDX">
> +        <type>CPUID_FEATURE_WORD</type>
> +        <feat_names>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"xstore"</feature>
> +            <feature>"xstore-en"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"xcrypt"</feature>
> +            <feature>"xcrypt-en"</feature>
> +            <feature>"ace2"</feature>
> +            <feature>"ace2-en"</feature>
> +            <feature>"phe"</feature>
> +            <feature>"phe-en"</feature>
> +            <feature>"pmm"</feature>
> +            <feature>"pmm-en"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +        </feat_names>
> +        <cpuid>
> +            <eax>0xC0000001</eax>
> +            <reg>R_EDX</reg>
> +        </cpuid>
> +        <tcg_features>TCG_EXT4_FEATURES</tcg_features>
> +    </feature_word>
> +    <feature_word index="FEAT_KVM">
> +        <type>CPUID_FEATURE_WORD</type>
> +        <feat_names>
> +            <feature>"kvmclock"</feature>
> +            <feature>"kvm-nopiodelay"</feature>
> +            <feature>"kvm-mmu"</feature>
> +            <feature>"kvmclock"</feature>
> +            <feature>"kvm-asyncpf"</feature>
> +            <feature>"kvm-steal-time"</feature>
> +            <feature>"kvm-pv-eoi"</feature>
> +            <feature>"kvm-pv-unhalt"</feature>
> +            <feature></feature>
> +            <feature>"kvm-pv-tlb-flush"</feature>
> +            <feature></feature>
> +            <feature>"kvm-pv-ipi"</feature>
> +            <feature>"kvm-poll-control"</feature>
> +            <feature>"kvm-pv-sched-yield"</feature>
> +            <feature>"kvm-asyncpf-int"</feature>
> +            <feature>"kvm-msi-ext-dest-id"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"kvmclock-stable-bit"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +        </feat_names>
> +        <cpuid>
> +            <eax>KVM_CPUID_FEATURES</eax>
> +            <reg>R_EAX</reg>
> +        </cpuid>
> +        <tcg_features>TCG_KVM_FEATURES</tcg_features>
> +    </feature_word>
> +    <feature_word index="FEAT_KVM_HINTS">
> +        <type>CPUID_FEATURE_WORD</type>
> +        <feat_names>
> +            <feature>"kvm-hint-dedicated"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +        </feat_names>
> +        <cpuid>
> +            <eax>KVM_CPUID_FEATURES</eax>
> +            <reg>R_EDX</reg>
> +        </cpuid>
> +        <tcg_features>TCG_KVM_FEATURES</tcg_features>
> +        <!-- * KVM hints aren't auto-enabled by -cpu host, they need to be
> +         * explicitly enabled in the command-line. -->
> +        <no_autoenable_flags>~0U</no_autoenable_flags>
> +    </feature_word>
> +    <feature_word index="FEAT_SVM">
> +        <type>CPUID_FEATURE_WORD</type>
> +        <feat_names>
> +            <feature>"npt"</feature>
> +            <feature>"lbrv"</feature>
> +            <feature>"svm-lock"</feature>
> +            <feature>"nrip-save"</feature>
> +            <feature>"tsc-scale"</feature>
> +            <feature>"vmcb-clean"</feature>
> +            <feature>"flushbyasid"</feature>
> +            <feature>"decodeassists"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"pause-filter"</feature>
> +            <feature></feature>
> +            <feature>"pfthreshold"</feature>
> +            <feature>"avic"</feature>
> +            <feature></feature>
> +            <feature>"v-vmsave-vmload"</feature>
> +            <feature>"vgif"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"vnmi"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"svme-addr-chk"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +        </feat_names>
> +        <cpuid>
> +            <eax>0x8000000A</eax>
> +            <reg>R_EDX</reg>
> +        </cpuid>
> +        <tcg_features>TCG_SVM_FEATURES</tcg_features>
> +    </feature_word>
> +    <feature_word index="FEAT_7_0_EBX">
> +        <type>CPUID_FEATURE_WORD</type>
> +        <feat_names>
> +            <feature>"fsgsbase"</feature>
> +            <feature>"tsc-adjust"</feature>
> +            <feature>"sgx"</feature>
> +            <feature>"bmi1"</feature>
> +            <feature>"hle"</feature>
> +            <feature>"avx2"</feature>
> +            <feature></feature>
> +            <feature>"smep"</feature>
> +            <feature>"bmi2"</feature>
> +            <feature>"erms"</feature>
> +            <feature>"invpcid"</feature>
> +            <feature>"rtm"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"mpx"</feature>
> +            <feature></feature>
> +            <feature>"avx512f"</feature>
> +            <feature>"avx512dq"</feature>
> +            <feature>"rdseed"</feature>
> +            <feature>"adx"</feature>
> +            <feature>"smap"</feature>
> +            <feature>"avx512ifma"</feature>
> +            <feature>"pcommit"</feature>
> +            <feature>"clflushopt"</feature>
> +            <feature>"clwb"</feature>
> +            <feature>"intel-pt"</feature>
> +            <feature>"avx512pf"</feature>
> +            <feature>"avx512er"</feature>
> +            <feature>"avx512cd"</feature>
> +            <feature>"sha-ni"</feature>
> +            <feature>"avx512bw"</feature>
> +            <feature>"avx512vl"</feature>
> +        </feat_names>
> +        <cpuid>
> +            <eax>7</eax>
> +            <needs_ecx>true</needs_ecx>
> +            <ecx>0</ecx>
> +            <reg>R_EBX</reg>
> +        </cpuid>
> +        <tcg_features>TCG_7_0_EBX_FEATURES</tcg_features>
> +    </feature_word>
> +    <feature_word index="FEAT_7_0_ECX">
> +        <type>CPUID_FEATURE_WORD</type>
> +        <feat_names>
> +            <feature></feature>
> +            <feature>"avx512vbmi"</feature>
> +            <feature>"umip"</feature>
> +            <feature>"pku"</feature>
> +            <feature></feature><!-- ospke -->
> +            <feature>"waitpkg"</feature>
> +            <feature>"avx512vbmi2"</feature>
> +            <feature></feature>
> +            <feature>"gfni"</feature>
> +            <feature>"vaes"</feature>
> +            <feature>"vpclmulqdq"</feature>
> +            <feature>"avx512vnni"</feature>
> +            <feature>"avx512bitalg"</feature>
> +            <feature></feature>
> +            <feature>"avx512-vpopcntdq"</feature>
> +            <feature></feature>
> +            <feature>"la57"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"rdpid"</feature>
> +            <feature></feature>
> +            <feature>"bus-lock-detect"</feature>
> +            <feature>"cldemote"</feature>
> +            <feature></feature>
> +            <feature>"movdiri"</feature>
> +            <feature>"movdir64b"</feature>
> +            <feature></feature>
> +            <feature>"sgxlc"</feature>
> +            <feature>"pks"</feature>
> +        </feat_names>
> +        <cpuid>
> +            <eax>7</eax>
> +            <needs_ecx>true</needs_ecx>
> +            <ecx>0</ecx>
> +            <reg>R_ECX</reg>
> +        </cpuid>
> +        <tcg_features>TCG_7_0_ECX_FEATURES</tcg_features>
> +    </feature_word>
> +    <feature_word index="FEAT_7_0_EDX">
> +        <type>CPUID_FEATURE_WORD</type>
> +        <feat_names>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"avx512-4vnniw"</feature>
> +            <feature>"avx512-4fmaps"</feature>
> +            <feature>"fsrm"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"avx512-vp2intersect"</feature>
> +            <feature></feature>
> +            <feature>"md-clear"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"serialize"</feature>
> +            <feature></feature>
> +            <feature>"tsx-ldtrk"</feature>
> +            <feature></feature>
> +            <feature></feature><!-- pconfig -->
> +            <feature>"arch-lbr"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"amx-bf16"</feature>
> +            <feature>"avx512-fp16"</feature>
> +            <feature>"amx-tile"</feature>
> +            <feature>"amx-int8"</feature>
> +            <feature>"spec-ctrl"</feature>
> +            <feature>"stibp"</feature>
> +            <feature>"flush-l1d"</feature>
> +            <feature>"arch-capabilities"</feature>
> +            <feature>"core-capability"</feature>
> +            <feature>"ssbd"</feature>
> +        </feat_names>
> +        <cpuid>
> +            <eax>7</eax>
> +            <needs_ecx>true</needs_ecx>
> +            <ecx>0</ecx>
> +            <reg>R_EDX</reg>
> +        </cpuid>
> +        <tcg_features>TCG_7_0_EDX_FEATURES</tcg_features>
> +    </feature_word>
> +    <feature_word index="FEAT_7_1_EAX">
> +        <type>CPUID_FEATURE_WORD</type>
> +        <feat_names>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"avx-vnni"</feature>
> +            <feature>"avx512-bf16"</feature>
> +            <feature></feature>
> +            <feature>"cmpccxadd"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"fzrm"</feature>
> +            <feature>"fsrs"</feature>
> +            <feature>"fsrc"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"amx-fp16"</feature>
> +            <feature></feature>
> +            <feature>"avx-ifma"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +        </feat_names>
> +        <cpuid>
> +            <eax>7</eax>
> +            <needs_ecx>true</needs_ecx>
> +            <ecx>1</ecx>
> +            <reg>R_EAX</reg>
> +        </cpuid>
> +        <tcg_features>TCG_7_1_EAX_FEATURES</tcg_features>
> +    </feature_word>
> +    <feature_word index="FEAT_7_1_EDX">
> +        <type>CPUID_FEATURE_WORD</type>
> +        <feat_names>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"avx-vnni-int8"</feature>
> +            <feature>"avx-ne-convert"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"prefetchiti"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +        </feat_names>
> +        <cpuid>
> +            <eax>7</eax>
> +            <needs_ecx>true</needs_ecx>
> +            <ecx>1</ecx>
> +            <reg>R_EDX</reg>
> +        </cpuid>
> +        <tcg_features>TCG_7_1_EDX_FEATURES</tcg_features>
> +    </feature_word>
> +    <feature_word index="FEAT_7_2_EDX">
> +        <type>CPUID_FEATURE_WORD</type>
> +        <feat_names>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"mcdt-no"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +        </feat_names>
> +        <cpuid>
> +            <eax>7</eax>
> +            <needs_ecx>true</needs_ecx>
> +            <ecx>2</ecx>
> +            <reg>R_EDX</reg>
> +        </cpuid>
> +        <tcg_features>TCG_7_2_EDX_FEATURES</tcg_features>
> +    </feature_word>
> +    <feature_word index="FEAT_8000_0007_EDX">
> +        <type>CPUID_FEATURE_WORD</type>
> +        <feat_names>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"invtsc"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +        </feat_names>
> +        <cpuid>
> +            <eax>0x80000007</eax>
> +            <reg>R_EDX</reg>
> +        </cpuid>
> +        <tcg_features>TCG_APM_FEATURES</tcg_features>
> +        <unmigratable_flags>CPUID_APM_INVTSC</unmigratable_flags>
> +    </feature_word>
> +    <feature_word index="FEAT_8000_0008_EBX">
> +        <type>CPUID_FEATURE_WORD</type>
> +        <feat_names>
> +            <feature>"clzero"</feature>
> +            <feature></feature>
> +            <feature>"xsaveerptr"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"wbnoinvd"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"ibpb"</feature>
> +            <feature></feature>
> +            <feature>"ibrs"</feature>
> +            <feature>"amd-stibp"</feature>
> +            <feature></feature>
> +            <feature>"stibp-always-on"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"amd-ssbd"</feature>
> +            <feature>"virt-ssbd"</feature>
> +            <feature>"amd-no-ssb"</feature>
> +            <feature></feature>
> +            <feature>"amd-psfd"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +        </feat_names>
> +        <cpuid>
> +            <eax>0x80000008</eax>
> +            <reg>R_EBX</reg>
> +        </cpuid>
> +        <tcg_features>TCG_8000_0008_EBX</tcg_features>
> +        <unmigratable_flags>0</unmigratable_flags>
> +    </feature_word>
> +    <feature_word index="FEAT_8000_0021_EAX">
> +        <type>CPUID_FEATURE_WORD</type>
> +        <feat_names>
> +            <feature>"no-nested-data-bp"</feature>
> +            <feature></feature>
> +            <feature>"lfence-always-serializing"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"null-sel-clr-base"</feature>
> +            <feature></feature>
> +            <feature>"auto-ibrs"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +        </feat_names>
> +        <cpuid>
> +            <eax>0x80000021</eax>
> +            <reg>R_EAX</reg>
> +        </cpuid>
> +        <tcg_features>0</tcg_features>
> +        <unmigratable_flags>0</unmigratable_flags>
> +    </feature_word>
> +    <feature_word index="FEAT_XSAVE">
> +        <type>CPUID_FEATURE_WORD</type>
> +        <feat_names>
> +            <feature>"xsaveopt"</feature>
> +            <feature>"xsavec"</feature>
> +            <feature>"xgetbv1"</feature>
> +            <feature>"xsaves"</feature>
> +            <feature>"xfd"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +        </feat_names>
> +        <cpuid>
> +            <eax>0xd</eax>
> +            <needs_ecx>true</needs_ecx>
> +            <ecx>1</ecx>
> +            <reg>R_EAX</reg>
> +        </cpuid>
> +        <tcg_features>TCG_XSAVE_FEATURES</tcg_features>
> +    </feature_word>
> +    <feature_word index="FEAT_XSAVE_XSS_LO">
> +        <type>CPUID_FEATURE_WORD</type>
> +        <feat_names>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +        </feat_names>
> +        <cpuid>
> +            <eax>0xD</eax>
> +            <needs_ecx>true</needs_ecx>
> +            <ecx>1</ecx>
> +            <reg>R_ECX</reg>
> +        </cpuid>
> +    </feature_word>
> +    <feature_word index="FEAT_XSAVE_XSS_HI">
> +        <type>CPUID_FEATURE_WORD</type>
> +        <cpuid>
> +            <eax>0xD</eax>
> +            <needs_ecx>true</needs_ecx>
> +            <ecx>1</ecx>
> +            <reg>R_EDX</reg>
> +        </cpuid>
> +    </feature_word>
> +    <feature_word index="FEAT_6_EAX">
> +        <type>CPUID_FEATURE_WORD</type>
> +        <feat_names>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"arat"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +        </feat_names>
> +        <cpuid>
> +            <eax>6</eax>
> +            <reg>R_EAX</reg>
> +        </cpuid>
> +        <tcg_features>TCG_6_EAX_FEATURES</tcg_features>
> +    </feature_word>
> +    <feature_word index="FEAT_XSAVE_XCR0_LO">
> +        <type>CPUID_FEATURE_WORD</type>
> +        <cpuid>
> +            <eax>0xD</eax>
> +            <needs_ecx>true</needs_ecx>
> +            <ecx>0</ecx>
> +            <reg>R_EAX</reg>
> +        </cpuid>
> +        <tcg_features>~0U</tcg_features>
> +        <migratable_flags>XSTATE_FP_MASK | XSTATE_SSE_MASK | XSTATE_YMM_MASK | XSTATE_BNDREGS_MASK | XSTATE_BNDCSR_MASK | XSTATE_OPMASK_MASK | XSTATE_ZMM_Hi256_MASK | XSTATE_Hi16_ZMM_MASK | XSTATE_PKRU_MASK</migratable_flags>
> +    </feature_word>
> +    <feature_word index="FEAT_XSAVE_XCR0_HI">
> +        <type>CPUID_FEATURE_WORD</type>
> +        <cpuid>
> +            <eax>0xD</eax>
> +            <needs_ecx>true</needs_ecx>
> +            <ecx>0</ecx>
> +            <reg>R_EDX</reg>
> +        </cpuid>
> +        <tcg_features>~0U</tcg_features>
> +    </feature_word>
> +    <!-- Below are MSR exposed features -->
> +    <feature_word index="FEAT_ARCH_CAPABILITIES">
> +        <type>MSR_FEATURE_WORD</type>
> +        <feat_names>
> +            <feature>"rdctl-no"</feature>
> +            <feature>"ibrs-all"</feature>
> +            <feature>"rsba"</feature>
> +            <feature>"skip-l1dfl-vmentry"</feature>
> +            <feature>"ssb-no"</feature>
> +            <feature>"mds-no"</feature>
> +            <feature>"pschange-mc-no"</feature>
> +            <feature>"tsx-ctrl"</feature>
> +            <feature>"taa-no"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"sbdr-ssdp-no"</feature>
> +            <feature>"fbsdp-no"</feature>
> +            <feature>"psdp-no"</feature>
> +            <feature></feature>
> +            <feature>"fb-clear"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"pbrsb-no"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +        </feat_names>
> +        <msr>MSR_IA32_ARCH_CAPABILITIES</msr>
> +        <!-- * FEAT_ARCH_CAPABILITIES only affects a read-only MSR, which
> +         * cannot be read from user mode.  Therefore, it has no impact
> +         > on any user-mode operation, and warnings about unsupported
> +         * features do not matter. -->
> +        <tcg_features>~0U</tcg_features>
> +    </feature_word>
> +    <feature_word index="FEAT_CORE_CAPABILITY">
> +        <type>MSR_FEATURE_WORD</type>
> +        <feat_names>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"split-lock-detect"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +        </feat_names>
> +        <msr>MSR_IA32_CORE_CAPABILITY</msr>
> +    </feature_word>
> +    <feature_word index="FEAT_PERF_CAPABILITIES">
> +        <type>MSR_FEATURE_WORD</type>
> +        <feat_names>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"full-width-write"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +        </feat_names>
> +        <msr>MSR_IA32_PERF_CAPABILITIES</msr>
> +    </feature_word>
> +    <feature_word index="FEAT_VMX_PROCBASED_CTLS">
> +        <type>MSR_FEATURE_WORD</type>
> +        <feat_names>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"vmx-vintr-pending"</feature>
> +            <feature>"vmx-tsc-offset"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"vmx-hlt-exit"</feature>
> +            <feature></feature>
> +            <feature>"vmx-invlpg-exit"</feature>
> +            <feature>"vmx-mwait-exit"</feature>
> +            <feature>"vmx-rdpmc-exit"</feature>
> +            <feature>"vmx-rdtsc-exit"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"vmx-cr3-load-noexit"</feature>
> +            <feature>"vmx-cr3-store-noexit"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"vmx-cr8-load-exit"</feature>
> +            <feature>"vmx-cr8-store-exit"</feature>
> +            <feature>"vmx-flexpriority"</feature>
> +            <feature>"vmx-vnmi-pending"</feature>
> +            <feature>"vmx-movdr-exit"</feature>
> +            <feature>"vmx-io-exit"</feature>
> +            <feature>"vmx-io-bitmap"</feature>
> +            <feature></feature>
> +            <feature>"vmx-mtf"</feature>
> +            <feature>"vmx-msr-bitmap"</feature>
> +            <feature>"vmx-monitor-exit"</feature>
> +            <feature>"vmx-pause-exit"</feature>
> +            <feature>"vmx-secondary-ctls"</feature>
> +        </feat_names>
> +        <msr>MSR_IA32_VMX_TRUE_PROCBASED_CTLS</msr>
> +    </feature_word>
> +    <feature_word index="FEAT_VMX_SECONDARY_CTLS">
> +        <type>MSR_FEATURE_WORD</type>
> +        <feat_names>
> +            <feature>"vmx-apicv-xapic"</feature>
> +            <feature>"vmx-ept"</feature>
> +            <feature>"vmx-desc-exit"</feature>
> +            <feature>"vmx-rdtscp-exit"</feature>
> +            <feature>"vmx-apicv-x2apic"</feature>
> +            <feature>"vmx-vpid"</feature>
> +            <feature>"vmx-wbinvd-exit"</feature>
> +            <feature>"vmx-unrestricted-guest"</feature>
> +            <feature>"vmx-apicv-register"</feature>
> +            <feature>"vmx-apicv-vid"</feature>
> +            <feature>"vmx-ple"</feature>
> +            <feature>"vmx-rdrand-exit"</feature>
> +            <feature>"vmx-invpcid-exit"</feature>
> +            <feature>"vmx-vmfunc"</feature>
> +            <feature>"vmx-shadow-vmcs"</feature>
> +            <feature>"vmx-encls-exit"</feature>
> +            <feature>"vmx-rdseed-exit"</feature>
> +            <feature>"vmx-pml"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"vmx-xsaves"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"vmx-tsc-scaling"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +        </feat_names>
> +        <msr>MSR_IA32_VMX_PROCBASED_CTLS2</msr>
> +    </feature_word>
> +    <feature_word index="FEAT_VMX_PINBASED_CTLS">
> +        <type>MSR_FEATURE_WORD</type>
> +        <feat_names>
> +            <feature>"vmx-intr-exit"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"vmx-nmi-exit"</feature>
> +            <feature></feature>
> +            <feature>"vmx-vnmi"</feature>
> +            <feature>"vmx-preemption-timer"</feature>
> +            <feature>"vmx-posted-intr"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +        </feat_names>
> +        <msr>MSR_IA32_VMX_TRUE_PINBASED_CTLS</msr>
> +    </feature_word>
> +    <feature_word index="FEAT_VMX_EXIT_CTLS">
> +        <type>MSR_FEATURE_WORD</type>
> +        <!-- * VMX_VM_EXIT_HOST_ADDR_SPACE_SIZE is copied from
> +         * the LM CPUID bit. -->
> +        <feat_names>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"vmx-exit-nosave-debugctl"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature><!-- vmx-exit-host-addr-space-size -->
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"vmx-exit-load-perf-global-ctrl"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"vmx-exit-ack-intr"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"vmx-exit-save-pat"</feature>
> +            <feature>"vmx-exit-load-pat"</feature>
> +            <feature>"vmx-exit-save-efer"</feature>
> +            <feature>"vmx-exit-load-efer"</feature>
> +            <feature>"vmx-exit-save-preemption-timer"</feature>
> +            <feature>"vmx-exit-clear-bndcfgs"</feature>
> +            <feature></feature>
> +            <feature>"vmx-exit-clear-rtit-ctl"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"vmx-exit-load-pkrs"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +        </feat_names>
> +        <msr>MSR_IA32_VMX_TRUE_EXIT_CTLS</msr>
> +    </feature_word>
> +    <feature_word index="FEAT_VMX_ENTRY_CTLS">
> +        <type>MSR_FEATURE_WORD</type>
> +        <feat_names>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"vmx-entry-noload-debugctl"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"vmx-entry-ia32e-mode"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"vmx-entry-load-perf-global-ctrl"</feature>
> +            <feature>"vmx-entry-load-pat"</feature>
> +            <feature>"vmx-entry-load-efer"</feature>
> +            <feature>"vmx-entry-load-bndcfgs"</feature>
> +            <feature></feature>
> +            <feature>"vmx-entry-load-rtit-ctl"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"vmx-entry-load-pkrs"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +        </feat_names>
> +        <msr>MSR_IA32_VMX_TRUE_ENTRY_CTLS</msr>
> +    </feature_word>
> +    <feature_word index="FEAT_VMX_MISC">
> +        <type>MSR_FEATURE_WORD</type>
> +        <feat_names>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"vmx-store-lma"</feature>
> +            <feature>"vmx-activity-hlt"</feature>
> +            <feature>"vmx-activity-shutdown"</feature>
> +            <feature>"vmx-activity-wait-sipi"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"vmx-vmwrite-vmexit-fields"</feature>
> +            <feature>"vmx-zero-len-inject"</feature>
> +            <feature></feature>
> +        </feat_names>
> +        <msr>MSR_IA32_VMX_MISC</msr>
> +    </feature_word>
> +    <feature_word index="FEAT_VMX_EPT_VPID_CAPS">
> +        <type>MSR_FEATURE_WORD</type>
> +        <feat_names>
> +            <feature>"vmx-ept-execonly"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"vmx-page-walk-4"</feature>
> +            <feature>"vmx-page-walk-5"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"vmx-ept-2mb"</feature>
> +            <feature>"vmx-ept-1gb"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"vmx-invept"</feature>
> +            <feature>"vmx-eptad"</feature>
> +            <feature>"vmx-ept-advanced-exitinfo"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"vmx-invept-single-context"</feature>
> +            <feature>"vmx-invept-all-context"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"vmx-invvpid"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"vmx-invvpid-single-addr"</feature>
> +            <feature>"vmx-invept-single-context"</feature>
> +            <feature>"vmx-invvpid-all-context"</feature>
> +            <feature>"vmx-invept-single-context-noglobals"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +        </feat_names>
> +        <msr>MSR_IA32_VMX_EPT_VPID_CAP</msr>
> +    </feature_word>
> +    <feature_word index="FEAT_VMX_BASIC">
> +        <type>MSR_FEATURE_WORD</type>
> +        <feat_names>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"vmx-ins-outs"</feature>
> +            <feature>"vmx-true-ctls"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +        </feat_names>
> +        <msr>MSR_IA32_VMX_BASIC</msr>
> +        <!-- Just to be safe - we don't support setting the MSEG version field. -->
> +        <no_autoenable_flags>MSR_VMX_BASIC_DUAL_MONITOR</no_autoenable_flags>
> +    </feature_word>
> +    <feature_word index="FEAT_VMX_VMFUNC">
> +        <type>MSR_FEATURE_WORD</type>
> +        <feat_names>
> +            <feature>"vmx-eptp-switching"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +        </feat_names>
> +        <msr>MSR_IA32_VMX_VMFUNC</msr>
> +    </feature_word>
> +    <feature_word index="FEAT_14_0_ECX">
> +        <type>CPUID_FEATURE_WORD</type>
> +        <feat_names>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"intel-pt-lip"</feature>
> +        </feat_names>
> +        <cpuid>
> +            <eax>0x14</eax>
> +            <needs_ecx>true</needs_ecx>
> +            <ecx>0</ecx>
> +            <reg>R_ECX</reg>
> +        </cpuid>
> +        <tcg_features>TCG_14_0_ECX_FEATURES</tcg_features>
> +    </feature_word>
> +    <feature_word index="FEAT_SGX_12_0_EAX">
> +        <type>CPUID_FEATURE_WORD</type>
> +        <feat_names>
> +            <feature>"sgx1"</feature>
> +            <feature>"sgx2"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"sgx-edeccssa"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +        </feat_names>
> +        <cpuid>
> +            <eax>0x12</eax>
> +            <needs_ecx>true</needs_ecx>
> +            <ecx>0</ecx>
> +            <reg>R_EAX</reg>
> +        </cpuid>
> +        <tcg_features>TCG_SGX_12_0_EAX_FEATURES</tcg_features>
> +    </feature_word>
> +    <feature_word index="FEAT_SGX_12_0_EBX">
> +        <type>CPUID_FEATURE_WORD</type>
> +        <feat_names>
> +            <feature>"sgx-exinfo"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +        </feat_names>
> +        <cpuid>
> +            <eax>0x12</eax>
> +            <needs_ecx>true</needs_ecx>
> +            <ecx>0</ecx>
> +            <reg>R_EBX</reg>
> +        </cpuid>
> +        <tcg_features>TCG_SGX_12_0_EBX_FEATURES</tcg_features>
> +    </feature_word>
> +    <feature_word index="FEAT_SGX_12_1_EAX">
> +        <type>CPUID_FEATURE_WORD</type>
> +        <feat_names>
> +            <feature></feature>
> +            <feature>"sgx-debug"</feature>
> +            <feature>"sgx-mode64"</feature>
> +            <feature></feature>
> +            <feature>"sgx-provisionkey"</feature>
> +            <feature>"sgx-tokenkey"</feature>
> +            <feature></feature>
> +            <feature>"sgx-kss"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature>"sgx-aex-notify"</feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +            <feature></feature>
> +        </feat_names>
> +        <cpuid>
> +            <eax>0x12</eax>
> +            <needs_ecx>true</needs_ecx>
> +            <ecx>1</ecx>
> +            <reg>R_EAX</reg>
> +        </cpuid>
> +        <tcg_features>TCG_SGX_12_1_EAX_FEATURES</tcg_features>
> +    </feature_word>
> +</feature_words>
> -- 
> 2.39.2
> 
> 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/4] target/i386: Translate feature_word_info to xml
  2023-08-21  9:54     ` Tim Wiederhake
@ 2023-09-06 14:33       ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-06 14:33 UTC (permalink / raw)
  To: Tim Wiederhake, Daniel P. Berrangé; +Cc: qemu-devel, Michael S. Tsirkin

On 21/8/23 11:54, Tim Wiederhake wrote:
> On Thu, 2023-08-17 at 12:07 +0100, Daniel P. Berrangé wrote:
>> On Fri, Aug 11, 2023 at 03:50:09PM +0200, Tim Wiederhake wrote:
>>> This is the data file that will be used to generate the C code.
>>> All information, including the comments, is preserved.
>>>
>>> Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
>>> ---
>>>   target/i386/feature_word_info.xml | 1607
>>> +++++++++++++++++++++++++++++
>>>   1 file changed, 1607 insertions(+)
>>>   create mode 100644 target/i386/feature_word_info.xml
>>>
>>> diff --git a/target/i386/feature_word_info.xml
>>> b/target/i386/feature_word_info.xml
>>> new file mode 100644
>>> index 0000000000..ff741b9f5a
>>> --- /dev/null
>>> +++ b/target/i386/feature_word_info.xml
>>> @@ -0,0 +1,1607 @@
>>> +<feature_words>
>>
>> I think adding data formats based on XML is pretty undesirable
>> for QEMU. AFAIK, the only place we've used XML is where we
>> needed to have interoperability with an external tool.
>>
>> Can we not just do this using JSON instead, which would avoid
>> the need to write python parsing code as we can directly load
>> it into a python object.
>>
>> With regards,
>> Daniel
> 
> I thought of json as well, but that has some drawbacks over xml here:
> 
> Integer values, e.g. "eax=0x80000008", would need to be stored in
> either decimal form or as a string. Both solutions are not desirable in
> my opinion.
> 
> Additionally, preserving the comments is not as straight forward.
> Comments in json are a non-standard extension and not understood by all
> parsers, e.g. python's json module. This would require some regex-
> preprocessing that comes with its own problems.

Would YAML work?



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/4] target/i386: Split out feature_word_info
  2023-08-11 13:50 ` [PATCH 1/4] target/i386: Split out feature_word_info Tim Wiederhake
@ 2023-09-06 14:34   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-06 14:34 UTC (permalink / raw)
  To: Tim Wiederhake, qemu-devel

On 11/8/23 15:50, Tim Wiederhake wrote:
> The isolated part will be generated by a script.
> 
> Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
> ---
>   target/i386/cpu.c                   | 677 +---------------------------
>   target/i386/feature_word_info.c.inc | 676 +++++++++++++++++++++++++++
>   2 files changed, 677 insertions(+), 676 deletions(-)
>   create mode 100644 target/i386/feature_word_info.c.inc

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-09-06 14:35 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-11 13:50 [PATCH 0/4] Generate x86 cpu features Tim Wiederhake
2023-08-11 13:50 ` [PATCH 1/4] target/i386: Split out feature_word_info Tim Wiederhake
2023-09-06 14:34   ` Philippe Mathieu-Daudé
2023-08-11 13:50 ` [PATCH 2/4] target/i386: Translate feature_word_info to xml Tim Wiederhake
2023-08-17 11:07   ` Daniel P. Berrangé
2023-08-21  9:54     ` Tim Wiederhake
2023-09-06 14:33       ` Philippe Mathieu-Daudé
2023-09-06 14:21   ` Michael S. Tsirkin
2023-08-11 13:50 ` [PATCH 3/4] target/i386: Format feature_word_info.c.inc Tim Wiederhake
2023-08-11 13:50 ` [PATCH 4/4] target/i386: Autogenerate feature_word_info.c.inc Tim Wiederhake

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).