qemu-patch-raspberry4/target-i386
Eduardo Habkost 7e5292b553 target-i386: Add "filtered-features" property to X86CPU
This property will contain all the features that were removed from the
CPU because they are not supported by the host.

This way, libvirt or other management tools can emulate the
check/enforce behavior by checking if filtered-properties is all zeroes,
before starting the guest.

Example output where some features were missing:

  $ qemu-system-x86_64 -enable-kvm -cpu Haswell,check -S \
    -qmp unix:/tmp/m,server,nowait
  warning: host doesn't support requested feature: CPUID.01H:ECX.fma [bit 12]
  warning: host doesn't support requested feature: CPUID.01H:ECX.movbe [bit 22]
  warning: host doesn't support requested feature: CPUID.01H:ECX.tsc-deadline [bit 24]
  warning: host doesn't support requested feature: CPUID.01H:ECX.xsave [bit 26]
  warning: host doesn't support requested feature: CPUID.01H:ECX.avx [bit 28]
  warning: host doesn't support requested feature: CPUID.07H:EBX.fsgsbase [bit 0]
  warning: host doesn't support requested feature: CPUID.07H:EBX.bmi1 [bit 3]
  warning: host doesn't support requested feature: CPUID.07H:EBX.hle [bit 4]
  warning: host doesn't support requested feature: CPUID.07H:EBX.avx2 [bit 5]
  warning: host doesn't support requested feature: CPUID.07H:EBX.smep [bit 7]
  warning: host doesn't support requested feature: CPUID.07H:EBX.bmi2 [bit 8]
  warning: host doesn't support requested feature: CPUID.07H:EBX.erms [bit 9]
  warning: host doesn't support requested feature: CPUID.07H:EBX.invpcid [bit 10]
  warning: host doesn't support requested feature: CPUID.07H:EBX.rtm [bit 11]
  [...]
  $ ./QMP/qmp --path=/tmp/m \
    qom-get --path=/machine/icc-bridge/icc/child[0] \
            --property=filtered-features
  item[0].cpuid-register: EDX
  item[0].cpuid-input-eax: 2147483658
  item[0].features: 0
  item[1].cpuid-register: EAX
  item[1].cpuid-input-eax: 1073741825
  item[1].features: 0
  item[2].cpuid-register: EDX
  item[2].cpuid-input-eax: 3221225473
  item[2].features: 0
  item[3].cpuid-register: ECX
  item[3].cpuid-input-eax: 2147483649
  item[3].features: 0
  item[4].cpuid-register: EDX
  item[4].cpuid-input-eax: 2147483649
  item[4].features: 0
  item[5].cpuid-register: EBX
  item[5].cpuid-input-eax: 7
  item[5].features: 4025
  item[5].cpuid-input-ecx: 0
  item[6].cpuid-register: ECX
  item[6].cpuid-input-eax: 1
  item[6].features: 356519936
  item[7].cpuid-register: EDX
  item[7].cpuid-input-eax: 1
  item[7].features: 0

