The `device_vmstate_reset` can be added by device specialization, as vmsd subsection, to migrate the reset related device state part.
Signed-off-by: Damien Hedde <damien.he...@greensocs.com> --- hw/core/Makefile.objs | 1 + hw/core/qdev-vmstate.c | 25 +++++++++++++++++++++++++ include/hw/qdev-core.h | 6 ++++++ 3 files changed, 32 insertions(+) create mode 100644 hw/core/qdev-vmstate.c diff --git a/hw/core/Makefile.objs b/hw/core/Makefile.objs index 320f71707c..562cf1034e 100644 --- a/hw/core/Makefile.objs +++ b/hw/core/Makefile.objs @@ -5,6 +5,7 @@ common-obj-y += resettable.o common-obj-y += reset-domain.o common-obj-$(CONFIG_SOFTMMU) += qdev-fw.o common-obj-$(CONFIG_SOFTMMU) += fw-path-provider.o +common-obj-$(CONFIG_SOFTMMU) += qdev-vmstate.o # irq.o needed for qdev GPIO handling: common-obj-y += irq.o common-obj-y += hotplug.o diff --git a/hw/core/qdev-vmstate.c b/hw/core/qdev-vmstate.c new file mode 100644 index 0000000000..a9834f1a1c --- /dev/null +++ b/hw/core/qdev-vmstate.c @@ -0,0 +1,25 @@ +/* + * Device vmstate + * + * Copyright (c) 2019 GreenSocs + * + * Authors: + * Damien Hedde + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "hw/qdev.h" +#include "migration/vmstate.h" + +const struct VMStateDescription device_vmstate_reset = { + .name = "device_reset", + .version_id = 0, + .minimum_version_id = 0, + .fields = (VMStateField[]) { + VMSTATE_UINT32(resetting, DeviceState), + VMSTATE_END_OF_LIST() + } +}; diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 0ef4d6c920..baad2e7066 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -500,4 +500,10 @@ static inline bool qbus_is_hotpluggable(BusState *bus) void device_listener_register(DeviceListener *listener); void device_listener_unregister(DeviceListener *listener); +/** + * device_vmstate_reset: + * vmstate entry for reset related state + */ +extern const struct VMStateDescription device_vmstate_reset; + #endif -- 2.21.0