Skip to content

RFC X86CPU "feature-words" & "filtered-features" properties (v2)

Eduardo Habkost qemu-devel 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest5 patches 0 repliesNew

Changes v2 from the cover letter

* Added "filtered-features" properties
* Removed the non-qapi version and kept only the qapi version of the code
* Moved the new types to qapi-schema.json instead of creating cpu-qapi-schema.json
* Rebased on top of "feature words array" series

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5target-i386: Add ECX information to FeatureWordInfotarget-i386/cpu.c+7 -30 replies
2/5target-i386: Add "feature-words" property.gitignore Makefile.objs qapi-schema.json +1 more+98 -130 replies
3/5target-i386: Use FeatureWord loop on filter_features_for_kvm()target-i386/cpu.c+7 -170 replies
4/5target-i386: Introduce X86CPU.filtered_features fieldtarget-i386/cpu-qom.h target-i386/cpu.c+9 -30 replies
5/5target-i386: Add "filtered-features" property to X86CPUtarget-i386/cpu.c+7 -40 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [Qemu-devel] [RFC 0/5] X86CPU "feature-words" & "filtered-features" properties (v2)

Changes v2:
* Added "filtered-features" properties
* Removed the non-qapi version and kept only the qapi version of the code
* Moved the new types to qapi-schema.json instead of creating cpu-qapi-schema.json
* Rebased on top of "feature words array" series

Git tree:
https://github.com/ehabkost/qemu-hacks/tree/work/cpu-raw-feature-props-v2
git://github.com/ehabkost/qemu-hacks.git work/cpu-raw-feature-props-v2

Description:

As the work to get X86CPU subclasses static properties defined is taking very long to get reviewed and we risk not getting it finished in 1.5, I am sending an alternative mechanism to allow libvirt to probe for CPU model information.

It's interesting to note that this alternative solution is actually _easier_ to use for libvirt, because libvirt logic is already based on CPUID bit values, not "feature names", so it should be very easy to convert the current libvirt code that (incorrectly) query the host CPU directly for available features to instead start QEMU with "-cpu host" and use the "feature-words" array information to find out which CPU features are supported by the host.

The "feature-words" property will have two main use cases:
* Checking host capabilities, by checking the features of the "host" CPU model;
* Checking which features are enabled on each CPU model.

The "filtered-features" property will have two main use cases:
* Allowing libvirt to emulate the "check" & "enforce" flags while collecting more detailted data about the missing features;
* Allowing libvirt to probe for CPU model information even if host features are missing (it can simply combine the "feature-words" and "filtered-features" values to get the full CPU model definition)

Example output:

  $ ./QMP/qmp --path=/tmp/m qom-get --path=/machine/unattached/device[1] --property=feature-words
  item[0].cpuid-register: EDX
  item[0].cpuid-input-eax: 1
  item[0].features: 126614521
  item[1].cpuid-register: ECX
  item[1].cpuid-input-eax: 1
  item[1].features: 2155880449
  item[2].cpuid-register: EBX
  item[2].cpuid-input-eax: 7
  item[2].features: 0
  item[2].cpuid-input-ecx: 0
  item[3].cpuid-register: EDX
  item[3].cpuid-input-eax: 2147483649
  item[3].features: 563346425
  item[4].cpuid-register: ECX
  item[4].cpuid-input-eax: 2147483649
  item[4].features: 101
  item[5].cpuid-register: EDX
  item[5].cpuid-input-eax: 3221225473
  item[5].features: 0
  item[6].cpuid-register: EAX
  item[6].cpuid-input-eax: 1073741825
  item[6].features: 0
  item[7].cpuid-register: EDX
  item[7].cpuid-input-eax: 2147483658
  item[7].features: 0

Eduardo Habkost (5):
target-i386: Add ECX information to FeatureWordInfo
target-i386: Add "feature-words" property
target-i386: Use FeatureWord loop on filter_features_for_kvm()
target-i386: Introduce X86CPU.filtered_features field
target-i386: Add "filtered-features" property to X86CPU

 .gitignore            |   2 +
 Makefile.objs         |   7 +++-
 qapi-schema.json      |  32 +++++++++++++++
 target-i386/cpu-qom.h |   3 ++
 target-i386/cpu.c     | 110 +++++++++++++++++++++++++++++++++++---------------
 5 files changed, 121 insertions(+), 33 deletions(-)
Signature · 1 line
1.8.1.4