Example output when no feature is missing:

  $ qemu-system-x86_64 -enable-kvm -cpu Nehalem,enforce -S \
    -qmp unix:/tmp/m,server,nowait
  [...]
  $ ./QMP/qmp --path=/tmp/m \
    qom-get --path=/machine/icc-bridge/icc/child[0] \
            --property=filtered-features
  item[0].cpuid-register: EDX
  item[0].cpuid-input-eax: 2147483658
  item[0].features: 0
  item[1].cpuid-register: EAX
  item[1].cpuid-input-eax: 1073741825
  item[1].features: 0
  item[2].cpuid-register: EDX
  item[2].cpuid-input-eax: 3221225473
  item[2].features: 0
  item[3].cpuid-register: ECX
  item[3].cpuid-input-eax: 2147483649
  item[3].features: 0
  item[4].cpuid-register: EDX
  item[4].cpuid-input-eax: 2147483649
  item[4].features: 0
  item[5].cpuid-register: EBX
  item[5].cpuid-input-eax: 7
  item[5].features: 0
  item[5].cpuid-input-ecx: 0
  item[6].cpuid-register: ECX
  item[6].cpuid-input-eax: 1
  item[6].features: 0
  item[7].cpuid-register: EDX
  item[7].cpuid-input-eax: 1
  item[7].features: 0

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-05-06 19:16:30 +02:00
..
arch_dump.c cpu: Move cpu_write_elfXX_note() functions to CPUState 2013-05-01 13:04:19 +02:00
arch_memory_mapping.c target-i386: fix bits 39:32 of the final physical address when using 4M page 2013-01-09 15:12:20 -02:00
cc_helper.c target-i386: Add CC_OP_CLR 2013-02-19 23:05:18 -08:00
cc_helper_template.h target-i386: Implement BLSR, BLSMSK, BLSI 2013-02-18 15:52:05 -08:00
cpu-qom.h target-i386: Introduce X86CPU::filtered_features field 2013-05-06 19:16:30 +02:00
cpu.c target-i386: Add "filtered-features" property to X86CPU 2013-05-06 19:16:30 +02:00
cpu.h target-i386: Replace cpuid_*features fields with a feature word array 2013-05-02 00:27:55 +02:00
excp_helper.c softmmu: move include files to include/sysemu/ 2012-12-19 08:32:45 +01:00
fpu_helper.c target-i386: add AES-NI instructions 2013-04-13 13:51:57 +02:00
helper.c target-i386: Replace cpuid_*features fields with a feature word array 2013-05-02 00:27:55 +02:00
helper.h target-i386: Use mulu2 and muls2 2013-02-27 19:06:28 +00:00
hyperv.c hyper-v: introduce Hyper-V support infrastructure. 2012-01-19 08:32:12 -02:00
hyperv.h hyperv: fix build on non-KVM hosts 2012-01-23 20:04:51 +00:00
int_helper.c target-i386: Use mulu2 and muls2 2013-02-27 19:06:28 +00:00
ioport-user.c exec: move include files to include/exec/ 2012-12-19 08:31:31 +01:00
kvm-stub.c kvm: Move kvm_allows_irq0_override() to target-i386, fix return type 2012-08-09 16:16:55 +03:00
kvm.c target-i386: Replace cpuid_*features fields with a feature word array 2013-05-02 00:27:55 +02:00
kvm_i386.h softmmu: move include files to include/sysemu/ 2012-12-19 08:32:45 +01:00
machine.c target-i386: kvm: save/restore steal time MSR 2013-04-17 23:27:24 -03:00
Makefile.objs x86: switch to AREG0 free mode 2012-08-14 19:01:26 +00:00
mem_helper.c exec: move include files to include/exec/ 2012-12-19 08:31:31 +01:00
misc_helper.c target-i386: Replace cpuid_*features fields with a feature word array 2013-05-02 00:27:55 +02:00
ops_sse.h target-i386: add AES-NI instructions 2013-04-13 13:51:57 +02:00
ops_sse_header.h target-i386: add AES-NI instructions 2013-04-13 13:51:57 +02:00
seg_helper.c cpu: Replace do_interrupt() by CPUClass::do_interrupt method 2013-03-12 10:35:55 +01:00
shift_helper_template.h target-i386: compute eflags outside rcl/rcr helper 2013-02-18 15:03:56 -08:00
smm_helper.c cpu_dump_state: move DUMP_FPU and DUMP_CCOP flags from x86-only to generic 2012-10-05 15:04:43 +01:00
svm.h Use new macro QEMU_PACKED for packed structures 2011-09-03 10:45:59 +00:00
svm_helper.c cpu: Move halted and interrupt_request fields to CPUState 2013-03-12 10:35:55 +01:00
TODO target-i386: fix {min,max}{pd,ps,sd,ss} SSE2 instructions 2012-01-11 09:55:28 +01:00
topology.h target-i386: Inline bitops_flsl 2013-02-16 11:12:29 +00:00
translate.c target-i386: Replace cpuid_*features fields with a feature word array 2013-05-02 00:27:55 +02:00