CPUID instruction normally takes its parameter from EAX, but sometimes ECX is used as an additional parameter. Let's rename 'function' to 'eax_in' in preparation for adding 'ecx_in'. Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx> --- src/cpu/cpu_map.xml | 224 ++++++++++----------- src/cpu/cpu_x86.c | 86 ++++---- src/cpu/cpu_x86_data.h | 2 +- src/qemu/qemu_monitor_json.c | 6 +- .../qemumonitorjson-getcpu-full.data | 6 +- .../qemumonitorjson-getcpu-host.data | 8 +- 6 files changed, 167 insertions(+), 165 deletions(-) diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml index 08aded2..1ddc55f 100644 --- a/src/cpu/cpu_map.xml +++ b/src/cpu/cpu_map.xml @@ -6,351 +6,351 @@ <!-- standard features, EDX --> <feature name='fpu'> <!-- CPUID_FP87 --> - <cpuid function='0x00000001' edx='0x00000001'/> + <cpuid eax_in='0x00000001' edx='0x00000001'/> </feature> <feature name='vme'> <!-- CPUID_VME --> - <cpuid function='0x00000001' edx='0x00000002'/> + <cpuid eax_in='0x00000001' edx='0x00000002'/> </feature> <feature name='de'> <!-- CPUID_DE --> - <cpuid function='0x00000001' edx='0x00000004'/> + <cpuid eax_in='0x00000001' edx='0x00000004'/> </feature> <feature name='pse'> <!-- CPUID_PSE --> - <cpuid function='0x00000001' edx='0x00000008'/> + <cpuid eax_in='0x00000001' edx='0x00000008'/> </feature> <feature name='tsc'> <!-- CPUID_TSC --> - <cpuid function='0x00000001' edx='0x00000010'/> + <cpuid eax_in='0x00000001' edx='0x00000010'/> </feature> <feature name='msr'> <!-- CPUID_MSR --> - <cpuid function='0x00000001' edx='0x00000020'/> + <cpuid eax_in='0x00000001' edx='0x00000020'/> </feature> <feature name='pae'> <!-- CPUID_PAE --> - <cpuid function='0x00000001' edx='0x00000040'/> + <cpuid eax_in='0x00000001' edx='0x00000040'/> </feature> <feature name='mce'> <!-- CPUID_MCE --> - <cpuid function='0x00000001' edx='0x00000080'/> + <cpuid eax_in='0x00000001' edx='0x00000080'/> </feature> <feature name='cx8'> <!-- CPUID_CX8 --> - <cpuid function='0x00000001' edx='0x00000100'/> + <cpuid eax_in='0x00000001' edx='0x00000100'/> </feature> <feature name='apic'> <!-- CPUID_APIC --> - <cpuid function='0x00000001' edx='0x00000200'/> + <cpuid eax_in='0x00000001' edx='0x00000200'/> </feature> <feature name='sep'> <!-- CPUID_SEP --> - <cpuid function='0x00000001' edx='0x00000800'/> + <cpuid eax_in='0x00000001' edx='0x00000800'/> </feature> <feature name='mtrr'> <!-- CPUID_MTRR --> - <cpuid function='0x00000001' edx='0x00001000'/> + <cpuid eax_in='0x00000001' edx='0x00001000'/> </feature> <feature name='pge'> <!-- CPUID_PGE --> - <cpuid function='0x00000001' edx='0x00002000'/> + <cpuid eax_in='0x00000001' edx='0x00002000'/> </feature> <feature name='mca'> <!-- CPUID_MCA --> - <cpuid function='0x00000001' edx='0x00004000'/> + <cpuid eax_in='0x00000001' edx='0x00004000'/> </feature> <feature name='cmov'> <!-- CPUID_CMOV --> - <cpuid function='0x00000001' edx='0x00008000'/> + <cpuid eax_in='0x00000001' edx='0x00008000'/> </feature> <feature name='pat'> <!-- CPUID_PAT --> - <cpuid function='0x00000001' edx='0x00010000'/> + <cpuid eax_in='0x00000001' edx='0x00010000'/> </feature> <feature name='pse36'> <!-- CPUID_PSE36 --> - <cpuid function='0x00000001' edx='0x00020000'/> + <cpuid eax_in='0x00000001' edx='0x00020000'/> </feature> <feature name='pn'> <!-- CPUID_PN --> - <cpuid function='0x00000001' edx='0x00040000'/> + <cpuid eax_in='0x00000001' edx='0x00040000'/> </feature> <feature name='clflush'> <!-- CPUID_CLFLUSH --> - <cpuid function='0x00000001' edx='0x00080000'/> + <cpuid eax_in='0x00000001' edx='0x00080000'/> </feature> <feature name='ds'> <!-- CPUID_DTS --> - <cpuid function='0x00000001' edx='0x00200000'/> + <cpuid eax_in='0x00000001' edx='0x00200000'/> </feature> <feature name='acpi'> <!-- CPUID_ACPI --> - <cpuid function='0x00000001' edx='0x00400000'/> + <cpuid eax_in='0x00000001' edx='0x00400000'/> </feature> <feature name='mmx'> <!-- CPUID_MMX --> - <cpuid function='0x00000001' edx='0x00800000'/> + <cpuid eax_in='0x00000001' edx='0x00800000'/> </feature> <feature name='fxsr'> <!-- CPUID_FXSR --> - <cpuid function='0x00000001' edx='0x01000000'/> + <cpuid eax_in='0x00000001' edx='0x01000000'/> </feature> <feature name='sse'> <!-- CPUID_SSE --> - <cpuid function='0x00000001' edx='0x02000000'/> + <cpuid eax_in='0x00000001' edx='0x02000000'/> </feature> <feature name='sse2'> <!-- CPUID_SSE2 --> - <cpuid function='0x00000001' edx='0x04000000'/> + <cpuid eax_in='0x00000001' edx='0x04000000'/> </feature> <feature name='ss'> <!-- CPUID_SS --> - <cpuid function='0x00000001' edx='0x08000000'/> + <cpuid eax_in='0x00000001' edx='0x08000000'/> </feature> <feature name='ht'> <!-- CPUID_HT --> - <cpuid function='0x00000001' edx='0x10000000'/> + <cpuid eax_in='0x00000001' edx='0x10000000'/> </feature> <feature name='tm'> <!-- CPUID_TM --> - <cpuid function='0x00000001' edx='0x20000000'/> + <cpuid eax_in='0x00000001' edx='0x20000000'/> </feature> <feature name='ia64'> <!-- CPUID_IA64 --> - <cpuid function='0x00000001' edx='0x40000000'/> + <cpuid eax_in='0x00000001' edx='0x40000000'/> </feature> <feature name='pbe'> <!-- CPUID_PBE --> - <cpuid function='0x00000001' edx='0x80000000'/> + <cpuid eax_in='0x00000001' edx='0x80000000'/> </feature> <!-- standard features, ECX --> <feature name='pni'> <!-- CPUID_EXT_SSE3 --> - <cpuid function='0x00000001' ecx='0x00000001'/> + <cpuid eax_in='0x00000001' ecx='0x00000001'/> </feature> <feature name='pclmuldq'> - <cpuid function='0x00000001' ecx='0x00000002'/> + <cpuid eax_in='0x00000001' ecx='0x00000002'/> </feature> <feature name='dtes64'> - <cpuid function='0x00000001' ecx='0x00000004'/> + <cpuid eax_in='0x00000001' ecx='0x00000004'/> </feature> <feature name='monitor'> <!-- CPUID_EXT_MONITOR --> - <cpuid function='0x00000001' ecx='0x00000008'/> + <cpuid eax_in='0x00000001' ecx='0x00000008'/> </feature> <feature name='ds_cpl'> <!-- CPUID_EXT_DSCPL --> - <cpuid function='0x00000001' ecx='0x00000010'/> + <cpuid eax_in='0x00000001' ecx='0x00000010'/> </feature> <feature name='vmx'> <!-- CPUID_EXT_VMX --> - <cpuid function='0x00000001' ecx='0x00000020'/> + <cpuid eax_in='0x00000001' ecx='0x00000020'/> </feature> <feature name='smx'> - <cpuid function='0x00000001' ecx='0x00000040'/> + <cpuid eax_in='0x00000001' ecx='0x00000040'/> </feature> <feature name='est'> <!-- CPUID_EXT_EST --> - <cpuid function='0x00000001' ecx='0x00000080'/> + <cpuid eax_in='0x00000001' ecx='0x00000080'/> </feature> <feature name='tm2'> <!-- CPUID_EXT_TM2 --> - <cpuid function='0x00000001' ecx='0x00000100'/> + <cpuid eax_in='0x00000001' ecx='0x00000100'/> </feature> <feature name='ssse3'> <!-- CPUID_EXT_SSSE3 --> - <cpuid function='0x00000001' ecx='0x00000200'/> + <cpuid eax_in='0x00000001' ecx='0x00000200'/> </feature> <feature name='cid'> <!-- CPUID_EXT_CID --> - <cpuid function='0x00000001' ecx='0x00000400'/> + <cpuid eax_in='0x00000001' ecx='0x00000400'/> </feature> <feature name='fma'> - <cpuid function='0x00000001' ecx='0x00001000'/> + <cpuid eax_in='0x00000001' ecx='0x00001000'/> </feature> <feature name='cx16'> <!-- CPUID_EXT_CX16 --> - <cpuid function='0x00000001' ecx='0x00002000'/> + <cpuid eax_in='0x00000001' ecx='0x00002000'/> </feature> <feature name='xtpr'> <!-- CPUID_EXT_XTPR --> - <cpuid function='0x00000001' ecx='0x00004000'/> + <cpuid eax_in='0x00000001' ecx='0x00004000'/> </feature> <feature name='pdcm'> - <cpuid function='0x00000001' ecx='0x00008000'/> + <cpuid eax_in='0x00000001' ecx='0x00008000'/> </feature> <feature name='pcid'> - <cpuid function='0x00000001' ecx='0x00020000'/> + <cpuid eax_in='0x00000001' ecx='0x00020000'/> </feature> <feature name='dca'> <!-- CPUID_EXT_DCA --> - <cpuid function='0x00000001' ecx='0x00040000'/> + <cpuid eax_in='0x00000001' ecx='0x00040000'/> </feature> <feature name='sse4.1'> <!-- CPUID_EXT_SSE41 --> - <cpuid function='0x00000001' ecx='0x00080000'/> + <cpuid eax_in='0x00000001' ecx='0x00080000'/> </feature> <feature name='sse4.2'> <!-- CPUID_EXT_SSE42 --> - <cpuid function='0x00000001' ecx='0x00100000'/> + <cpuid eax_in='0x00000001' ecx='0x00100000'/> </feature> <feature name='x2apic'> <!-- CPUID_EXT_X2APIC --> - <cpuid function='0x00000001' ecx='0x00200000'/> + <cpuid eax_in='0x00000001' ecx='0x00200000'/> </feature> <feature name='movbe'> - <cpuid function='0x00000001' ecx='0x00400000'/> + <cpuid eax_in='0x00000001' ecx='0x00400000'/> </feature> <feature name='popcnt'> <!-- CPUID_EXT_POPCNT --> - <cpuid function='0x00000001' ecx='0x00800000'/> + <cpuid eax_in='0x00000001' ecx='0x00800000'/> </feature> <feature name='tsc-deadline'> - <cpuid function='0x00000001' ecx='0x01000000'/> + <cpuid eax_in='0x00000001' ecx='0x01000000'/> </feature> <feature name='aes'> - <cpuid function='0x00000001' ecx='0x02000000'/> + <cpuid eax_in='0x00000001' ecx='0x02000000'/> </feature> <feature name='xsave'> - <cpuid function='0x00000001' ecx='0x04000000'/> + <cpuid eax_in='0x00000001' ecx='0x04000000'/> </feature> <feature name='osxsave'> - <cpuid function='0x00000001' ecx='0x08000000'/> + <cpuid eax_in='0x00000001' ecx='0x08000000'/> </feature> <feature name='avx'> - <cpuid function='0x00000001' ecx='0x10000000'/> + <cpuid eax_in='0x00000001' ecx='0x10000000'/> </feature> <feature name='f16c'> - <cpuid function='0x00000001' ecx='0x20000000'/> + <cpuid eax_in='0x00000001' ecx='0x20000000'/> </feature> <feature name='rdrand'> - <cpuid function='0x00000001' ecx='0x40000000'/> + <cpuid eax_in='0x00000001' ecx='0x40000000'/> </feature> <feature name='hypervisor'> <!-- CPUID_EXT_HYPERVISOR --> - <cpuid function='0x00000001' ecx='0x80000000'/> + <cpuid eax_in='0x00000001' ecx='0x80000000'/> </feature> <!-- extended features, EDX --> <feature name='syscall'> <!-- CPUID_EXT2_SYSCALL --> - <cpuid function='0x80000001' edx='0x00000800'/> + <cpuid eax_in='0x80000001' edx='0x00000800'/> </feature> <feature name='nx'> <!-- CPUID_EXT2_NX --> - <cpuid function='0x80000001' edx='0x00100000'/> + <cpuid eax_in='0x80000001' edx='0x00100000'/> </feature> <feature name='mmxext'> <!-- CPUID_EXT2_MMXEXT --> - <cpuid function='0x80000001' edx='0x00400000'/> + <cpuid eax_in='0x80000001' edx='0x00400000'/> </feature> <feature name='fxsr_opt'> <!-- CPUID_EXT2_FFXSR --> - <cpuid function='0x80000001' edx='0x02000000'/> + <cpuid eax_in='0x80000001' edx='0x02000000'/> </feature> <feature name='pdpe1gb'> <!-- CPUID_EXT2_PDPE1GB --> - <cpuid function='0x80000001' edx='0x04000000'/> + <cpuid eax_in='0x80000001' edx='0x04000000'/> </feature> <feature name='rdtscp'> <!-- CPUID_EXT2_RDTSCP --> - <cpuid function='0x80000001' edx='0x08000000'/> + <cpuid eax_in='0x80000001' edx='0x08000000'/> </feature> <feature name='lm'> <!-- CPUID_EXT2_LM --> - <cpuid function='0x80000001' edx='0x20000000'/> + <cpuid eax_in='0x80000001' edx='0x20000000'/> </feature> <feature name='3dnowext'> <!-- CPUID_EXT2_3DNOWEXT --> - <cpuid function='0x80000001' edx='0x40000000'/> + <cpuid eax_in='0x80000001' edx='0x40000000'/> </feature> <feature name='3dnow'> <!-- CPUID_EXT2_3DNOW --> - <cpuid function='0x80000001' edx='0x80000000'/> + <cpuid eax_in='0x80000001' edx='0x80000000'/> </feature> <!-- extended features, ECX --> <feature name='lahf_lm'> <!-- CPUID_EXT3_LAHF_LM --> - <cpuid function='0x80000001' ecx='0x00000001'/> + <cpuid eax_in='0x80000001' ecx='0x00000001'/> </feature> <feature name='cmp_legacy'> <!-- CPUID_EXT3_CMP_LEG --> - <cpuid function='0x80000001' ecx='0x00000002'/> + <cpuid eax_in='0x80000001' ecx='0x00000002'/> </feature> <feature name='svm'> <!-- CPUID_EXT3_SVM --> - <cpuid function='0x80000001' ecx='0x00000004'/> + <cpuid eax_in='0x80000001' ecx='0x00000004'/> </feature> <feature name='extapic'> <!-- CPUID_EXT3_EXTAPIC --> - <cpuid function='0x80000001' ecx='0x00000008'/> + <cpuid eax_in='0x80000001' ecx='0x00000008'/> </feature> <feature name='cr8legacy'> <!-- CPUID_EXT3_CR8LEG --> - <cpuid function='0x80000001' ecx='0x00000010'/> + <cpuid eax_in='0x80000001' ecx='0x00000010'/> </feature> <feature name='abm'> <!-- CPUID_EXT3_ABM --> - <cpuid function='0x80000001' ecx='0x00000020'/> + <cpuid eax_in='0x80000001' ecx='0x00000020'/> </feature> <feature name='sse4a'> <!-- CPUID_EXT3_SSE4A --> - <cpuid function='0x80000001' ecx='0x00000040'/> + <cpuid eax_in='0x80000001' ecx='0x00000040'/> </feature> <feature name='misalignsse'> <!-- CPUID_EXT3_MISALIGNSSE --> - <cpuid function='0x80000001' ecx='0x00000080'/> + <cpuid eax_in='0x80000001' ecx='0x00000080'/> </feature> <feature name='3dnowprefetch'> <!-- CPUID_EXT3_3DNOWPREFETCH --> - <cpuid function='0x80000001' ecx='0x00000100'/> + <cpuid eax_in='0x80000001' ecx='0x00000100'/> </feature> <feature name='osvw'> <!-- CPUID_EXT3_OSVW --> - <cpuid function='0x80000001' ecx='0x00000200'/> + <cpuid eax_in='0x80000001' ecx='0x00000200'/> </feature> <feature name='ibs'> - <cpuid function='0x80000001' ecx='0x00000400'/> + <cpuid eax_in='0x80000001' ecx='0x00000400'/> </feature> <feature name='xop'> - <cpuid function='0x80000001' ecx='0x00000800'/> + <cpuid eax_in='0x80000001' ecx='0x00000800'/> </feature> <feature name='skinit'> <!-- CPUID_EXT3_SKINIT --> - <cpuid function='0x80000001' ecx='0x00001000'/> + <cpuid eax_in='0x80000001' ecx='0x00001000'/> </feature> <feature name='wdt'> - <cpuid function='0x80000001' ecx='0x00002000'/> + <cpuid eax_in='0x80000001' ecx='0x00002000'/> </feature> <feature name='lwp'> - <cpuid function='0x80000001' ecx='0x00008000'/> + <cpuid eax_in='0x80000001' ecx='0x00008000'/> </feature> <feature name='fma4'> - <cpuid function='0x80000001' ecx='0x00010000'/> + <cpuid eax_in='0x80000001' ecx='0x00010000'/> </feature> <feature name='tce'> - <cpuid function='0x80000001' ecx='0x00020000'/> + <cpuid eax_in='0x80000001' ecx='0x00020000'/> </feature> <feature name='cvt16'> - <cpuid function='0x80000001' ecx='0x00040000'/> + <cpuid eax_in='0x80000001' ecx='0x00040000'/> </feature> <feature name='nodeid_msr'> - <cpuid function='0x80000001' ecx='0x00080000'/> + <cpuid eax_in='0x80000001' ecx='0x00080000'/> </feature> <feature name='tbm'> - <cpuid function='0x80000001' ecx='0x00200000'/> + <cpuid eax_in='0x80000001' ecx='0x00200000'/> </feature> <feature name='topoext'> - <cpuid function='0x80000001' ecx='0x00400000'/> + <cpuid eax_in='0x80000001' ecx='0x00400000'/> </feature> <feature name='perfctr_core'> - <cpuid function='0x80000001' ecx='0x00800000'/> + <cpuid eax_in='0x80000001' ecx='0x00800000'/> </feature> <feature name='perfctr_nb'> - <cpuid function='0x80000001' ecx='0x01000000'/> + <cpuid eax_in='0x80000001' ecx='0x01000000'/> </feature> <!-- cpuid function 0x7 ecx 0x0 features --> <!-- We support only ecx 0x0 now as it's done by a workaround --> <feature name='fsgsbase'> - <cpuid function='0x00000007' ebx='0x00000001'/> + <cpuid eax_in='0x00000007' ebx='0x00000001'/> </feature> <feature name='tsc_adjust'> - <cpuid function='0x00000007' ebx='0x00000002'/> + <cpuid eax_in='0x00000007' ebx='0x00000002'/> </feature> <feature name='bmi1'> - <cpuid function='0x00000007' ebx='0x00000008'/> + <cpuid eax_in='0x00000007' ebx='0x00000008'/> </feature> <feature name='hle'> - <cpuid function='0x00000007' ebx='0x00000010'/> + <cpuid eax_in='0x00000007' ebx='0x00000010'/> </feature> <feature name='avx2'> - <cpuid function='0x00000007' ebx='0x00000020'/> + <cpuid eax_in='0x00000007' ebx='0x00000020'/> </feature> <feature name='smep'> - <cpuid function='0x00000007' ebx='0x00000080'/> + <cpuid eax_in='0x00000007' ebx='0x00000080'/> </feature> <feature name='bmi2'> - <cpuid function='0x00000007' ebx='0x00000100'/> + <cpuid eax_in='0x00000007' ebx='0x00000100'/> </feature> <feature name='erms'> - <cpuid function='0x00000007' ebx='0x00000200'/> + <cpuid eax_in='0x00000007' ebx='0x00000200'/> </feature> <feature name='invpcid'> - <cpuid function='0x00000007' ebx='0x00000400'/> + <cpuid eax_in='0x00000007' ebx='0x00000400'/> </feature> <feature name='rtm'> - <cpuid function='0x00000007' ebx='0x00000800'/> + <cpuid eax_in='0x00000007' ebx='0x00000800'/> </feature> <feature name='mpx'> - <cpuid function='0x00000007' ebx='0x00004000'/> + <cpuid eax_in='0x00000007' ebx='0x00004000'/> </feature> <feature name='avx512f'> <!-- AVX-512 Foundation --> - <cpuid function='0x00000007' ebx='0x00010000'/> + <cpuid eax_in='0x00000007' ebx='0x00010000'/> </feature> <feature name='rdseed'> - <cpuid function='0x00000007' ebx='0x00040000'/> + <cpuid eax_in='0x00000007' ebx='0x00040000'/> </feature> <feature name='adx'> - <cpuid function='0x00000007' ebx='0x00080000'/> + <cpuid eax_in='0x00000007' ebx='0x00080000'/> </feature> <feature name='smap'> - <cpuid function='0x00000007' ebx='0x00100000'/> + <cpuid eax_in='0x00000007' ebx='0x00100000'/> </feature> <feature name='clflushopt'> - <cpuid function='0x00000007' ebx='0x00800000'/> + <cpuid eax_in='0x00000007' ebx='0x00800000'/> </feature> <feature name='avx512pf'> <!-- AVX-512 Prefetch --> - <cpuid function='0x00000007' ebx='0x04000000'/> + <cpuid eax_in='0x00000007' ebx='0x04000000'/> </feature> <feature name='avx512er'> <!-- AVX-512 Exponential and Reciprocal --> - <cpuid function='0x00000007' ebx='0x08000000'/> + <cpuid eax_in='0x00000007' ebx='0x08000000'/> </feature> <feature name='avx512cd'> <!-- AVX-512 Conflict Detection --> - <cpuid function='0x00000007' ebx='0x10000000'/> + <cpuid eax_in='0x00000007' ebx='0x10000000'/> </feature> <!-- Advanced Power Management edx features --> <feature name='invtsc' migratable='no'> - <cpuid function='0x80000007' edx='0x00000100'/> + <cpuid eax_in='0x80000007' edx='0x00000100'/> </feature> <!-- models --> diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index f2492b5..bc71734 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -68,24 +68,24 @@ struct _virCPUx86KVMFeature { static const virCPUx86KVMFeature x86_kvm_features[] = { - {VIR_CPU_x86_KVM_CLOCKSOURCE, { .function = 0x40000001, .eax = 0x00000001 }}, - {VIR_CPU_x86_KVM_NOP_IO_DELAY, { .function = 0x40000001, .eax = 0x00000002 }}, - {VIR_CPU_x86_KVM_MMU_OP, { .function = 0x40000001, .eax = 0x00000004 }}, - {VIR_CPU_x86_KVM_CLOCKSOURCE2, { .function = 0x40000001, .eax = 0x00000008 }}, - {VIR_CPU_x86_KVM_ASYNC_PF, { .function = 0x40000001, .eax = 0x00000010 }}, - {VIR_CPU_x86_KVM_STEAL_TIME, { .function = 0x40000001, .eax = 0x00000020 }}, - {VIR_CPU_x86_KVM_PV_EOI, { .function = 0x40000001, .eax = 0x00000040 }}, - {VIR_CPU_x86_KVM_PV_UNHALT, { .function = 0x40000001, .eax = 0x00000080 }}, + {VIR_CPU_x86_KVM_CLOCKSOURCE, { .eax_in = 0x40000001, .eax = 0x00000001 }}, + {VIR_CPU_x86_KVM_NOP_IO_DELAY, { .eax_in = 0x40000001, .eax = 0x00000002 }}, + {VIR_CPU_x86_KVM_MMU_OP, { .eax_in = 0x40000001, .eax = 0x00000004 }}, + {VIR_CPU_x86_KVM_CLOCKSOURCE2, { .eax_in = 0x40000001, .eax = 0x00000008 }}, + {VIR_CPU_x86_KVM_ASYNC_PF, { .eax_in = 0x40000001, .eax = 0x00000010 }}, + {VIR_CPU_x86_KVM_STEAL_TIME, { .eax_in = 0x40000001, .eax = 0x00000020 }}, + {VIR_CPU_x86_KVM_PV_EOI, { .eax_in = 0x40000001, .eax = 0x00000040 }}, + {VIR_CPU_x86_KVM_PV_UNHALT, { .eax_in = 0x40000001, .eax = 0x00000080 }}, {VIR_CPU_x86_KVM_CLOCKSOURCE_STABLE_BIT, - { .function = 0x40000001, .eax = 0x01000000 }}, - {VIR_CPU_x86_KVM_HV_RUNTIME, { .function = 0x40000003, .eax = 0x00000001 }}, - {VIR_CPU_x86_KVM_HV_SYNIC, { .function = 0x40000003, .eax = 0x00000004 }}, - {VIR_CPU_x86_KVM_HV_STIMER, { .function = 0x40000003, .eax = 0x00000008 }}, - {VIR_CPU_x86_KVM_HV_RELAXED, { .function = 0x40000003, .eax = 0x00000020 }}, - {VIR_CPU_x86_KVM_HV_SPINLOCK, { .function = 0x40000003, .eax = 0x00000022 }}, - {VIR_CPU_x86_KVM_HV_VAPIC, { .function = 0x40000003, .eax = 0x00000030 }}, - {VIR_CPU_x86_KVM_HV_VPINDEX, { .function = 0x40000003, .eax = 0x00000040 }}, - {VIR_CPU_x86_KVM_HV_RESET, { .function = 0x40000003, .eax = 0x00000080 }}, + { .eax_in = 0x40000001, .eax = 0x01000000 }}, + {VIR_CPU_x86_KVM_HV_RUNTIME, { .eax_in = 0x40000003, .eax = 0x00000001 }}, + {VIR_CPU_x86_KVM_HV_SYNIC, { .eax_in = 0x40000003, .eax = 0x00000004 }}, + {VIR_CPU_x86_KVM_HV_STIMER, { .eax_in = 0x40000003, .eax = 0x00000008 }}, + {VIR_CPU_x86_KVM_HV_RELAXED, { .eax_in = 0x40000003, .eax = 0x00000020 }}, + {VIR_CPU_x86_KVM_HV_SPINLOCK, { .eax_in = 0x40000003, .eax = 0x00000022 }}, + {VIR_CPU_x86_KVM_HV_VAPIC, { .eax_in = 0x40000003, .eax = 0x00000030 }}, + {VIR_CPU_x86_KVM_HV_VPINDEX, { .eax_in = 0x40000003, .eax = 0x00000040 }}, + {VIR_CPU_x86_KVM_HV_RESET, { .eax_in = 0x40000003, .eax = 0x00000080 }}, }; typedef struct _virCPUx86Model virCPUx86Model; @@ -203,9 +203,9 @@ virCPUx86CPUIDSorter(const void *a, const void *b) virCPUx86CPUID *da = (virCPUx86CPUID *) a; virCPUx86CPUID *db = (virCPUx86CPUID *) b; - if (da->function > db->function) + if (da->eax_in > db->eax_in) return 1; - else if (da->function < db->function) + else if (da->eax_in < db->eax_in) return -1; return 0; @@ -232,12 +232,12 @@ x86DataCpuidNext(virCPUx86DataIteratorPtr iterator) static virCPUx86CPUID * x86DataCpuid(const virCPUx86Data *data, - uint32_t function) + uint32_t eax_in) { size_t i; for (i = 0; i < data->len; i++) { - if (data->data[i].function == function) + if (data->data[i].eax_in == eax_in) return data->data + i; } @@ -307,7 +307,7 @@ virCPUx86DataAddCPUID(virCPUx86Data *data, { virCPUx86CPUID *existing; - if ((existing = x86DataCpuid(data, cpuid->function))) { + if ((existing = x86DataCpuid(data, cpuid->eax_in))) { x86cpuidSetBits(existing, cpuid); } else { if (VIR_APPEND_ELEMENT_COPY(data->data, data->len, @@ -331,7 +331,7 @@ x86DataAdd(virCPUx86Data *data1, virCPUx86CPUID *cpuid2; while ((cpuid2 = x86DataCpuidNext(&iter))) { - cpuid1 = x86DataCpuid(data1, cpuid2->function); + cpuid1 = x86DataCpuid(data1, cpuid2->eax_in); if (cpuid1) { x86cpuidSetBits(cpuid1, cpuid2); @@ -354,7 +354,7 @@ x86DataSubtract(virCPUx86Data *data1, virCPUx86CPUID *cpuid2; while ((cpuid1 = x86DataCpuidNext(&iter))) { - cpuid2 = x86DataCpuid(data2, cpuid1->function); + cpuid2 = x86DataCpuid(data2, cpuid1->eax_in); x86cpuidClearBits(cpuid1, cpuid2); } } @@ -369,7 +369,7 @@ x86DataIntersect(virCPUx86Data *data1, virCPUx86CPUID *cpuid2; while ((cpuid1 = x86DataCpuidNext(&iter))) { - cpuid2 = x86DataCpuid(data2, cpuid1->function); + cpuid2 = x86DataCpuid(data2, cpuid1->eax_in); if (cpuid2) x86cpuidAndBits(cpuid1, cpuid2); else @@ -397,7 +397,7 @@ x86DataIsSubset(const virCPUx86Data *data, const virCPUx86CPUID *cpuidSubset; while ((cpuidSubset = x86DataCpuidNext(&iter))) { - if (!(cpuid = x86DataCpuid(data, cpuidSubset->function)) || + if (!(cpuid = x86DataCpuid(data, cpuidSubset->eax_in)) || !x86cpuidMatchMasked(cpuid, cpuidSubset)) return false; } @@ -438,7 +438,7 @@ x86DataToVendor(const virCPUx86Data *data, for (i = 0; i < map->nvendors; i++) { virCPUx86VendorPtr vendor = map->vendors[i]; - if ((cpuid = x86DataCpuid(data, vendor->cpuid.function)) && + if ((cpuid = x86DataCpuid(data, vendor->cpuid.eax_in)) && x86cpuidMatchMasked(cpuid, &vendor->cpuid)) { x86cpuidClearBits(cpuid, &vendor->cpuid); return vendor; @@ -553,7 +553,7 @@ x86VendorParse(xmlXPathContextPtr ctxt, goto error; } - vendor->cpuid.function = 0; + vendor->cpuid.eax_in = 0; vendor->cpuid.ebx = virReadBufInt32LE(string); vendor->cpuid.edx = virReadBufInt32LE(string + 4); vendor->cpuid.ecx = virReadBufInt32LE(string + 8); @@ -667,23 +667,25 @@ static int x86ParseCPUID(xmlXPathContextPtr ctxt, virCPUx86CPUID *cpuid) { - unsigned long fun, eax, ebx, ecx, edx; - int ret_fun, ret_eax, ret_ebx, ret_ecx, ret_edx; + unsigned long eax_in; + unsigned long eax, ebx, ecx, edx; + int ret_eax_in, ret_eax, ret_ebx, ret_ecx, ret_edx; memset(cpuid, 0, sizeof(*cpuid)); - fun = eax = ebx = ecx = edx = 0; - ret_fun = virXPathULongHex("string(@function)", ctxt, &fun); + eax_in = 0; + eax = ebx = ecx = edx = 0; + ret_eax_in = virXPathULongHex("string(@eax_in)", ctxt, &eax_in); ret_eax = virXPathULongHex("string(@eax)", ctxt, &eax); ret_ebx = virXPathULongHex("string(@ebx)", ctxt, &ebx); ret_ecx = virXPathULongHex("string(@ecx)", ctxt, &ecx); ret_edx = virXPathULongHex("string(@edx)", ctxt, &edx); - if (ret_fun < 0 || ret_eax == -2 || ret_ebx == -2 - || ret_ecx == -2 || ret_edx == -2) + if (ret_eax_in < 0 || + ret_eax == -2 || ret_ebx == -2 || ret_ecx == -2 || ret_edx == -2) return -1; - cpuid->function = fun; + cpuid->eax_in = eax_in; cpuid->eax = eax; cpuid->ebx = ebx; cpuid->ecx = ecx; @@ -966,7 +968,7 @@ x86ModelCompare(virCPUx86ModelPtr model1, while ((cpuid1 = x86DataCpuidNext(&iter1))) { virCPUx86CompareResult match = SUPERSET; - if ((cpuid2 = x86DataCpuid(model2->data, cpuid1->function))) { + if ((cpuid2 = x86DataCpuid(model2->data, cpuid1->eax_in))) { if (x86cpuidMatch(cpuid1, cpuid2)) continue; else if (!x86cpuidMatchMasked(cpuid1, cpuid2)) @@ -982,7 +984,7 @@ x86ModelCompare(virCPUx86ModelPtr model1, while ((cpuid2 = x86DataCpuidNext(&iter2))) { virCPUx86CompareResult match = SUBSET; - if ((cpuid1 = x86DataCpuid(model1->data, cpuid2->function))) { + if ((cpuid1 = x86DataCpuid(model1->data, cpuid2->eax_in))) { if (x86cpuidMatch(cpuid2, cpuid1)) continue; else if (!x86cpuidMatchMasked(cpuid2, cpuid1)) @@ -1272,10 +1274,10 @@ x86CPUDataFormat(const virCPUData *data) virBufferAddLit(&buf, "<cpudata arch='x86'>\n"); while ((cpuid = x86DataCpuidNext(&iter))) { virBufferAsprintf(&buf, - " <cpuid function='0x%08x'" + " <cpuid eax_in='0x%08x'" " eax='0x%08x' ebx='0x%08x'" " ecx='0x%08x' edx='0x%08x'/>\n", - cpuid->function, + cpuid->eax_in, cpuid->eax, cpuid->ebx, cpuid->ecx, cpuid->edx); } virBufferAddLit(&buf, "</cpudata>\n"); @@ -1884,7 +1886,7 @@ cpuidCall(virCPUx86CPUID *cpuid) "=b" (cpuid->ebx), "=c" (cpuid->ecx), "=d" (cpuid->edx) - : "a" (cpuid->function)); + : "a" (cpuid->eax_in)); # else /* we need to avoid direct use of ebx for CPUID output as it is used * for global offset table on i386 with -fPIC @@ -1900,7 +1902,7 @@ cpuidCall(virCPUx86CPUID *cpuid) "=r" (cpuid->ebx), "=c" (cpuid->ecx), "=d" (cpuid->edx) - : "a" (cpuid->function) + : "a" (cpuid->eax_in) : "cc"); # endif } @@ -1917,7 +1919,7 @@ cpuidSet(uint32_t base, virCPUx86Data *data) max = cpuid.eax; for (i = base; i <= max; i++) { - cpuid.function = i; + cpuid.eax_in = i; cpuidCall(&cpuid); if (virCPUx86DataAddCPUID(data, &cpuid) < 0) return -1; diff --git a/src/cpu/cpu_x86_data.h b/src/cpu/cpu_x86_data.h index 777cc8d..ca87bc5 100644 --- a/src/cpu/cpu_x86_data.h +++ b/src/cpu/cpu_x86_data.h @@ -28,7 +28,7 @@ typedef struct _virCPUx86CPUID virCPUx86CPUID; struct _virCPUx86CPUID { - uint32_t function; + uint32_t eax_in; uint32_t eax; uint32_t ebx; uint32_t ecx; diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 585b882..874ed24 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -6363,7 +6363,7 @@ qemuMonitorJSONParseCPUx86FeatureWord(virJSONValuePtr data, virCPUx86CPUID *cpuid) { const char *reg; - unsigned long long fun; + unsigned long long eax_in; unsigned long long features; memset(cpuid, 0, sizeof(*cpuid)); @@ -6373,7 +6373,7 @@ qemuMonitorJSONParseCPUx86FeatureWord(virJSONValuePtr data, _("missing cpuid-register in CPU data")); return -1; } - if (virJSONValueObjectGetNumberUlong(data, "cpuid-input-eax", &fun) < 0) { + if (virJSONValueObjectGetNumberUlong(data, "cpuid-input-eax", &eax_in) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing or invalid cpuid-input-eax in CPU data")); return -1; @@ -6384,7 +6384,7 @@ qemuMonitorJSONParseCPUx86FeatureWord(virJSONValuePtr data, return -1; } - cpuid->function = fun; + cpuid->eax_in = eax_in; if (STREQ(reg, "EAX")) { cpuid->eax = features; } else if (STREQ(reg, "EBX")) { diff --git a/tests/qemumonitorjsondata/qemumonitorjson-getcpu-full.data b/tests/qemumonitorjsondata/qemumonitorjson-getcpu-full.data index bba8d31..87a8fb1 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-getcpu-full.data +++ b/tests/qemumonitorjsondata/qemumonitorjson-getcpu-full.data @@ -1,5 +1,5 @@ <cpudata arch='x86'> - <cpuid function='0x00000001' eax='0x00000000' ebx='0x00000000' ecx='0x97ba2223' edx='0x078bfbfd'/> - <cpuid function='0x40000001' eax='0x0100003b' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> - <cpuid function='0x80000001' eax='0x00000000' ebx='0x00000000' ecx='0x00000001' edx='0x28100800'/> + <cpuid eax_in='0x00000001' eax='0x00000000' ebx='0x00000000' ecx='0x97ba2223' edx='0x078bfbfd'/> + <cpuid eax_in='0x40000001' eax='0x0100003b' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x80000001' eax='0x00000000' ebx='0x00000000' ecx='0x00000001' edx='0x28100800'/> </cpudata> diff --git a/tests/qemumonitorjsondata/qemumonitorjson-getcpu-host.data b/tests/qemumonitorjsondata/qemumonitorjson-getcpu-host.data index 98b9e7c..83bafe1 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-getcpu-host.data +++ b/tests/qemumonitorjsondata/qemumonitorjson-getcpu-host.data @@ -1,6 +1,6 @@ <cpudata arch='x86'> - <cpuid function='0x00000001' eax='0x00000000' ebx='0x00000000' ecx='0x97ba2223' edx='0x0f8bfbff'/> - <cpuid function='0x00000007' eax='0x00000000' ebx='0x00000002' ecx='0x00000000' edx='0x00000000'/> - <cpuid function='0x40000001' eax='0x0100007b' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> - <cpuid function='0x80000001' eax='0x00000000' ebx='0x00000000' ecx='0x00000001' edx='0x2993fbff'/> + <cpuid eax_in='0x00000001' eax='0x00000000' ebx='0x00000000' ecx='0x97ba2223' edx='0x0f8bfbff'/> + <cpuid eax_in='0x00000007' eax='0x00000000' ebx='0x00000002' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x40000001' eax='0x0100007b' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/> + <cpuid eax_in='0x80000001' eax='0x00000000' ebx='0x00000000' ecx='0x00000001' edx='0x2993fbff'/> </cpudata> -- 2.8.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list