All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: qemu-devel@nongnu.org, Eric Blake <eblake@redhat.com>,
	Alexander Graf <agraf@suse.de>,
	Richard Henderson <rth@twiddle.net>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	Michael Roth <mdroth@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH 4/4] x86: Support feature=force on the command-line
Date: Thu, 4 May 2017 11:49:38 +0200	[thread overview]
Message-ID: <20170504114938.3c58ebf0@nial.brq.redhat.com> (raw)
In-Reply-To: <20170502203115.22233-5-ehabkost@redhat.com>

On Tue,  2 May 2017 17:31:15 -0300
Eduardo Habkost <ehabkost@redhat.com> wrote:

> Introduce a new CPUFeatureSetting QAPI data type, and use it to support
> feature=force on -cpu.
commit message lacks rationale why it's needed.
I suspect that it's to enable forced mwait.
It would be nice to put here answer to what
motivated to write this patch and reference commit ids
of kernel patches if there are/needed any to make it work.

> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
[...]
> @@ -3717,25 +3727,46 @@ static void x86_cpu_set_bit_prop(Object *obj, Visitor *v, const char *name,
>      X86CPU *cpu = X86_CPU(obj);
>      BitProperty *fp = opaque;
>      Error *local_err = NULL;
> -    bool value;
> +    CPUFeatureSetting *value = NULL;
>  
>      if (dev->realized) {
>          qdev_prop_set_after_realize(dev, name, errp);
>          return;
>      }
>  
> -    visit_type_bool(v, name, &value, &local_err);
> +    visit_type_CPUFeatureSetting(v, name, &value, &local_err);
>      if (local_err) {
>          error_propagate(errp, local_err);
>          return;
>      }
>  
> -    if (value) {
> -        cpu->env.features[fp->w] |= fp->mask;
> -    } else {
> -        cpu->env.features[fp->w] &= ~fp->mask;
> +    switch (value->type) {
> +    case QTYPE_QBOOL:
> +        if (value->u.q_bool) {
> +            cpu->env.features[fp->w] |= fp->mask;
> +        } else {
> +            cpu->env.features[fp->w] &= ~fp->mask;
> +        }
> +        cpu->env.forced_features[fp->w] &= ~fp->mask;
> +        cpu->env.user_features[fp->w] |= fp->mask;
> +    break;
> +    case QTYPE_QSTRING:
> +        switch (value->u.q_enum) {
> +        case CPU_FEATURE_SETTING_ENUM_FORCE:
> +            cpu->env.features[fp->w] |= fp->mask;
> +            cpu->env.forced_features[fp->w] |= fp->mask;
> +        break;
> +        default:
> +            error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name,
> +                       "CPUFeatureSetting");
> +        }
> +    break;
> +    default:
> +        error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name,
> +                   "CPUFeatureSetting");
>      }
> -    cpu->env.user_features[fp->w] |= fp->mask;
that's the only place it was set and then used by x86_cpu_expand_features()
Is it correct to remove setter?


> +
> +    qapi_free_CPUFeatureSetting(value);
>  }
>  
>  static void x86_cpu_release_bit_prop(Object *obj, const char *name,

  parent reply	other threads:[~2017-05-04  9:49 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-02 20:31 [Qemu-devel] [PATCH 0/4] x86: Support "-cpu feature=force" Eduardo Habkost
2017-05-02 20:31 ` [Qemu-devel] [PATCH 1/4] visitor: Add 'supported_qtypes' parameter to visit_start_alternate() Eduardo Habkost
2017-05-02 21:29   ` Eric Blake
2017-05-02 22:35     ` Eduardo Habkost
2017-05-03 15:41       ` Markus Armbruster
2017-05-02 20:31 ` [Qemu-devel] [PATCH 2/4] string-input-visitor: Support alternate types Eduardo Habkost
2017-05-02 21:37   ` Eric Blake
2017-05-02 22:51     ` Eduardo Habkost
2017-05-03 16:07   ` Markus Armbruster
2017-05-03 18:30     ` Eduardo Habkost
2017-05-04  8:06       ` Markus Armbruster
2017-05-04 13:23         ` Eric Blake
2017-05-04 13:42           ` Markus Armbruster
2017-05-04 14:10             ` Eduardo Habkost
2017-05-04 19:42               ` Eduardo Habkost
2017-05-04 20:03                 ` Eric Blake
2017-05-04 20:18                   ` Eduardo Habkost
2017-05-05  6:26                     ` Markus Armbruster
2017-05-02 20:31 ` [Qemu-devel] [PATCH 3/4] tests: Add [+-]feature and feature=on|off test cases Eduardo Habkost
2017-05-02 20:31 ` [Qemu-devel] [PATCH 4/4] x86: Support feature=force on the command-line Eduardo Habkost
2017-05-02 20:43   ` [Qemu-devel] [PATCH] fixup! tests: Add [+-]feature and feature=on|off test cases Eduardo Habkost
2017-05-02 21:42   ` [Qemu-devel] [PATCH 4/4] x86: Support feature=force on the command-line Eric Blake
2017-05-02 22:51     ` Eduardo Habkost
2017-05-04  9:49   ` Igor Mammedov [this message]
2017-05-05 17:21     ` Eduardo Habkost
2017-05-04 10:16   ` Kashyap Chamarthy
2017-05-05 17:59     ` Eduardo Habkost
2017-05-08 10:56       ` Kashyap Chamarthy
2017-05-02 20:46 ` [Qemu-devel] [PATCH 0/4] x86: Support "-cpu feature=force" no-reply
2017-05-02 21:01   ` Eduardo Habkost
2017-05-02 20:47 ` no-reply

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=20170504114938.3c58ebf0@nial.brq.redhat.com \
    --to=imammedo@redhat.com \
    --cc=agraf@suse.de \
    --cc=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.