qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 6/7] target-i386: add implementation of query-cp


From: Eduardo Habkost
Subject: Re: [Qemu-devel] [PATCH 6/7] target-i386: add implementation of query-cpudefs
Date: Tue, 31 Jul 2012 12:57:43 -0300
User-agent: Mutt/1.5.21 (2010-09-15)

On Fri, Jul 27, 2012 at 08:37:18AM -0500, Anthony Liguori wrote:
> Signed-off-by: Anthony Liguori <address@hidden>
> ---
>  target-i386/cpu.c |   22 ++++++++++++++++++++++
>  1 files changed, 22 insertions(+), 0 deletions(-)
> 
> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> index 6b9659f..b398439 100644
> --- a/target-i386/cpu.c
> +++ b/target-i386/cpu.c
> @@ -28,6 +28,7 @@
>  #include "qemu-config.h"
>  
>  #include "qapi/qapi-visit-core.h"
> +#include "qmp-commands.h"
>  
>  #include "hyperv.h"
>  
> @@ -1123,6 +1124,27 @@ void x86_cpu_list(FILE *f, fprintf_function 
> cpu_fprintf, const char *optarg)
>      }
>  }
>  
> +CpuDefInfoList *qmp_query_cpudefs(Error **errp)
> +{
> +    CpuDefInfoList *cpu_list = NULL;
> +    x86_def_t *def;
> +
> +    for (def = x86_defs; def; def = def->next) {
> +        CpuDefInfoList *entry;
> +        CpuDefInfo *info;
> +
> +        info = g_malloc0(sizeof(*info));
> +        info->name = g_strdup(def->name);
> +
> +        entry = g_malloc0(sizeof(*entry));
> +        entry->value = info;
> +        entry->next = cpu_list;
> +        cpu_list = entry;
> +    }
> +
> +    return cpu_list;
> +}

How would the interface look like once we:
- let libvirt know which features are available on each CPU model
  (libvirt needs that information[1]); and
- add machine-type-specific cpudef compatibility changes?

Would the command report different results depending on -machine?

Would the command return the latest cpudef without any machine-type
hacks, and libvirt would have to query for the cpudef compatibility data
for each machine-type and combine both pieces of information itself?

[1] Note that it doesn't have to be low-level leaf-by-leaf
    register-by-register CPUID bits (I prefer a more high-level
    interface, myself), but it has to at least say "feature FOO is
    enabled/disabled" for a set of features libvirt cares about.

-- 
Eduardo



reply via email to

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