qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 4/9] target-i386: convert 'hv_relaxed' to static


From: Eduardo Habkost
Subject: Re: [Qemu-devel] [PATCH 4/9] target-i386: convert 'hv_relaxed' to static property
Date: Tue, 19 Feb 2013 17:44:21 -0300
User-agent: Mutt/1.5.21 (2010-09-15)

On Tue, Feb 19, 2013 at 09:19:18PM +0100, Andreas Färber wrote:
> Am 19.02.2013 19:45, schrieb Eduardo Habkost:
> > On Mon, Feb 11, 2013 at 05:35:06PM +0100, Igor Mammedov wrote:
[...]
> >> +static void x86_get_hv_relaxed(Object *obj, Visitor *v, void *opaque,
> >> +                                 const char *name, Error **errp)
> >> +{
> >> +    bool value = hyperv_relaxed_timing_enabled();
> >> +
> >> +    visit_type_bool(v, &value, name, errp);
> >> +}
> >> +
> >> +static void x86_set_hv_relaxed(Object *obj, Visitor *v, void *opaque,
> >> +                                 const char *name, Error **errp)
> >> +{
> >> +    bool value;
> >> +
> >> +    visit_type_bool(v, &value, name, errp);
> >> +    if (error_is_set(errp)) {
> >> +        return;
> >> +    }
> >> +    hyperv_enable_relaxed_timing(value);
> >> +}
> >> +
> >> +PropertyInfo qdev_prop_hv_relaxed = {
> >> +    .name  = "boolean",
> >> +    .get   = x86_get_hv_relaxed,
> >> +    .set   = x86_set_hv_relaxed,
> >> +};
> >> +#define DEFINE_PROP_HV_RELAXED(_n, _defval) {                             
> >>      \
> >> +    .name  = _n,                                                          
> >>      \
> >> +    .info  = &qdev_prop_hv_relaxed,                                       
> >>      \
> >> +    .qtype = QTYPE_QBOOL,                                                 
> >>      \
> >> +    .defval = _defval                                                     
> >>      \
> >> +}
> >> +
> >>  static Property cpu_x86_properties[] = {
> >>      DEFINE_PROP_FAMILY("family"),
> >>      DEFINE_PROP_MODEL("model"),
> >> @@ -538,6 +570,7 @@ static Property cpu_x86_properties[] = {
> >>      DEFINE_PROP_MODEL_ID("model-id"),
> >>      DEFINE_PROP_TSC_FREQ("tsc-frequency"),
> >>      DEFINE_PROP_HV_SPINLOCKS("hv-spinlocks", HYPERV_SPINLOCK_NEVER_RETRY),
> >> +    DEFINE_PROP_HV_RELAXED("hv-relaxed", false),
> > 
> > Why not simply make it a X86CPU struct field, so we don't need a special
> > PropertyInfo?
> > 
> > The whole contents of target-i386/hyperv.c are getters/setters for three
> > static variables that should have been X86CPU fields in the first place.
> 
> Note that I intentionally did not make them properties because of that.
> If the setting is not per CPU, it should not be set through X86CPU.
> I don't know whether it would make sense to make these tunable per CPU?

All the getters from hyperv.c are only used when building the CPUID
tables for a specific CPU, so they can (and should) be handled like
every other CPUID-related field from X86CPU.

-- 
Eduardo



reply via email to

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