qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: qemu-devel@nongnu.org
Cc: libvir-list@redhat.com, "Igor Mammedov" <imammedo@redhat.com>,
	"Jiri Denemark" <jdenemar@redhat.com>,
	"Andreas Färber" <afaerber@suse.de>
Subject: [Qemu-devel] [RFC 0/4] target-i386: Add "feature-words" CPU object property
Date: Mon,  1 Apr 2013 16:46:45 -0300	[thread overview]
Message-ID: <1364845609-10543-1-git-send-email-ehabkost@redhat.com> (raw)

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 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.

This series has two alternative implementations, so both approaches can get
feedback: patch 3 has a non-qapi implementation, that simply builds the list and
sets the struct fields manually. Patch 4 converts that implementation to a qapi-
based implementation.

(BTW, I really missed some documentation on the list-related visitor functions,
when writing this code)

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

I plan to send another RFC as followup soon, that will add:

 * "-cpu force" (or "nofilter", or something else; I haven't decided about the
   name, yet) flag, to disable feature filtering based on host capabilities.
 * "filtered-features" property, listing which features were filtered out
   because of missing host capabilities (to allow libvirt to implement "enforce"
   mode in a more reliable way).

Eduardo Habkost (4):
  target-i386: Add ECX information to FeatureWordInfo
  target-i386: Move feature word array outside get_register_name_32()
  target-i386: Add "feature-words" property
  target-i386: Use qapi for x86_cpu_get_feature_words()

 .gitignore                       |  2 +
 Makefile                         | 11 +++++
 Makefile.objs                    |  5 +++
 cpu-qapi-schema.json             | 31 ++++++++++++++
 target-i386/Makefile.objs        |  1 +
 target-i386/cpu-qapi-schema.json | 31 ++++++++++++++
 target-i386/cpu.c                | 92 +++++++++++++++++++++++++++++++++-------
 7 files changed, 158 insertions(+), 15 deletions(-)
 create mode 100644 cpu-qapi-schema.json
 create mode 100644 target-i386/cpu-qapi-schema.json

-- 
1.8.1.4

             reply	other threads:[~2013-04-01 19:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-01 19:46 Eduardo Habkost [this message]
2013-04-01 19:46 ` [Qemu-devel] [RFC 1/4] target-i386: Add ECX information to FeatureWordInfo Eduardo Habkost
2013-04-01 19:46 ` [Qemu-devel] [RFC 2/4] target-i386: Move feature word array outside get_register_name_32() Eduardo Habkost
2013-04-02 18:54   ` Eduardo Habkost
2013-04-01 19:46 ` [Qemu-devel] [RFC 3/4] target-i386: Add "feature-words" property Eduardo Habkost
2013-04-01 19:46 ` [Qemu-devel] [RFC 4/4] target-i386: Use qapi for x86_cpu_get_feature_words() Eduardo Habkost

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1364845609-10543-1-git-send-email-ehabkost@redhat.com \
    --to=ehabkost@redhat.com \
    --cc=afaerber@suse.de \
    --cc=imammedo@redhat.com \
    --cc=jdenemar@redhat.com \
    --cc=libvir-list@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).