[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) {
- [PATCH v6 00/18] cpu: Introduce SysemuCPUOps structure, Philippe Mathieu-Daudé, 2021/04/22
- [PATCH v6 01/18] cpu: Un-inline cpu_get_phys_page_debug and cpu_asidx_from_attrs, Philippe Mathieu-Daudé, 2021/04/22
- [PATCH v6 02/18] cpu: Introduce cpu_virtio_is_big_endian(), Philippe Mathieu-Daudé, 2021/04/22
- [PATCH v6 03/18] cpu: Directly use cpu_write_elf*() fallback handlers in place, Philippe Mathieu-Daudé, 2021/04/22
- [PATCH v6 04/18] cpu: Directly use get_paging_enabled() fallback handlers in place, Philippe Mathieu-Daudé, 2021/04/22
- [PATCH v6 05/18] cpu: Directly use get_memory_mapping() fallback handlers in place, Philippe Mathieu-Daudé, 2021/04/22
- [PATCH v6 06/18] cpu: Assert DeviceClass::vmsd is NULL on user emulation, Philippe Mathieu-Daudé, 2021/04/22
- [PATCH v6 07/18] cpu: Rename CPUClass vmsd -> legacy_vmsd, Philippe Mathieu-Daudé, 2021/04/22
- [PATCH v6 08/18] cpu/{avr, lm32, moxie}: Set DeviceClass vmsd field (not CPUClass one), Philippe Mathieu-Daudé, 2021/04/22
- [PATCH v6 09/18] cpu: Introduce SysemuCPUOps structure, Philippe Mathieu-Daudé, 2021/04/22
- [PATCH v6 10/18] cpu: Move CPUClass::vmsd to SysemuCPUOps, Philippe Mathieu-Daudé, 2021/04/22
- [PATCH v6 11/18] cpu: Move CPUClass::virtio_is_big_endian to SysemuCPUOps, Philippe Mathieu-Daudé, 2021/04/22
- [PATCH v6 12/18] cpu: Move CPUClass::get_crash_info to SysemuCPUOps, Philippe Mathieu-Daudé, 2021/04/22
- [PATCH v6 13/18] cpu: Move CPUClass::write_elf* to SysemuCPUOps, Philippe Mathieu-Daudé, 2021/04/22