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: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH] i386: Allow cpuid bit override
Date: Tue, 28 Mar 2017 14:41:55 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0


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



reply via email to

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