public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: Eduardo Habkost <ehabkost@redhat.com>, qemu-devel@nongnu.org
Cc: "Borislav Petkov" <bp@alien8.de>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Gabriel L. Somlo" <gsomlo@gmail.com>,
	kvm@vger.kernel.org, "Michael S. Tsirkin" <mst@redhat.com>,
	"Michael Mueller" <mimu@linux.vnet.ibm.com>,
	"Christian Borntraeger" <borntraeger@de.ibm.com>,
	"Jason J. Herne" <jjherne@linux.vnet.ibm.com>,
	"Andreas Färber" <afaerber@suse.de>,
	"Eric Blake" <eblake@redhat.com>
Subject: Re: [RFC 2/2 v2] target-i386: Add "x-allow-emulation" X86CPU property
Date: Fri, 06 Jun 2014 00:27:14 +0200	[thread overview]
Message-ID: <5390EEC2.1060103@suse.de> (raw)
In-Reply-To: <20140605195746.GH15000@otherpad.lan.raisama.net>


On 05.06.14 21:57, Eduardo Habkost wrote:
> The new option will allow slow emulated features (the ones returned by
> GET_EMULATED_CPUID) to be enabled. We don't want to allow them to be
> enabled by accident, so they will be enabled only if emulation is
> explicitly allowed by the user.
>
> Use "x-" prefix on the property name, to document that it is not
> supposed to be supported forever, and intended for developers who want
> to test GET_EMULATED_CPUID.
>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

ack if you do s/emulation/experimental/g throughout the patch :).


Alex

