From: Paolo Bonzini <pbonzini@redhat.com>
To: Alexander Graf <agraf@suse.de>, Eduardo Habkost <ehabkost@redhat.com>
Cc: qemu-devel@nongnu.org, Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH] i386: Allow cpuid bit override
Date: Tue, 28 Mar 2017 14:41:55 +0200 [thread overview]
Message-ID: <39d88a40-727b-81e9-0577-27198457304e@redhat.com> (raw)
In-Reply-To: <9d85e056-3331-9815-404b-9557ca5028cc@suse.de>
On 28/03/2017 13:26, Alexander Graf wrote:
>> You can define an enum type in qapi-schema.json, and use
>> visit_type_<YourEnumType>(). You can grep for
>> visit_type_OnOffAuto to find examples.
>>
>> (But I suggest naming the enum something like
>> "X86CPUFeatureSetting" instead of "OnOffForce", because we will
>> probably add other enum values in the future).
>>
>> However: we need to find a way to do this and not break
>> compatibility with "feat=yes|true|no|false", that's supported by
>> StringInputVisitor (which is used by object_property_parse()).
>> Maybe fallback to visit_type_bool() in case
>> visit_type_<YourEnumType>() fails?
>
> Putting it into a special enum sounds much more fragile than the current
> solution to me. We need to bool fallback either way, so I fail to see
> any benefit from having the enum.
Using an on/off/force enum sounds like the right thing to do.
However, I would open code the getters and setters completely (using
visit_type_str) instead of using visit_type_FooEnum+visit_type_bool.
Then you can easily map yes/true to on and no/false to off.
Paolo
next prev parent reply other threads:[~2017-03-28 12:42 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-27 22:19 [Qemu-devel] [PATCH] i386: Allow cpuid bit override Alexander Graf
2017-03-28 0:41 ` Eduardo Habkost
2017-03-28 11:26 ` Alexander Graf
2017-03-28 12:31 ` Eduardo Habkost
2017-03-28 12:35 ` Alexander Graf
2017-03-30 14:22 ` Eduardo Habkost
2017-03-30 14:23 ` Alexander Graf
2017-03-30 14:25 ` Eduardo Habkost
2017-03-30 14:27 ` Alexander Graf
2017-04-13 17:20 ` Eduardo Habkost
2017-03-28 12:41 ` Paolo Bonzini [this message]
2017-03-28 16:01 ` Eduardo Habkost
2017-03-28 16:35 ` Paolo Bonzini
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=39d88a40-727b-81e9-0577-27198457304e@redhat.com \
--to=pbonzini@redhat.com \
--cc=agraf@suse.de \
--cc=ehabkost@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).