Generate x86 cpu features
v2 cover Generate x86 cpu features
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 a yaml file and adds a script to generate the c code from this data.
A patch set to convert the cpu model data (builtin_x86_defs) in the same way will follow.
v1: https://lists.nongnu.org/archive/html/qemu-devel/2023-08/msg02005.html
Changes since v1:
* Incorporated changes from
https://lists.nongnu.org/archive/html/qemu-devel/2023-08/msg04241.html.
* Changed data format from xml to yaml, as proposed in
https://lists.nongnu.org/archive/html/qemu-devel/2023-09/msg01033.html.
Using json has some drawbacks, see
https://lists.nongnu.org/archive/html/qemu-devel/2023-08/msg03384.html.
* Rebased on top of current master. Features added in the meantime:
amx-complex and vmx-enable-user-wait-pause
* Split up the reformatting of feature_word_info.c.inc to make it easier to review. These patches could be squashed together before merging.
Tim Wiederhake (10):
target/i386: Add missing feature names in FEAT_VMX_EPT_VPID_CAPS target/i386: Fix feature names in FEAT_VMX_EPT_VPID_CAPS target/i386: Fix duplicated feature name in FEAT_KVM target/i386: Split out feature_word_info
target/i386: Translate feature_word_info to yaml target/i386: Format feature_word_info.c.inc: Remove comments target/i386: Format feature_word_info.c.inc: feat_names target/i386: Format feature_word_info.c.inc: Unfold cpuid member target/i386: Format feature_word_info.c.inc: Whitespaces and trailing
commas
target/i386: Autogenerate feature_word_info.c.inc
target/i386/cpu.c | 677 +----------------- target/i386/feature_word_info.c.inc | 1030 +++++++++++++++++++++++++++ target/i386/feature_word_info.py | 62 ++ target/i386/feature_word_info.yaml | 697 ++++++++++++++++++ 4 files changed, 1790 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.yaml
Signature · 1 line
2.39.2
PATCH v2 1/10 target/i386: Add missing feature names in FEAT_VMX_EPT_VPID_CAPS
Add the missing feature names for two bits in the FEAT_VMX_EPT_VPID_CAPS cpuid leaf. "vmx-ept-uc" is currently unused, but "vmx-ept-wb" is enabled for multiple cpu models.
--- target/i386/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target/i386/cpu.c +2 -2
@@ -1314,8 +1314,8 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { .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-uc" ,NULL ,NULL ,NULL , +NULL ,NULL ,"vmx-ept-wb" ,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,
Signature · 1 line
2.39.2
Re: [PATCH v2 01/10] target/i386: Add missing feature names in FEAT_VMX_EPT_VPID_CAPS
Quoted 5 lines · On Fri, 8 Sep 2023 14:45:25 +0200 Tim Wiederhake <[email protected]> wrote:
Add the missing feature names for two bits in the
FEAT_VMX_EPT_VPID_CAPScpuid leaf. "vmx-ept-uc" is currently unused, but "vmx-ept-wb" is enabled for multiple cpu models.Signed-off-by Tim Wiederhake <[email protected]>
Quoted 19 lines
--- target/i386/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)target/i386/cpu.c +2
-2@@ -1314,8 +1314,8 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { .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-uc" ,NULL ,NULL ,NULL , +NULL ,NULL ,"vmx-ept-wb" ,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,
PATCH v2 2/10 target/i386: Fix feature names in FEAT_VMX_EPT_VPID_CAPS
In reply to Tim WiederhakeFix a copy-paste-mistake in the FEAT_VMX_EPT_VIPD_CAPS cpuid leaf. The mistake became apparent as there were two features with the same name in this cpuid leaf. The names are now in line with SDM volume 3, appendix A, section 10.
--- target/i386/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target/i386/cpu.c +2 -2
@@ -1322,8 +1322,8 @@ 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-invvpid-single-context" , +"vmx-invvpid-all-context" ,"vmx-invvpid-single-context-noglobals" ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL , NULL, NULL, NULL, NULL,
Signature · 1 line
2.39.2
Re: [PATCH v2 02/10] target/i386: Fix feature names in FEAT_VMX_EPT_VPID_CAPS
Quoted 4 lines · On Fri, 8 Sep 2023 14:45:26 +0200 Tim Wiederhake <[email protected]> wrote:
Fix a copy-paste-mistake in the
FEAT_VMX_EPT_VIPD_CAPScpuid leaf. The mistake became apparent as there were two features with the same name in this cpuid leaf. The names are now in line with SDM volume 3, appendix A, section 10.
these names are user facing ABI, and changing
them will break users that set these properties on command line.
maybe in addition opencode legacy aliases for them (initfn|realize time)
+ deprecate old names (so we can drop them eventually)
+ warning if old name is used (not sure how to do it easily though)
Quoted 21 lines
Fixes 20a78b02d3 ("target/i386: add VMX features")Signed-off-by Tim Wiederhake <[email protected]>--- target/i386/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)target/i386/cpu.c +2
-2@@ -1322,8 +1322,8 @@ 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-invvpid-single-context" , +"vmx-invvpid-all-context" ,"vmx-invvpid-single-context-noglobals" ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL , NULL, NULL, NULL, NULL,
Re: [PATCH v2 02/10] target/i386: Fix feature names in FEAT_VMX_EPT_VPID_CAPS
Quoted 8 lines · On Fri, 8 Sep 2023 16:17:31 +0200 Igor Mammedov <[email protected]> wrote:
Quoted 4 lines · On Fri, 8 Sep 2023 14:45:26 +0200 Tim Wiederhake <[email protected]> wrote:
Fix a copy-paste-mistake in the
FEAT_VMX_EPT_VIPD_CAPScpuid leaf. The mistake became apparent as there were two features with the same name in this cpuid leaf. The names are now in line with SDM volume 3, appendix A, section 10.
Quoted 7 lines
these names are user facing ABI, and changing
them will break users that set these properties on command line.maybe in addition opencode legacy aliases for them (initfn|realize time)
+ deprecate old names (so we can drop them eventually)
+ warning if old name is used (not sure how to do it easily though)
also you do here 2 different things here,
1 fixing duplicate
2 plain rename
I'd split those in 2 different patches
and mention in commit message what features you are are actually changing
PS:
+ see next patch comment and apply it here as well
Quoted 22 lines
Quoted 21 lines
Fixes 20a78b02d3 ("target/i386: add VMX features")Signed-off-by Tim Wiederhake <[email protected]>--- target/i386/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)target/i386/cpu.c +2
-2@@ -1322,8 +1322,8 @@ 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-invvpid-single-context" , +"vmx-invvpid-all-context" ,"vmx-invvpid-single-context-noglobals" ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL , NULL, NULL, NULL, NULL,
PATCH v2 3/10 target/i386: Fix duplicated feature name in FEAT_KVM
In reply to Tim WiederhakeThe mistake became apparent as there were two features with the same name in this cpuid leaf. The names are now in line with the documentation from
https://kernel.org/doc/html/latest/virt/kvm/x86/cpuid.html
--- target/i386/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/i386/cpu.c +1 -1
@@ -852,7 +852,7 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { [FEAT_KVM] = { .type = CPUID_FEATURE_WORD, .feat_names = { -"kvmclock" ,"kvm-nopiodelay" ,"kvm-mmu" ,"kvmclock" , +"kvmclock" ,"kvm-nopiodelay" ,"kvm-mmu" ,"kvmclock2" ,"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",
Signature · 1 line
2.39.2
Re: [PATCH v2 03/10] target/i386: Fix duplicated feature name in FEAT_KVM
Quoted 3 lines · On Fri, 8 Sep 2023 14:45:27 +0200 Tim Wiederhake <[email protected]> wrote:
The mistake became apparent as there were two features with the same name in this cpuid leaf. The names are now in line with the documentation from
https://kernel.org/doc/html/latest/virt/kvm/x86/cpuid.html
I'd describe what duplication breaks and it's effects.
and also why it's considered that it's safe to change names here.
Quoted 19 lines
Fixes 642258c6c7 ("kvm: add kvmclock to its second bit")Signed-off-by Tim Wiederhake <[email protected]>--- target/i386/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/i386/cpu.c +1
-1@@ -852,7 +852,7 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { [FEAT_KVM] = { .type = CPUID_FEATURE_WORD, .feat_names = { -"kvmclock" ,"kvm-nopiodelay" ,"kvm-mmu" ,"kvmclock" , +"kvmclock" ,"kvm-nopiodelay" ,"kvm-mmu" ,"kvmclock2" ,"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",
Re: [PATCH v2 03/10] target/i386: Fix duplicated feature name in FEAT_KVM
Quoted 9 lines · Igor Mammedov
Quoted 5 lines · On Fri, 8 Sep 2023 14:45:27 +0200 Tim Wiederhake <[email protected]> wrote:
The mistake became apparent as there were two features with the same name
in this cpuid leaf. The names are now in line with the documentation from
https://kernel.org/doc/html/latest/virt/kvm/x86/cpuid.html
Quoted 4 lines
I'd describe what duplication breaks and it's effects.
and also why it's considered that it's safe to change names here.
This is my first contribution to qemu. I do not know whether it is safe to change the names, nor how to find out I'm afraid. I ran make test, if that is what you mean.
Please let me know what you need me to do here.
In the meantime, I will separate the patches that rename / fix feature names from the remaining patch set, and split the changes up as requested.
Regards,
Tim
Quoted 23 lines
Quoted 22 lines
Fixes 642258c6c7 ("kvm: add kvmclock to its second bit")Signed-off-by Tim Wiederhake <[email protected]>---
target/i386/cpu.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)target/i386/cpu.c +1
-1@@ -852,7 +852,7 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { [FEAT_KVM] = { .type = CPUID_FEATURE_WORD, .feat_names = { - "kvmclock", "kvm-nopiodelay", "kvm-mmu", "kvmclock", + "kvmclock", "kvm-nopiodelay", "kvm-mmu", "kvmclock2","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",
PATCH v2 4/10 target/i386: Split out feature_word_info
In reply to Tim WiederhakeThe isolated part will be generated by a script.
--- 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
target/i386/cpu.c +1 -676
@@ -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" ,"kvmclock2" , -"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 , -"amx-complex" ,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" ,"vmx-enable-user-wait-pause" ,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" , -"vmx-ept-uc" ,NULL ,NULL ,NULL , -NULL ,NULL ,"vmx-ept-wb" ,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-invvpid-single-context" , -"vmx-invvpid-all-context" ,"vmx-invvpid-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;
target/i386/feature_word_info.c.inc new file +676 -0
676 lines not on this page · raw message
Signature · 1 line
2.39.2
PATCH v2 5/10 target/i386: Translate feature_word_info to yaml
In reply to Tim WiederhakeThis is the data file that will be used to generate the C code. All information, including the comments, is preserved.
--- target/i386/feature_word_info.yaml | 695 +++++++++++++++++++++++++++++ 1 file changed, 695 insertions(+) create mode 100644 target/i386/feature_word_info.yaml
target/i386/feature_word_info.yaml new file +695 -0
@@ -0,0 +1,695 @@ +- index: FEAT_1_EDX + cpuid: + eax: '1' + reg: R_EDX + feat_names: + 0: fpu + 1: vme + 2: de + 3: pse + 4: tsc + 5: msr + 6: pae + 7: mce + 8: cx8 + 9: apic + 11: sep + 12: mtrr + 13: pge + 14: mca + 15: cmov + 16: pat + 17: pse36 + 18: pn # Intel psn + 19: clflush # Intel clfsh + 21: ds # Intel dts + 22: acpi + 23: mmx + 24: fxsr + 25: sse + 26: sse2 + 27: ss + 28: ht # Intel htt + 29: tm + 30: ia64 + 31: pbe + tcg_features: TCG_FEATURES + type: CPUID_FEATURE_WORD + +- index: FEAT_1_ECX + cpuid: + eax: '1' + reg: R_ECX + feat_names: + 0: pni # Intel,AMD sse3 + 1: pclmulqdq + 2: dtes64 + 3: monitor + 4: ds-cpl + 5: vmx + 6: smx + 7: est + 8: tm2 + 9: ssse3 + 10: cid + 12: fma + 13: cx16 + 14: xtpr + 15: pdcm + 17: pcid + 18: dca + 19: sse4.1 + 20: sse4.2 + 21: x2apic + 22: movbe + 23: popcnt + 24: tsc-deadline + 25: aes + 26: xsave + # 27: osxsave + 28: avx + 29: f16c + 30: rdrand + 31: hypervisor + tcg_features: TCG_EXT_FEATURES + type: CPUID_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. +- index: FEAT_8000_0001_EDX + cpuid: + eax: '0x80000001' + reg: R_EDX + feat_names: + # 0: fpu + # 1: vme + # 2: de + # 3: pse + # 4: tsc + # 5: msr + # 6: pae + # 7: mce + # 8: cx8 + # 9: apic + 11: syscall + # 12: mtrr + # 13: pge + # 14: mca + # 15: cmov + # 16: pat + # 17: pse36 + # 19: Linux mp + 20: nx + 22: mmxext + # 23: mmx + # 24: fxsr + 25: fxsr-opt + 26: pdpe1gb + 27: rdtscp + 29: lm + 30: 3dnowext + 31: 3dnow + tcg_features: TCG_EXT2_FEATURES + type: CPUID_FEATURE_WORD + +- index: FEAT_8000_0001_ECX + cpuid: + eax: '0x80000001' + reg: R_ECX + feat_names: + 0: lahf-lm + 1: cmp-legacy + 2: svm + 3: extapic + 4: cr8legacy + 5: abm + 6: sse4a + 7: misalignsse + 8: 3dnowprefetch + 9: osvw + 10: ibs + 11: xop + 12: skinit + 13: wdt + 15: lwp + 16: fma4 + 17: tce + 19: nodeid-msr + 21: tbm + 22: topoext + 23: perfctr-core + 24: perfctr-nb + # 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 + tcg_features: TCG_EXT3_FEATURES + type: CPUID_FEATURE_WORD + +- index: FEAT_C000_0001_EDX + cpuid: + eax: '0xC0000001' + reg: R_EDX + feat_names: + 2: xstore + 3: xstore-en + 6: xcrypt + 7: xcrypt-en + 8: ace2 + 9: ace2-en + 10: phe + 11: phe-en + 12: pmm + 13: pmm-en + tcg_features: TCG_EXT4_FEATURES + type: CPUID_FEATURE_WORD + +- index: FEAT_KVM + cpuid: + eax: KVM_CPUID_FEATURES + reg: R_EAX + feat_names: + 0: kvmclock + 1: kvm-nopiodelay + 2: kvm-mmu + 3: kvmclock2 + 4: kvm-asyncpf + 5: kvm-steal-time + 6: kvm-pv-eoi + 7: kvm-pv-unhalt + 9: kvm-pv-tlb-flush + 11: kvm-pv-ipi + 12: kvm-poll-control + 13: kvm-pv-sched-yield + 14: kvm-asyncpf-int + 15: kvm-msi-ext-dest-id + 24: kvmclock-stable-bit + tcg_features: TCG_KVM_FEATURES + type: CPUID_FEATURE_WORD + +- index: FEAT_KVM_HINTS + cpuid: + eax: KVM_CPUID_FEATURES + reg: R_EDX + feat_names: + 0: kvm-hint-dedicated + # KVM hints aren't auto-enabled by -cpu host, they need to be explicitly + # enabled in the command-line. + no_autoenable_flags: ~0U + tcg_features: TCG_KVM_FEATURES + type: CPUID_FEATURE_WORD + +- index: FEAT_SVM + cpuid: + eax: '0x8000000A' + reg: R_EDX + feat_names: + 0: npt + 1: lbrv + 2: svm-lock + 3: nrip-save + 4: tsc-scale + 5: vmcb-clean + 6: flushbyasid + 7: decodeassists + 10: pause-filter + 12: pfthreshold + 13: avic + 15: v-vmsave-vmload + 16: vgif + 25: vnmi + 28: svme-addr-chk + tcg_features: TCG_SVM_FEATURES + type: CPUID_FEATURE_WORD + +- index: FEAT_7_0_EBX + cpuid: + eax: '7' + ecx: '0' + needs_ecx: 'true' + reg: R_EBX + feat_names: + 0: fsgsbase + 1: tsc-adjust + 2: sgx + 3: bmi1 + 4: hle + 5: avx2 + 7: smep + 8: bmi2 + 9: erms + 10: invpcid + 11: rtm + 14: mpx + 16: avx512f + 17: avx512dq + 18: rdseed + 19: adx + 20: smap + 21: avx512ifma + 22: pcommit + 23: clflushopt + 24: clwb + 25: intel-pt + 26: avx512pf + 27: avx512er + 28: avx512cd + 29: sha-ni + 30: avx512bw + 31: avx512vl + tcg_features: TCG_7_0_EBX_FEATURES + type: CPUID_FEATURE_WORD + +- index: FEAT_7_0_ECX + cpuid: + eax: '7' + ecx: '0' + needs_ecx: 'true' + reg: R_ECX + feat_names: + 1: avx512vbmi + 2: umip + 3: pku + # 4: ospke + 5: waitpkg + 6: avx512vbmi2 + 8: gfni + 9: vaes + 10: vpclmulqdq + 11: avx512vnni + 12: avx512bitalg + 14: avx512-vpopcntdq + 16: la57 + 22: rdpid + 24: bus-lock-detect + 25: cldemote + 27: movdiri + 28: movdir64b + 30: sgxlc + 31: pks + tcg_features: TCG_7_0_ECX_FEATURES + type: CPUID_FEATURE_WORD + +- index: FEAT_7_0_EDX + cpuid: + eax: '7' + ecx: '0' + needs_ecx: 'true' + reg: R_EDX + feat_names: + 2: avx512-4vnniw + 3: avx512-4fmaps + 4: fsrm + 8: avx512-vp2intersect + 10: md-clear + 14: serialize + 16: tsx-ldtrk + # 18: pconfig + 19: arch-lbr + 22: amx-bf16 + 23: avx512-fp16 + 24: amx-tile + 25: amx-int8 + 26: spec-ctrl + 27: stibp + 28: flush-l1d + 29: arch-capabilities + 30: core-capability + 31: ssbd + tcg_features: TCG_7_0_EDX_FEATURES + type: CPUID_FEATURE_WORD + +- index: FEAT_7_1_EAX + cpuid: + eax: '7' + ecx: '1' + needs_ecx: 'true' + reg: R_EAX + feat_names: + 4: avx-vnni + 5: avx512-bf16 + 7: cmpccxadd + 10: fzrm + 11: fsrs + 12: fsrc + 21: amx-fp16 + 23: avx-ifma + tcg_features: TCG_7_1_EAX_FEATURES + type: CPUID_FEATURE_WORD + +- index: FEAT_7_1_EDX + cpuid: + eax: '7' + ecx: '1' + needs_ecx: 'true' + reg: R_EDX + feat_names: + 4: avx-vnni-int8 + 5: avx-ne-convert + 8: amx-complex + 14: prefetchiti + tcg_features: TCG_7_1_EDX_FEATURES + type: CPUID_FEATURE_WORD + +- index: FEAT_7_2_EDX + cpuid: + eax: '7' + ecx: '2' + needs_ecx: 'true' + reg: R_EDX + feat_names: + 5: mcdt-no + tcg_features: TCG_7_2_EDX_FEATURES + type: CPUID_FEATURE_WORD + +- index: FEAT_8000_0007_EDX + cpuid: + eax: '0x80000007' + reg: R_EDX + feat_names: + 8: invtsc + tcg_features: TCG_APM_FEATURES + type: CPUID_FEATURE_WORD + unmigratable_flags: CPUID_APM_INVTSC + +- index: FEAT_8000_0008_EBX + cpuid: + eax: '0x80000008' + reg: R_EBX + feat_names: + 0: clzero + 2: xsaveerptr + 9: wbnoinvd + 12: ibpb + 14: ibrs + 15: amd-stibp + 17: stibp-always-on + 24: amd-ssbd + 25: virt-ssbd + 26: amd-no-ssb + 28: amd-psfd + tcg_features: TCG_8000_0008_EBX + type: CPUID_FEATURE_WORD + unmigratable_flags: '0' + +- index: FEAT_8000_0021_EAX + cpuid: + eax: '0x80000021' + reg: R_EAX + feat_names: + 0: no-nested-data-bp + 2: lfence-always-serializing + 6: null-sel-clr-base + 8: auto-ibrs + tcg_features: '0' + type: CPUID_FEATURE_WORD + unmigratable_flags: '0' + +- index: FEAT_XSAVE + cpuid: + eax: '0xd' + ecx: '1' + needs_ecx: 'true' + reg: R_EAX + feat_names: + 0: xsaveopt + 1: xsavec + 2: xgetbv1 + 3: xsaves + 4: xfd + tcg_features: TCG_XSAVE_FEATURES + type: CPUID_FEATURE_WORD + +- index: FEAT_XSAVE_XSS_LO + cpuid: + eax: '0xD' + ecx: '1' + needs_ecx: 'true' + reg: R_ECX + type: CPUID_FEATURE_WORD + +- index: FEAT_XSAVE_XSS_HI + cpuid: + eax: '0xD' + ecx: '1' + needs_ecx: 'true' + reg: R_EDX + type: CPUID_FEATURE_WORD + +- index: FEAT_6_EAX + cpuid: + eax: '6' + reg: R_EAX + feat_names: + 2: arat + tcg_features: TCG_6_EAX_FEATURES + type: CPUID_FEATURE_WORD + +- index: FEAT_XSAVE_XCR0_LO + cpuid: + eax: '0xD' + ecx: '0' + needs_ecx: 'true' + reg: R_EAX + 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 + tcg_features: ~0U + type: CPUID_FEATURE_WORD + +- index: FEAT_XSAVE_XCR0_HI + cpuid: + eax: '0xD' + ecx: '0' + needs_ecx: 'true' + reg: R_EDX + tcg_features: ~0U + type: CPUID_FEATURE_WORD + +- index: FEAT_ARCH_CAPABILITIES + msr: MSR_IA32_ARCH_CAPABILITIES + feat_names: + 0: rdctl-no + 1: ibrs-all + 2: rsba + 3: skip-l1dfl-vmentry + 4: ssb-no + 5: mds-no + 6: pschange-mc-no + 7: tsx-ctrl + 8: taa-no + 13: sbdr-ssdp-no + 14: fbsdp-no + 15: psdp-no + 17: fb-clear + 24: pbrsb-no + # 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 + type: MSR_FEATURE_WORD + +- index: FEAT_CORE_CAPABILITY + msr: MSR_IA32_CORE_CAPABILITY + feat_names: + 5: split-lock-detect + type: MSR_FEATURE_WORD + +- index: FEAT_PERF_CAPABILITIES + msr: MSR_IA32_PERF_CAPABILITIES + feat_names: + 13: full-width-write + type: MSR_FEATURE_WORD + +- index: FEAT_VMX_PROCBASED_CTLS + msr: MSR_IA32_VMX_TRUE_PROCBASED_CTLS + feat_names: + 2: vmx-vintr-pending + 3: vmx-tsc-offset + 7: vmx-hlt-exit + 9: vmx-invlpg-exit + 10: vmx-mwait-exit + 11: vmx-rdpmc-exit + 12: vmx-rdtsc-exit + 15: vmx-cr3-load-noexit + 16: vmx-cr3-store-noexit + 19: vmx-cr8-load-exit + 20: vmx-cr8-store-exit + 21: vmx-flexpriority + 22: vmx-vnmi-pending + 23: vmx-movdr-exit + 24: vmx-io-exit + 25: vmx-io-bitmap + 27: vmx-mtf + 28: vmx-msr-bitmap + 29: vmx-monitor-exit + 30: vmx-pause-exit + 31: vmx-secondary-ctls + type: MSR_FEATURE_WORD + +- index: FEAT_VMX_SECONDARY_CTLS + msr: MSR_IA32_VMX_PROCBASED_CTLS2 + feat_names: + 0: vmx-apicv-xapic + 1: vmx-ept + 2: vmx-desc-exit + 3: vmx-rdtscp-exit + 4: vmx-apicv-x2apic + 5: vmx-vpid + 6: vmx-wbinvd-exit + 7: vmx-unrestricted-guest + 8: vmx-apicv-register + 9: vmx-apicv-vid + 10: vmx-ple + 11: vmx-rdrand-exit + 12: vmx-invpcid-exit + 13: vmx-vmfunc + 14: vmx-shadow-vmcs + 15: vmx-encls-exit + 16: vmx-rdseed-exit + 17: vmx-pml + 20: vmx-xsaves + 25: vmx-tsc-scaling + 26: vmx-enable-user-wait-pause + type: MSR_FEATURE_WORD + +- index: FEAT_VMX_PINBASED_CTLS + msr: MSR_IA32_VMX_TRUE_PINBASED_CTLS + feat_names: + 0: vmx-intr-exit + 3: vmx-nmi-exit + 5: vmx-vnmi + 6: vmx-preemption-timer + 7: vmx-posted-intr + type: MSR_FEATURE_WORD + +- index: FEAT_VMX_EXIT_CTLS + msr: MSR_IA32_VMX_TRUE_EXIT_CTLS + feat_names: + 2: vmx-exit-nosave-debugctl + #9: VMX_VM_EXIT_HOST_ADDR_SPACE_SIZE is copied from the LM CPUID bit. + 12: vmx-exit-load-perf-global-ctrl + 15: vmx-exit-ack-intr + 18: vmx-exit-save-pat + 19: vmx-exit-load-pat + 20: vmx-exit-save-efer + 21: vmx-exit-load-efer + 22: vmx-exit-save-preemption-timer + 23: vmx-exit-clear-bndcfgs + 25: vmx-exit-clear-rtit-ctl + 29: vmx-exit-load-pkrs + type: MSR_FEATURE_WORD + +- index: FEAT_VMX_ENTRY_CTLS + msr: MSR_IA32_VMX_TRUE_ENTRY_CTLS + feat_names: + 2: vmx-entry-noload-debugctl + 9: vmx-entry-ia32e-mode + 13: vmx-entry-load-perf-global-ctrl + 14: vmx-entry-load-pat + 15: vmx-entry-load-efer + 16: vmx-entry-load-bndcfgs + 18: vmx-entry-load-rtit-ctl + 22: vmx-entry-load-pkrs + type: MSR_FEATURE_WORD + +- index: FEAT_VMX_MISC + msr: MSR_IA32_VMX_MISC + feat_names: + 5: vmx-store-lma + 6: vmx-activity-hlt + 7: vmx-activity-shutdown + 8: vmx-activity-wait-sipi + 29: vmx-vmwrite-vmexit-fields + 30: vmx-zero-len-inject + type: MSR_FEATURE_WORD + +- index: FEAT_VMX_EPT_VPID_CAPS + msr: MSR_IA32_VMX_EPT_VPID_CAP + feat_names: + 0: vmx-ept-execonly + 6: vmx-page-walk-4 + 7: vmx-page-walk-5 + 8: vmx-ept-uc + 14: vmx-ept-wb + 16: vmx-ept-2mb + 17: vmx-ept-1gb + 20: vmx-invept + 21: vmx-eptad + 22: vmx-ept-advanced-exitinfo + 25: vmx-invept-single-context + 26: vmx-invept-all-context + 32: vmx-invvpid + 40: vmx-invvpid-single-addr + 41: vmx-invvpid-single-context + 42: vmx-invvpid-all-context + 43: vmx-invvpid-single-context-noglobals + type: MSR_FEATURE_WORD + +- index: FEAT_VMX_BASIC + msr: MSR_IA32_VMX_BASIC + feat_names: + 54: vmx-ins-outs + 55: vmx-true-ctls + # Just to be safe - we don't support setting the MSEG version field. + no_autoenable_flags: MSR_VMX_BASIC_DUAL_MONITOR + type: MSR_FEATURE_WORD + +- index: FEAT_VMX_VMFUNC + msr: MSR_IA32_VMX_VMFUNC + feat_names: + 0: vmx-eptp-switching + type: MSR_FEATURE_WORD + +- index: FEAT_14_0_ECX + cpuid: + eax: '0x14' + ecx: '0' + needs_ecx: 'true' + reg: R_ECX + feat_names: + 31: intel-pt-lip + tcg_features: TCG_14_0_ECX_FEATURES + type: CPUID_FEATURE_WORD + +- index: FEAT_SGX_12_0_EAX + cpuid: + eax: '0x12' + ecx: '0' + needs_ecx: 'true' + reg: R_EAX + feat_names: + 0: sgx1 + 1: sgx2 + 11: sgx-edeccssa + tcg_features: TCG_SGX_12_0_EAX_FEATURES + type: CPUID_FEATURE_WORD + +- index: FEAT_SGX_12_0_EBX + cpuid: + eax: '0x12' + ecx: '0' + needs_ecx: 'true' + reg: R_EBX + feat_names: + 0: sgx-exinfo + tcg_features: TCG_SGX_12_0_EBX_FEATURES + type: CPUID_FEATURE_WORD + +- index: FEAT_SGX_12_1_EAX + cpuid: + eax: '0x12' + ecx: '1' + needs_ecx: 'true' + reg: R_EAX + feat_names: + 1: sgx-debug + 2: sgx-mode64 + 4: sgx-provisionkey + 5: sgx-tokenkey + 7: sgx-kss + 10: sgx-aex-notify + tcg_features: TCG_SGX_12_1_EAX_FEATURES + type: CPUID_FEATURE_WORD
Signature · 1 line
2.39.2
PATCH v2 6/10 target/i386: Format feature_word_info.c.inc: Remove comments
In reply to Tim WiederhakeThe comments are preserved in the yaml file.
--- target/i386/feature_word_info.c.inc | 56 ++++++++--------------------- 1 file changed, 15 insertions(+), 41 deletions(-)
target/i386/feature_word_info.c.inc +15 -41
@@ -6,10 +6,10 @@ 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, }, .tcg_features = TCG_FEATURES,
@@ -17,33 +17,28 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { [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, }, .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, },
@@ -63,11 +58,6 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { }, .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] = {
@@ -114,10 +104,6 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { }, .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] = {
@@ -158,7 +144,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,
@@ -180,7 +166,7 @@ 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",
@@ -381,7 +367,6 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { }, .tcg_features = ~0U, }, - /*Below are MSR exposed features*/ [FEAT_ARCH_CAPABILITIES] = { .type = MSR_FEATURE_WORD, .feat_names = {
@@ -397,12 +382,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] = {
@@ -491,14 +470,10 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { [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",
@@ -580,7 +555,6 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { .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, },
Signature · 1 line
2.39.2
PATCH v2 7/10 target/i386: Format feature_word_info.c.inc: Fill out feat_names
In reply to Tim WiederhakeThis member is an array of length 64. Initializing all entries in this array allows for some simplification in the generating code.
--- target/i386/feature_word_info.c.inc | 355 +++++++++++++++++++++++++++- 1 file changed, 351 insertions(+), 4 deletions(-)
target/i386/feature_word_info.c.inc +351 -4
@@ -10,6 +10,14 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { NULL, "ds", "acpi", "mmx", "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", "pbe", + 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 = 1, .reg = R_EDX, }, .tcg_features = TCG_FEATURES,
@@ -25,6 +33,14 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { "sse4.2", "x2apic", "movbe", "popcnt", "tsc-deadline", "aes", "xsave", NULL, "avx", "f16c", "rdrand", "hypervisor", + 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 = 1, .reg = R_ECX, }, .tcg_features = TCG_EXT_FEATURES,
@@ -40,6 +56,14 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { "nx", NULL, "mmxext", NULL, NULL, "fxsr-opt", "pdpe1gb", "rdtscp", NULL, "lm", "3dnowext", "3dnow", + 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 = 0x80000001, .reg = R_EDX, }, .tcg_features = TCG_EXT2_FEATURES,
@@ -55,6 +79,14 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { NULL, "tbm", "topoext", "perfctr-core", "perfctr-nb", 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, }, .cpuid = { .eax = 0x80000001, .reg = R_ECX, }, .tcg_features = TCG_EXT3_FEATURES,
@@ -71,6 +103,14 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { 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, }, .cpuid = { .eax = 0xC0000001, .reg = R_EDX, }, .tcg_features = TCG_EXT4_FEATURES,
@@ -86,6 +126,14 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { NULL, NULL, NULL, NULL, "kvmclock-stable-bit", 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, }, .cpuid = { .eax = KVM_CPUID_FEATURES, .reg = R_EAX, }, .tcg_features = TCG_KVM_FEATURES,
@@ -101,6 +149,14 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { 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, }, .cpuid = { .eax = KVM_CPUID_FEATURES, .reg = R_EDX, }, .tcg_features = TCG_KVM_FEATURES,
@@ -117,6 +173,14 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { NULL, NULL, NULL, NULL, NULL, "vnmi", NULL, NULL, "svme-addr-chk", 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, }, .cpuid = { .eax = 0x8000000A, .reg = R_EDX, }, .tcg_features = TCG_SVM_FEATURES,
@@ -132,6 +196,14 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { "smap", "avx512ifma", "pcommit", "clflushopt", "clwb", "intel-pt", "avx512pf", "avx512er", "avx512cd", "sha-ni", "avx512bw", "avx512vl", + 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 = 7,
@@ -151,6 +223,14 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { NULL, NULL, "rdpid", NULL, "bus-lock-detect", "cldemote", NULL, "movdiri", "movdir64b", NULL, "sgxlc", "pks", + 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 = 7,
@@ -170,6 +250,14 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { NULL, NULL, "amx-bf16", "avx512-fp16", "amx-tile", "amx-int8", "spec-ctrl", "stibp", "flush-l1d", "arch-capabilities", "core-capability", "ssbd", + 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 = 7,
@@ -189,6 +277,14 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { NULL, "amx-fp16", NULL, "avx-ifma", 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, }, .cpuid = { .eax = 7,
@@ -208,6 +304,14 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { 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, }, .cpuid = { .eax = 7,
@@ -227,6 +331,14 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { 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, }, .cpuid = { .eax = 7,
@@ -246,6 +358,14 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { 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, }, .cpuid = { .eax = 0x80000007, .reg = R_EDX, }, .tcg_features = TCG_APM_FEATURES,
@@ -262,6 +382,14 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { NULL, NULL, NULL, NULL, "amd-ssbd", "virt-ssbd", "amd-no-ssb", NULL, "amd-psfd", 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, }, .cpuid = { .eax = 0x80000008, .reg = R_EBX, }, .tcg_features = TCG_8000_0008_EBX,
@@ -278,6 +406,14 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { 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, }, .cpuid = { .eax = 0x80000021, .reg = R_EAX, }, .tcg_features = 0,
@@ -294,6 +430,14 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { 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, }, .cpuid = { .eax = 0xd,
@@ -313,6 +457,14 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { 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, }, .cpuid = { .eax = 0xD,
@@ -323,6 +475,24 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { }, [FEAT_XSAVE_XSS_HI] = { .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, + 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,
@@ -341,12 +511,38 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { 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, }, .cpuid = { .eax = 6, .reg = R_EAX, }, .tcg_features = TCG_6_EAX_FEATURES, }, [FEAT_XSAVE_XCR0_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, + 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 = 0,
@@ -360,6 +556,24 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { }, [FEAT_XSAVE_XCR0_HI] = { .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, + 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 = 0,
@@ -378,6 +592,14 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { NULL, NULL, NULL, NULL, "pbrsb-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, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, }, .msr = { .index = MSR_IA32_ARCH_CAPABILITIES,
@@ -395,6 +617,14 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { 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, }, .msr = { .index = MSR_IA32_CORE_CAPABILITY,
@@ -411,6 +641,14 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { 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, }, .msr = { .index = MSR_IA32_PERF_CAPABILITIES,
@@ -428,6 +666,14 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { "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", + 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, }, .msr = { .index = MSR_IA32_VMX_TRUE_PROCBASED_CTLS,
@@ -445,6 +691,14 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { "vmx-xsaves", NULL, NULL, NULL, NULL, "vmx-tsc-scaling", "vmx-enable-user-wait-pause", 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, }, .msr = { .index = MSR_IA32_VMX_PROCBASED_CTLS2,
@@ -462,6 +716,14 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { 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, }, .msr = { .index = MSR_IA32_VMX_TRUE_PINBASED_CTLS,
@@ -480,6 +742,14 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { "vmx-exit-save-preemption-timer", "vmx-exit-clear-bndcfgs", NULL, "vmx-exit-clear-rtit-ctl", NULL, NULL, NULL, "vmx-exit-load-pkrs", 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, }, .msr = { .index = MSR_IA32_VMX_TRUE_EXIT_CTLS,
@@ -497,6 +767,14 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { NULL, NULL, "vmx-entry-load-pkrs", 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, }, .msr = { .index = MSR_IA32_VMX_TRUE_ENTRY_CTLS,
@@ -514,6 +792,14 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "vmx-vmwrite-vmexit-fields", "vmx-zero-len-inject", 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, }, .msr = { .index = MSR_IA32_VMX_MISC,
@@ -549,8 +835,22 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { [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,
@@ -561,7 +861,22 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { [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, + 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, }, .msr = { .index = MSR_IA32_VMX_VMFUNC,
@@ -579,6 +894,14 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "intel-pt-lip", + 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 = 0x14,
@@ -599,6 +922,14 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { 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, }, .cpuid = { .eax = 0x12,
@@ -611,7 +942,15 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { [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, + 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,
@@ -639,6 +978,14 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { 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, }, .cpuid = { .eax = 0x12,
Signature · 1 line
2.39.2
PATCH v2 8/10 target/i386: Format feature_word_info.c.inc: Unfold cpuid member
In reply to Tim WiederhakeHaving a consistent formatting minimizes the diff to the generated code.
--- target/i386/feature_word_info.c.inc | 101 +++++++++++++++++++++------- 1 file changed, 75 insertions(+), 26 deletions(-)
target/i386/feature_word_info.c.inc +75 -26
@@ -19,7 +19,10 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, }, - .cpuid = {.eax = 1, .reg = R_EDX, }, + .cpuid = { + .eax = 1, + .reg = R_EDX, + }, .tcg_features = TCG_FEATURES, }, [FEAT_1_ECX] = {
@@ -42,7 +45,10 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, }, - .cpuid = { .eax = 1, .reg = R_ECX, }, + .cpuid = { + .eax = 1, + .reg = R_ECX, + }, .tcg_features = TCG_EXT_FEATURES, }, [FEAT_8000_0001_EDX] = {
@@ -65,7 +71,10 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, }, - .cpuid = { .eax = 0x80000001, .reg = R_EDX, }, + .cpuid = { + .eax = 0x80000001, + .reg = R_EDX, + }, .tcg_features = TCG_EXT2_FEATURES, }, [FEAT_8000_0001_ECX] = {
@@ -88,7 +97,10 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, }, - .cpuid = { .eax = 0x80000001, .reg = R_ECX, }, + .cpuid = { + .eax = 0x80000001, + .reg = R_ECX, + }, .tcg_features = TCG_EXT3_FEATURES, .no_autoenable_flags = CPUID_EXT3_TOPOEXT, },
@@ -112,7 +124,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] = {
@@ -135,7 +150,10 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { NULL, 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] = {
@@ -158,7 +176,10 @@ 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, .no_autoenable_flags = ~0U, },
@@ -182,7 +203,10 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, }, - .cpuid = { .eax = 0x8000000A, .reg = R_EDX, }, + .cpuid = { + .eax = 0x8000000A, + .reg = R_EDX, + }, .tcg_features = TCG_SVM_FEATURES, }, [FEAT_7_0_EBX] = {
@@ -207,7 +231,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,
@@ -234,7 +259,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,
@@ -261,7 +287,8 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { }, .cpuid = { .eax = 7, - .needs_ecx = true, .ecx = 0, + .needs_ecx = true, + .ecx = 0, .reg = R_EDX, }, .tcg_features = TCG_7_0_EDX_FEATURES,
@@ -288,7 +315,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,
@@ -315,7 +343,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,
@@ -342,7 +371,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,
@@ -367,7 +397,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, },
@@ -391,7 +424,10 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, }, - .cpuid = { .eax = 0x80000008, .reg = R_EBX, }, + .cpuid = { + .eax = 0x80000008, + .reg = R_EBX, + }, .tcg_features = TCG_8000_0008_EBX, .unmigratable_flags = 0, },
@@ -415,7 +451,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, },
@@ -441,7 +480,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,
@@ -497,7 +537,7 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { .eax = 0xD, .needs_ecx = true, .ecx = 1, - .reg = R_EDX + .reg = R_EDX, }, }, [FEAT_6_EAX] = {
@@ -520,7 +560,10 @@ 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] = {
@@ -545,7 +588,8 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { }, .cpuid = { .eax = 0xD, - .needs_ecx = true, .ecx = 0, + .needs_ecx = true, + .ecx = 0, .reg = R_EAX, }, .tcg_features = ~0U,
@@ -576,7 +620,8 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { }, .cpuid = { .eax = 0xD, - .needs_ecx = true, .ecx = 0, + .needs_ecx = true, + .ecx = 0, .reg = R_EDX, }, .tcg_features = ~0U,
@@ -905,7 +950,8 @@ 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,
@@ -933,7 +979,8 @@ 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,
@@ -961,7 +1008,8 @@ 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,
@@ -989,7 +1037,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,
Signature · 1 line
2.39.2
PATCH v2 9/10 target/i386: Format feature_word_info.c.inc: Whitespaces and trailing commas
In reply to Tim WiederhakeHaving a consistent formatting minimizes the diff to the generated code.
--- target/i386/feature_word_info.c.inc | 44 +++++++++-------------------- 1 file changed, 13 insertions(+), 31 deletions(-)
target/i386/feature_word_info.c.inc +13 -31
@@ -187,7 +187,7 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { .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,
@@ -593,10 +593,7 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { .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,
@@ -699,7 +696,6 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { .index = MSR_IA32_PERF_CAPABILITIES, }, }, - [FEAT_VMX_PROCBASED_CTLS] = { .type = MSR_FEATURE_WORD, .feat_names = {
@@ -722,9 +718,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 = {
@@ -747,9 +742,8 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { }, .msr = { .index = MSR_IA32_VMX_PROCBASED_CTLS2, - } + }, }, - [FEAT_VMX_PINBASED_CTLS] = { .type = MSR_FEATURE_WORD, .feat_names = {
@@ -772,9 +766,8 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { }, .msr = { .index = MSR_IA32_VMX_TRUE_PINBASED_CTLS, - } + }, }, - [FEAT_VMX_EXIT_CTLS] = { .type = MSR_FEATURE_WORD, .feat_names = {
@@ -783,8 +776,7 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { 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, NULL, NULL, NULL, NULL,
@@ -798,9 +790,8 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { }, .msr = { .index = MSR_IA32_VMX_TRUE_EXIT_CTLS, - } + }, }, - [FEAT_VMX_ENTRY_CTLS] = { .type = MSR_FEATURE_WORD, .feat_names = {
@@ -823,9 +814,8 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { }, .msr = { .index = MSR_IA32_VMX_TRUE_ENTRY_CTLS, - } + }, }, - [FEAT_VMX_MISC] = { .type = MSR_FEATURE_WORD, .feat_names = {
@@ -848,9 +838,8 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { }, .msr = { .index = MSR_IA32_VMX_MISC, - } + }, }, - [FEAT_VMX_EPT_VPID_CAPS] = { .type = MSR_FEATURE_WORD, .feat_names = {
@@ -864,8 +853,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-invvpid-single-context", - "vmx-invvpid-all-context", "vmx-invvpid-single-context-noglobals", + "vmx-invvpid-single-addr", "vmx-invvpid-single-context", "vmx-invvpid-all-context", "vmx-invvpid-single-context-noglobals", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -874,9 +862,8 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { }, .msr = { .index = MSR_IA32_VMX_EPT_VPID_CAP, - } + }, }, - [FEAT_VMX_BASIC] = { .type = MSR_FEATURE_WORD, .feat_names = {
@@ -902,7 +889,6 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { }, .no_autoenable_flags = MSR_VMX_BASIC_DUAL_MONITOR, }, - [FEAT_VMX_VMFUNC] = { .type = MSR_FEATURE_WORD, .feat_names = {
@@ -925,9 +911,8 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { }, .msr = { .index = MSR_IA32_VMX_VMFUNC, - } + }, }, - [FEAT_14_0_ECX] = { .type = CPUID_FEATURE_WORD, .feat_names = {
@@ -955,8 +940,7 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { .reg = R_ECX, }, .tcg_features = TCG_14_0_ECX_FEATURES, - }, - + }, [FEAT_SGX_12_0_EAX] = { .type = CPUID_FEATURE_WORD, .feat_names = {
@@ -985,7 +969,6 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { }, .tcg_features = TCG_SGX_12_0_EAX_FEATURES, }, - [FEAT_SGX_12_0_EBX] = { .type = CPUID_FEATURE_WORD, .feat_names = {
@@ -1014,7 +997,6 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { }, .tcg_features = TCG_SGX_12_0_EBX_FEATURES, }, - [FEAT_SGX_12_1_EAX] = { .type = CPUID_FEATURE_WORD, .feat_names = {
Signature · 1 line
2.39.2
PATCH v2 10/10 target/i386: Autogenerate feature_word_info.c.inc
In reply to Tim WiederhakeThis introduces no semantic changes to the file.
--- target/i386/feature_word_info.c.inc | 2 + target/i386/feature_word_info.py | 62 +++++++++++++++++++++++++++++ target/i386/feature_word_info.yaml | 2 + 3 files changed, 66 insertions(+) create mode 100755 target/i386/feature_word_info.py
target/i386/feature_word_info.c.inc +2 -0
@@ -1,3 +1,5 @@ +/* This file is generated by feature_word_info.py. */ + FeatureWordInfo feature_word_info[FEATURE_WORDS] = { [FEAT_1_EDX] = { .type = CPUID_FEATURE_WORD,
target/i386/feature_word_info.py new file +62 -0
62 lines not on this page · raw message
target/i386/feature_word_info.yaml +2 -0
@@ -1,3 +1,5 @@ +# Run `feature_word_info.py` when you make changes to this file. + - index: FEAT_1_EDX cpuid: eax: '1'
Signature · 1 line
2.39.2
Re: [PATCH v2 10/10] target/i386: Autogenerate feature_word_info.c.inc
target/i386/feature_word_info.yaml line 1
Quoted 3 lines · Tim Wiederhake
+++
b/target/i386/feature_word_info.yamltarget/i386/feature_word_info.yaml +1
-0@@ -1,3 +1,5 @@ +# Run `feature_word_info.py` when you make changes to this file.
You should integrate this into the build process instead.
r~
Quoted 4 lines · On Fri, 8 Sep 2023 14:45:24 +0200 Tim Wiederhake <[email protected]> wrote:
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.cfor cpu models.
modulo fixing typos/name conflicts in 1st 3 patches,
I don't think it's a great idea for libvirt (or any other user) to parse QEMU source (whether it's C code or yaml) or other way around for users to influence QEMU internals.
QEMU does provides QMP interface for introspection of CPU models and it should be used as a mean to discover new CPU models as well as new feature names. If something is missing there we should fix it up to make it usable for libvirt.
Quoted 5 lines
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.
Quoted 7 lines
This patch series converts the cpu feature information present in
target/i386/cpu.c(feature_word_info) into a yaml file and adds a script to generate the c code from this data.A patch set to convert the cpu model data (
builtin_x86_defs) in the same way will follow.
while theoretically you can parse feature_word_info with some sort of reliability, you can't do that reliably with CPU model definitions in builtin_x86_defs as the later is just a skeleton. Actual CPU models definitions are
a function of used machine type, accelerator and host kernel.
Quoted 37 lines
v1: https://lists.nongnu.org/archive/html/qemu-devel/2023-08/msg02005.html
Changes since v1:
* Incorporated changes from
https://lists.nongnu.org/archive/html/qemu-devel/2023-08/msg04241.html.
* Changed data format from xml to yaml, as proposed in
https://lists.nongnu.org/archive/html/qemu-devel/2023-09/msg01033.html.
Using json has some drawbacks, see
https://lists.nongnu.org/archive/html/qemu-devel/2023-08/msg03384.html.
* Rebased on top of current master. Features added in the meantime:
amx-complex and vmx-enable-user-wait-pause
* Split up the reformatting of feature_word_info.c.inc to make it easier to review. These patches could be squashed together before merging.Tim Wiederhake (10):
target/i386: Add missing feature names inFEAT_VMX_EPT_VPID_CAPStarget/i386: Fix feature names inFEAT_VMX_EPT_VPID_CAPStarget/i386: Fix duplicated feature name inFEAT_KVMtarget/i386: Split outfeature_word_info
target/i386: Translatefeature_word_infoto yaml target/i386: Format feature_word_info.c.inc: Remove comments target/i386: Format feature_word_info.c.inc:feat_namestarget/i386: Format feature_word_info.c.inc: Unfold cpuid member target/i386: Format feature_word_info.c.inc: Whitespaces and trailing
commas
target/i386: Autogenerate feature_word_info.c.inctarget/i386/cpu.c | 677 +----------------- target/i386/feature_word_info.c.inc | 1030 +++++++++++++++++++++++++++ target/i386/feature_word_info.py | 62 ++ target/i386/feature_word_info.yaml | 697 ++++++++++++++++++ 4 files changed, 1790 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.yaml
Quoted 8 lines · Igor Mammedov
Quoted 4 lines · On Fri, 8 Sep 2023 14:45:24 +0200 Tim Wiederhake <[email protected]> wrote:
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.cfor cpu models.
Quoted 5 lines
modulo fixing typos/name conflicts in 1st 3 patches,
I don't think it's a great idea for libvirt (or any other user) to parse QEMU source (whether it's C code or yaml) or other way around for users to influence QEMU internals.
NB It isn't for libvirt to parse at runtime, rather it is for libvirt maintainers to consume during dev, so libvirt keeps in sync with QEMU features.
With regards,
Daniel
Signature · 3 lines
|: 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 :|
Quoted 11 lines · On Fri, 8 Sep 2023 17:55:12 +0100 Daniel P. Berrangé <[email protected]>…
Quoted 10 lines · Igor Mammedov
Quoted 4 lines · On Fri, 8 Sep 2023 14:45:24 +0200 Tim Wiederhake <[email protected]> wrote:
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.cfor cpu models.modulo fixing typos/name conflicts in 1st 3 patches,
Quoted 7 lines
Quoted 3 lines
I don't think it's a great idea for libvirt (or any other user) to parse QEMU source (whether it's C code or yaml) or other way around for users to influence QEMU internals.
NB It isn't for libvirt to parse at runtime, rather it is for libvirt maintainers to consume during dev, so libvirt keeps in sync with QEMU features.
As QEMU dev, I'm not fond of code generators as sometimes they make difficult for me to read, and on to of that inventing new 'language' to describe features that works on some cases only (not everything is described in feature array, and for non x86 properties mostly coded in initfn/realizefn).
(I'd dislike it less if it were part of QMP schema as it gets us closer to processing '-device' with QMP machinery).
why not use existing QMP interface there as well (or alter it if it's not sufficient)?
Quoted 4 lines
With regards,
Daniel
Quoted 38 lines · Igor Mammedov
Quoted 21 lines · On Fri, 8 Sep 2023 17:55:12 +0100 Daniel P. Berrangé <[email protected]>…
Quoted 12 lines · Igor Mammedov
On Fri, 8 Sep 2023 14:45:24 +0200
Tim Wiederhake <[email protected]> wrote:Quoted 8 lines
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 parsingtarget/i386/cpu.cfor cpu models.Quoted 7 lines
modulo fixing typos/name conflicts in 1st 3 patches,
I don't think it's a great idea for libvirt (or any other user) to parse
QEMU source (whether it's C code or yaml) or other way around for users
to influence QEMU internals.Quoted 5 lines
NB It isn't for libvirt to parse at runtime, rather it is for libvirt
maintainers to consume during dev, so libvirt keeps in sync with QEMU
features.As QEMU dev, I'm not fond of code generators as sometimes they make difficult for me to read, and on to of that inventing new 'language' to describe features that works on some cases only (not everything is described in feature array, and for non x86 properties mostly coded in initfn/realizefn).
(I'd dislike it less if it were part of QMP schema as it gets us closer to processing '-device' with QMP machinery).
Quoted 4 lines
why not use existing QMP interface there as well (or alter it if it's not sufficient)?
I understand your concern regarding the legibility of generated code. If you have a look at patches 6 - 9, you will see that the only changes introduced are white space changes, harmonizing the usage of trailing commas, breaking lines, and filling the "feat_names" field fully. That, if anything, makes the code more readable in my opinion.
The format of the yaml file is chosen to mimic struct FeatureWordInfo as closely as possible, it is effectively a 1:1 mapping.
Regarding using the QMP interface: That is what libvirt is currently doing, see [1] if you are interested. The problem with that approach is that the response to
{
"execute": "qom-list-properties",
"arguments": { "typename": "max-x86_64-cpu"}
}does not distinguish between cpu features and other information about that cpu model, thus forcing libvirt to maintain a list of non- features. Examples of such items are "check", "enforce", "start- powered-off", or "migratable".
Additionally, the response does not include information about the cpuid leaf, register and bit, or msr register respectively. This has to be supplemented manually.
If there is a way to query for this information that I am not aware of, please let me know.
Ultimately I would love to see libvirt stop querying qemu for x86 cpu feature information but instead have both qemu and libvirt query a common source / database for this kind of information, for all architectures, not only x86.
Regards,
Tim
[1]
https://gitlab.com/libvirt/libvirt/-/blob/master/src/cpu_map/sync_qemu_features_i386.py