On 4/26/21 6:15 PM, Dr. David Alan Gilbert wrote:
> * Philippe Mathieu-Daudé ([email protected]) 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é <[email protected]>
>> ---
>> 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) {