From: Eric Blake <eblake@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>, qemu-devel@nongnu.org
Cc: Alexander Graf <agraf@suse.de>,
Richard Henderson <rth@twiddle.net>,
Paolo Bonzini <pbonzini@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
Igor Mammedov <imammedo@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: Tue, 2 May 2017 16:42:02 -0500 [thread overview]
Message-ID: <27580102-61c1-63e2-bf97-1e86cb1aaf25@redhat.com> (raw)
In-Reply-To: <20170502203115.22233-5-ehabkost@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 3159 bytes --]
On 05/02/2017 03:31 PM, Eduardo Habkost wrote:
> Introduce a new CPUFeatureSetting QAPI data type, and use it to support
> feature=force on -cpu.
>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> qapi-schema.json | 32 +++++++++++++++++++++++++
> target/i386/cpu.h | 2 ++
> target/i386/cpu.c | 55 +++++++++++++++++++++++++++++++++----------
> tests/test-x86-cpuid-compat.c | 14 ++++++++++-
> 4 files changed, 90 insertions(+), 13 deletions(-)
>
> diff --git a/qapi-schema.json b/qapi-schema.json
> index 01b087fa16..d716409114 100644
> --- a/qapi-schema.json
> +++ b/qapi-schema.json
> @@ -4250,6 +4250,38 @@
> { 'command': 'query-machines', 'returns': ['MachineInfo'] }
>
> ##
> +# @CPUFeatureSettingEnum:
> +#
> +# Additional valid values for a CPUFeatureSetting property.
> +#
> +# @force: Force feature to be enabled, even if the accelerator
> +# reports the feature as unavailable. Should be used only
> +# for testing or debugging purposes.
> +#
> +# Since: 2.10
> +##
> +{ 'enum': 'CPUFeatureSettingEnum',
> + 'data': ['force'] }
> +
> +##
> +# @CPUFeatureSetting:
> +#
> +# Values for a CPU feature property.
> +#
> +# @bool: If false, the feature is forcibly disabled.
> +# If true, QEMU will try to enable the feature. QEMU will
> +# refuse to start if the feature is unavailable and
> +# 'enforce' mode is enabled in the CPU.
> +#
> +# @enum: See @CPUFeatureSettingEnum.
> +#
> +# Since: 2.10
> +##
> +{ 'alternate': 'CPUFeatureSetting',
> + 'data': { 'bool': 'bool',
> + 'enum': 'CPUFeatureSettingEnum' } }
> +
Looks reasonable; I'm glad the suggestion for using an alternate worked.
> - 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;
Isn't the break supposed to be indented four more spaces?
> + 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;
and again
> + default:
> + error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name,
> + "CPUFeatureSetting");
> + }
> + break;
and again
> + default:
> + error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name,
> + "CPUFeatureSetting");
> }
> - cpu->env.user_features[fp->w] |= fp->mask;
> +
> + qapi_free_CPUFeatureSetting(value);
> }
>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2017-05-02 21:42 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 ` Eric Blake [this message]
2017-05-02 22:51 ` [Qemu-devel] [PATCH 4/4] x86: Support feature=force on the command-line Eduardo Habkost
2017-05-04 9:49 ` Igor Mammedov
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=27580102-61c1-63e2-bf97-1e86cb1aaf25@redhat.com \
--to=eblake@redhat.com \
--cc=agraf@suse.de \
--cc=armbru@redhat.com \
--cc=ehabkost@redhat.com \
--cc=imammedo@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 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).