qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 0/3] Move CPU model definitions to C


From: Andreas Färber
Subject: Re: [Qemu-devel] [PATCH 0/3] Move CPU model definitions to C
Date: Wed, 01 Aug 2012 22:04:50 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120713 Thunderbird/14.0

Am 01.08.2012 20:45, schrieb Eduardo Habkost:
> This makes the change we discussed on the latest KVM conf call[1], moving the
> existing cpudefs from cpus-x86_64.conf to the C code.
> 
> The config file data was converted to C using a script, available at:
> https://gist.github.com/3229602
> 
> Except by the extra square brackets around the CPU model names (indicating 
> they
> are built-in models), the output of "-cpu ?dump" is exactly the same before 
> and
> after applying this series.
> 
> [1] http://article.gmane.org/gmane.comp.emulators.kvm.devel/95328
> 
> Eduardo Habkost (3):
>   i386: add missing CPUID_* constants
>   move CPU models from cpus-x86_64.conf to C
>   eliminate cpus-x86_64.conf file

If we do this, we will need to refactor the C code again for CPU
subclasses. Can't we (you) do that in one go then? :-)

I thought there was a broad consensus not to go my declarative
X86CPUInfo way but to initialize CPUs imperatively as done for ARM.
That would mean transforming your

+    {
+        .family = 6,
+        .model = 2,
...

into an initfn doing

-    {
+static void conroe_initfn(Object *obj)
+{
+    X86CPU *cpu = X86_CPU(obj);
+    CPUX86State *env = &cpu->env;
+
-        .family = 6,
+    env->family = 6;
-        .model = 2,
+    env->model = 2;
...

or so (not all being as nicely aligned).

Unfortunately the move of the CPU definitions from config file to C does
not eliminate the issue that users can still specify CPU models in their
own config files or from the command line, right? Doesn't that mean that
either we need to keep all CPU definitions declarative as done here and
live with any field duplication between X86CPUInfo and X86CPUClass, or
have a special intermediate subclass UserX86CPUClass with such fields
for user-specified -cpudef models?
Assuming, dropping -cpudef for 1.2 is still not an option.

Regards,
Andreas

> 
>  Makefile                           |   1 -
>  arch_init.c                        |   1 -
>  sysconfigs/target/cpus-x86_64.conf | 128 ----------------------
>  target-i386/cpu.c                  | 219 
> +++++++++++++++++++++++++++++++++++++
>  target-i386/cpu.h                  |  22 ++++
>  5 files changed, 241 insertions(+), 130 deletions(-)
>  delete mode 100644 sysconfigs/target/cpus-x86_64.conf
> 


-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg



reply via email to

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