@@ -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
new file mode 100644
@@ -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()
+ }
+};
@@ -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
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.hedde@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