qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH RFC qom-cpu-next 2/6] target-i386: Update VMStat


From: Andreas Färber
Subject: Re: [Qemu-devel] [PATCH RFC qom-cpu-next 2/6] target-i386: Update VMStateDescription to X86CPU
Date: Thu, 07 Feb 2013 19:20:33 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130105 Thunderbird/17.0.2

Am 07.02.2013 17:55, schrieb Eduardo Habkost:
> On Sat, Feb 02, 2013 at 04:04:12PM +0100, Andreas Färber wrote:
>> Expose vmstate_cpu as vmstate_x86_cpu and hook it up to CPUClass::vmsd.
>> Adapt opaques and VMState fields to X86CPU. Drop cpu_{save,load}().
>>
>> Signed-off-by: Andreas Färber <address@hidden>
>> ---
>>  target-i386/cpu-qom.h |    2 +
>>  target-i386/cpu.c     |    4 +
>>  target-i386/cpu.h     |    2 -
>>  target-i386/machine.c |  215 
>> ++++++++++++++++++++++++-------------------------
>>  4 Dateien geändert, 113 Zeilen hinzugefügt(+), 110 Zeilen entfernt(-)
>>
>> diff --git a/target-i386/cpu-qom.h b/target-i386/cpu-qom.h
>> index 48e6b54..4a1e32b 100644
>> --- a/target-i386/cpu-qom.h
>> +++ b/target-i386/cpu-qom.h
>> @@ -74,5 +74,7 @@ static inline X86CPU *x86_env_get_cpu(CPUX86State *env)
>>  
>>  #define ENV_GET_CPU(e) CPU(x86_env_get_cpu(e))
>>  
>> +extern const struct VMStateDescription vmstate_x86_cpu;
>> +
>>  
>>  #endif
>> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
>> index ea0ce0b..307fc81 100644
>> --- a/target-i386/cpu.c
>> +++ b/target-i386/cpu.c
>> @@ -2214,6 +2214,10 @@ static void x86_cpu_common_class_init(ObjectClass 
>> *oc, void *data)
>>  
>>      xcc->parent_reset = cc->reset;
>>      cc->reset = x86_cpu_reset;
>> +
>> +#ifndef CONFIG_USER_ONLY
>> +    cc->vmsd = &vmstate_x86_cpu;
>> +#endif
> 
> What about:
> 
> cpu-qom.h:
> 
>   #ifdef CONFIG_USER_ONLY
>   extern const struct VMStateDescription vmstate_x86_cpu;
>   #define x86_cpu_vmsd (&vmstate_x86_cpu)
>   #else
>   #define x86_cpu_vmsd NULL
>   #endif
> 
> cpu.c:
> 
>   /* without #ifdef: */
>   cc->vmsd = x86_cpu_vmsd;

Personally I find my #ifdef'ed code with the &vmstate_... easier to
understand, but I'll wait for more opinions.

Thanks for your review,

Andreas

> The rest looks good (I confirmed that all the VMSTATE_*() lines changed
> below are mechanical changes from CPUX86State.field to
> X86CPU.env.field). So:
> 
> Reviewed-by: Eduardo Habkost <address@hidden>
> 
> 
>>  }
>>  
>>  static const TypeInfo x86_cpu_type_info = {
>> diff --git a/target-i386/cpu.h b/target-i386/cpu.h
>> index 9e6e1a6..2019f2b 100644
>> --- a/target-i386/cpu.h
>> +++ b/target-i386/cpu.h
>> @@ -1082,8 +1082,6 @@ static inline CPUX86State *cpu_init(const char 
>> *cpu_model)
>>  #define cpu_list x86_cpu_list
>>  #define cpudef_setup        x86_cpudef_setup
>>  
>> -#define CPU_SAVE_VERSION 12
>> -
>>  /* MMU modes definitions */
>>  #define MMU_MODE0_SUFFIX _kernel
>>  #define MMU_MODE1_SUFFIX _user
[snip]


-- 
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]