> ---
> Changes v1 -> v2:
>   * Rename property to x-allow-emulation
> ---
>   target-i386/cpu-qom.h |  3 +++
>   target-i386/cpu.c     | 18 ++++++++++++++----
>   2 files changed, 17 insertions(+), 4 deletions(-)
>
> diff --git a/target-i386/cpu-qom.h b/target-i386/cpu-qom.h
> index 385b81f..831f7bf 100644
> --- a/target-i386/cpu-qom.h
> +++ b/target-i386/cpu-qom.h
> @@ -74,6 +74,8 @@ typedef struct X86CPUClass {
>    * @migratable: If set, only migratable flags will be accepted when "enforce"
>    * mode is used, and only migratable flags will be included in the "host"
>    * CPU model.
> + * @allow_emulation: If set, accelerator-specific code will allow emulated
> + * features to be enabled.
>    *
>    * An x86 CPU.
>    */
> @@ -91,6 +93,7 @@ typedef struct X86CPU {
>       bool check_cpuid;
>       bool enforce_cpuid;
>       bool migratable;
> +    bool allow_emulation;
>   
>       /* if true the CPUID code directly forward host cache leaves to the guest */
>       bool cache_info_passthrough;
> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> index 1395473..cf6ab59 100644
> --- a/target-i386/cpu.c
> +++ b/target-i386/cpu.c
> @@ -1280,7 +1280,8 @@ static void host_x86_cpu_class_init(ObjectClass *oc, void *data)
>   }
>   
>   static uint32_t x86_cpu_get_supported_feature_word(FeatureWord w,
> -                                                   bool migratable_only);
> +                                                   bool migratable_only,
> +                                                   bool allow_emulation);
>   
>   static void host_x86_cpu_initfn(Object *obj)
>   {
> @@ -1297,7 +1298,8 @@ static void host_x86_cpu_initfn(Object *obj)
>   
>       for (w = 0; w < FEATURE_WORDS; w++) {
>           env->features[w] =
> -            x86_cpu_get_supported_feature_word(w, cpu->migratable);
> +            x86_cpu_get_supported_feature_word(w, cpu->migratable,
> +                                                  cpu->allow_emulation);
>       }
>       object_property_set_bool(OBJECT(cpu), true, "pmu", &error_abort);
>   }
> @@ -1887,7 +1889,8 @@ CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp)
>   }
>   
>   static uint32_t x86_cpu_get_supported_feature_word(FeatureWord w,
> -                                                   bool migratable_only)
> +                                                   bool migratable_only,
> +                                                   bool allow_emulation)
>   {
>       FeatureWordInfo *wi = &feature_word_info[w];
>       uint32_t r;
> @@ -1896,6 +1899,11 @@ static uint32_t x86_cpu_get_supported_feature_word(FeatureWord w,
>           r = kvm_arch_get_supported_cpuid(kvm_state, wi->cpuid_eax,
>                                                       wi->cpuid_ecx,
>                                                       wi->cpuid_reg);
> +        if (allow_emulation) {
> +            r |= kvm_arch_get_emulated_cpuid(kvm_state,  wi->cpuid_eax,
> +                                                         wi->cpuid_ecx,
> +                                                         wi->cpuid_reg);
> +        }
>       } else if (tcg_enabled()) {
>           r = wi->tcg_features;
>       } else {
> @@ -1920,7 +1928,8 @@ static int x86_cpu_filter_features(X86CPU *cpu)
>   
>       for (w = 0; w < FEATURE_WORDS; w++) {
>           uint32_t host_feat =
> -            x86_cpu_get_supported_feature_word(w, cpu->migratable);
> +            x86_cpu_get_supported_feature_word(w, cpu->migratable,
> +                                                  cpu->allow_emulation);
>           uint32_t requested_features = env->features[w];
>           env->features[w] &= host_feat;
>           cpu->filtered_features[w] = requested_features & ~env->features[w];
> @@ -2854,6 +2863,7 @@ static Property x86_cpu_properties[] = {
>       DEFINE_PROP_BOOL("hv-time", X86CPU, hyperv_time, false),
>       DEFINE_PROP_BOOL("check", X86CPU, check_cpuid, false),
>       DEFINE_PROP_BOOL("enforce", X86CPU, enforce_cpuid, false),
> +    DEFINE_PROP_BOOL("x-allow-emulation", X86CPU, allow_emulation, true),
>       DEFINE_PROP_END_OF_LIST()
>   };
>   


      reply	other threads:[~2014-06-05 22:27 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-05 16:12 [RFC 0/2] GET_EMULATED_CPUID support with "allow-emulation" option Eduardo Habkost
2014-06-05 16:24 ` Alexander Graf
2014-06-05 16:26   ` Paolo Bonzini
2014-06-05 16:40     ` Alexander Graf
2014-06-05 16:44       ` Paolo Bonzini
2014-06-05 16:45         ` Alexander Graf
2014-06-05 16:52           ` Paolo Bonzini
2014-06-05 16:54             ` Alexander Graf
2014-06-05 16:57               ` Paolo Bonzini
2014-06-05 17:19                 ` Eduardo Habkost
2014-06-05 17:39                   ` Paolo Bonzini
2014-06-05 18:02                     ` Eduardo Habkost
2014-06-05 19:12                       ` Eduardo Habkost
2014-06-05 19:24                         ` [Qemu-devel] " Borislav Petkov
2014-06-05 19:45                           ` Eric Blake
2014-06-05 19:52                             ` Eduardo Habkost
2014-06-05 16:58             ` Alexander Graf
2014-06-05 17:48               ` Eduardo Habkost
2014-06-05 22:24                 ` Alexander Graf
2014-06-06  1:21                   ` Borislav Petkov
2014-06-06  2:37                     ` Eduardo Habkost
2014-06-06 11:16                       ` Alexander Graf
2014-06-06 18:38                         ` Eduardo Habkost
2014-06-05 17:17           ` Eduardo Habkost
2014-06-05 17:38             ` Paolo Bonzini
2014-06-05 17:52               ` Eduardo Habkost
2014-06-05 17:34       ` Eduardo Habkost
2014-06-06 13:29     ` gleb
2014-06-05 18:11   ` [Qemu-devel] " Eduardo Habkost
     [not found] ` <1401984741-26882-3-git-send-email-ehabkost@redhat.com>
2014-06-05 19:57   ` [RFC 2/2 v2] target-i386: Add "x-allow-emulation" X86CPU property Eduardo Habkost
2014-06-05 22:27     ` Alexander Graf [this message]

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=5390EEC2.1060103@suse.de \
    --to=agraf@suse.de \
    --cc=afaerber@suse.de \
    --cc=borntraeger@de.ibm.com \
    --cc=bp@alien8.de \
    --cc=eblake@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=gsomlo@gmail.com \
    --cc=jjherne@linux.vnet.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=mimu@linux.vnet.ibm.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@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