qemu-ppc
[Top][All Lists]
Advanced

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

Re: [PATCH v6 06/18] cpu: Assert DeviceClass::vmsd is NULL on user emula


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v6 06/18] cpu: Assert DeviceClass::vmsd is NULL on user emulation
Date: Mon, 26 Apr 2021 18:50:59 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1

On 4/26/21 6:15 PM, Dr. David Alan Gilbert wrote:
> * Philippe Mathieu-Daudé (f4bug@amsat.org) wrote:
>> Migration is specific to system emulation.
>>
>> Restrict current DeviceClass::vmsd to sysemu using #ifdef'ry,
>> and assert in cpu_exec_realizefn() that dc->vmsd not set under
>> user emulation.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>>  cpu.c                  | 1 +
>>  target/sh4/cpu.c       | 5 +++--
>>  target/unicore32/cpu.c | 4 ++++
>>  target/xtensa/cpu.c    | 4 +++-
>>  4 files changed, 11 insertions(+), 3 deletions(-)
>>
>> diff --git a/cpu.c b/cpu.c
>> index bfbe5a66f95..4fed04219df 100644
>> --- a/cpu.c
>> +++ b/cpu.c
>> @@ -138,6 +138,7 @@ void cpu_exec_realizefn(CPUState *cpu, Error **errp)
>>  #endif /* CONFIG_TCG */
>>  
>>  #ifdef CONFIG_USER_ONLY
>> +    assert(qdev_get_vmsd(DEVICE(cpu)) == NULL);
> 
> Why not make that:
>    assert(qdev_get_vmsd(DEVICE(cpu)) == NULL ||
>           qdev_get_vmsd(DEVICE(cpu)->unmigratable)
> 
> then you don't have to worry about the changes below.

Thanks for the tip! For my defense the VMStateDescription
fields aren't documented at all ;)

> 
> Dave
> 
>>      assert(cc->vmsd == NULL);
>>  #else
>>      if (qdev_get_vmsd(DEVICE(cpu)) == NULL) {



reply via email to

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