qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] i386: Allow cpuid bit override


From: Eduardo Habkost
Subject: Re: [Qemu-devel] [PATCH] i386: Allow cpuid bit override
Date: Tue, 28 Mar 2017 13:01:19 -0300
User-agent: Mutt/1.7.1 (2016-10-04)

On Tue, Mar 28, 2017 at 02:41:55PM +0200, Paolo Bonzini wrote:
> 
> 
> 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.

I am wondering if it isn't simpler to define the enum to be
(on, off, force, yes, true, no, false), and document
(yes, true, no, false) as deprecated.

-- 
Eduardo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]