qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 00/15] QOM'ify x86 CPU, part 2: properties


From: Eduardo Habkost
Subject: Re: [Qemu-devel] [PATCH 00/15] QOM'ify x86 CPU, part 2: properties
Date: Thu, 19 Apr 2012 15:27:40 -0300
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Apr 18, 2012 at 01:11:04AM +0200, Andreas Färber wrote:
> Hello,
> 
> This series introduces some QOM properties for X86CPU, so that our built-in
> init code exercises the same code paths as QMP, as suggested by Eduardo:
> * "family",
> * "model",
> * "stepping" and
> * "model-id" (rather than "model_id")
> This QOM'ifies my previously introduced helper functions, adding getters.
> 
> In the same spirit I've also introduced numeric QOM properties for:
> * "level"
> * "xlevel"
> * "tsc-frequency" (rather than "tsc_freq")
> Being uint32_t, "level" and "xlevel" would benefit from fixed-width visitors,
> as introduced in Michael's series. It seems his v4 was neither applied
> nor commented on and only some parts were integrated into Paolo's large
> rush-rush series... Would be nice to see Michael's full series merged soon!
> 
> Further I've prepared one QOM property that's currently unused:
> * "vendor" (converting three words to string and back seemed too much 
> overhead)
> 
> By constrast, the HyperV -cpu property "hv_spinlocks" and flags "hv_relaxed"
> and "hv_vapic" do not seem to be per-CPU properties.
> 
> Note that these properties are still somewhat orthogonal to the feature flags
> that Jinsong and Jan were discussing for machine compatibility IIUC. I'm 
> hoping
> that some x86 guru can come up with a sensible follow-up for that. :-)
> Maybe bool properties per feature on an as-needed basis?

bool properties for features are surely a good idea, instead of the
current interface that's based on a long space-separated string of
feature flag names. Some features may simply not be feature bits on
leafs 1 or 80000001h, but new behavior that's enabled/disabled and
visible on other CPUID leafs (e.g. the vPMU feature).

It would also make it easier to allow definition of cpudefs that are
based on existing ones, with just a few differences.  Something like:

[cpudef]
name=Westmere-1.0
feature_foo=true
feature_bar=true
# [...] long list of features

[cpudef]
name=Westmere-1.1
base=Westmere-1.0
feature_vpmu=true


On the other hand, this looks like a good improvement for the definition
of cpudef objects, not CPU objects. CPU objects themselves could still
have a more low-level interface, if the interface to define cpudefs is
simpler and more flexible.

By the way, do you still plan to make cpudefs register new
classes/types? I remember that you did that on a previous series.

Is it possible to have property get/setters for ObjectClass QOM objects,
too? It would be interesting to use QOM properties for the cpudef fields
as well (it would make the work of defining boolean feature fields much
simpler).


> 
> Available from:
> git://github.com/afaerber/qemu-cpu.git qom-cpu-x86-prop.v1
> https://github.com/afaerber/qemu-cpu/commits/qom-cpu-x86-prop.v1


Reviewed-by: Eduardo Habkost <address@hidden>


> 
> Regards,
> Andreas
> 
> Cc: Anthony Liguori <address@hidden>
> Cc: Jan Kiszka <address@hidden>
> Cc: Igor Mammedov <address@hidden>
> Cc: Liu Jinsong <address@hidden>
> Cc: Lai Jiangshan <address@hidden>
> Cc: Vasilis Liaskovitis <address@hidden>
> Cc: Eduardo Habkost <address@hidden>
> Cc: Michael Roth <address@hidden>
> Cc: Paolo Bonzini <address@hidden>
> Cc: Vadim Rozenfeld <address@hidden>
> 
> Andreas Färber (15):
>   target-i386: Fix x86_cpuid_set_model_id()
>   target-i386: Pass X86CPU to cpu_x86_register()
>   target-i386: Add range check for -cpu ,family=x
>   target-i386: Add "family" property to X86CPU
>   target-i386: Add "model" property to X86CPU
>   target-i386: Add "stepping" property to X86CPU
>   target-i386: Add "model-id" property to X86CPU
>   target-i386: Add property getter for CPU family
>   target-i386: Add property getter for CPU model
>   target-i386: Add property getter for CPU stepping
>   target-i386: Add property getter for CPU model-id
>   target-i386: Introduce "level" property for X86CPU
>   target-i386: Introduce "xlevel" property for X86CPU
>   target-i386: Prepare "vendor" property for X86CPU
>   target-i386: Introduce "tsc-frequency" property for X86CPU
> 
>  target-i386/cpu.c    |  319 
> +++++++++++++++++++++++++++++++++++++++++++++++---
>  target-i386/cpu.h    |    2 +-
>  target-i386/helper.c |    2 +-
>  3 files changed, 303 insertions(+), 20 deletions(-)
> 
> -- 
> 1.7.7
> 

-- 
Eduardo



reply via email to

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