Skip to contentSkip to conversation

hw: Mark the device with no migratable fields

RFC PATCH In review Philippe Mathieu-Daudé 6 participants 32 messages Jan 17, 2021 – Jan 26, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover hw: Mark the device with no migratable fields

Since v1:
- Tried to address Dave and Daniel comments
- Added Peter R-b
- Handle GPEX device

This is a proof-of-concept after chatting with Peter Maydell on IRC last year.

Introduce the vmstate_no_state_to_migrate structure, and a reference to it: vmstate_qdev_no_state_to_migrate. Use this reference in devices with no fields to migrate.

This is useful to catch devices missing vmstate, such:
- ads7846
- mcf-uart
- mcf-fec
- versatile_i2c
- ...

v1: https://www.mail-archive.com/[email protected]/msg719788.html

Philippe Mathieu-Daudé (20):
migration/vmstate: Restrict vmstate_dummy to user-mode hw/core/qdev: Add vmstate_qdev_no_state_to_migrate hw/arm/armv7m: Mark the device with no migratable fields hw/arm/aspeed_soc: Mark the device with no migratable fields hw/arm/bcm283x: Mark devices with no migratable fields hw/arm/msf2-soc: Mark the device with no migratable fields hw/core/split-irq: Mark the device with no migratable fields hw/cpu/a9mpcore: Mark the device with no migratable fields hw/cpu/cluster: Mark the device with no migratable fields hw/usb/hcd-ohci: Mark the device with no migratable fields hw/intc/arm_gicv2m: Mark the device with no migratable fields hw/misc/armsse-cpuid: Mark the device with no migratable fields hw/misc/iotkit-sysinfo: Mark the device with no migratable fields hw/misc/unimp: Mark the device with no migratable fields hw/nubus/mac-nubus-bridge: Mark the device with no migratable fields hw/sparc64/sun4u: Mark devices with no migratable fields hw/pci-host/gpex: Mark device with no migratable fields hw/core/qdev: Display warning for devices missing migration state stubs/vmstate: Add VMSTATE_END_OF_LIST to vmstate_user_mode_cpu_dummy migration/vmstate: Simplify vmstate for user-mode CPU

 configure                    | 10 ++++++++++
 meson.build                  |  1 +
 hw/usb/hcd-ohci.h            |  2 ++
 include/hw/arm/bcm2836.h     |  5 +++--
 include/hw/arm/msf2-soc.h    | 11 ++++++-----
 include/hw/core/cpu.h        |  2 +-
 include/hw/cpu/a9mpcore.h    |  3 ++-
 include/hw/qdev-core.h       |  2 ++
 include/migration/vmstate.h  |  2 +-
 hw/arm/armv7m.c              |  1 +
 hw/arm/aspeed_soc.c          |  1 +
 hw/arm/bcm2835_peripherals.c |  1 +
 hw/arm/bcm2836.c             |  1 +
 hw/arm/msf2-soc.c            |  1 +
 hw/core/qdev.c               |  8 ++++++++
 hw/core/split-irq.c          |  1 +
 hw/cpu/a9mpcore.c            |  1 +
 hw/cpu/cluster.c             |  1 +
 hw/intc/arm_gicv2m.c         |  2 ++
 hw/misc/armsse-cpuid.c       |  1 +
 hw/misc/iotkit-sysinfo.c     |  1 +
 hw/misc/unimp.c              |  1 +
 hw/nubus/mac-nubus-bridge.c  |  1 +
 hw/pci-host/gpex.c           |  1 +
 hw/sparc64/sun4u.c           |  6 +++++-
 hw/usb/hcd-ohci.c            |  1 +
 migration/vmstate.c          |  7 +++++++
 stubs/vmstate.c              |  7 ++++++-
 28 files changed, 70 insertions(+), 12 deletions(-)
Signature · 1 line
2.26.2
#1 lore raw

RFC PATCH v2 1/20 migration/vmstate: Restrict vmstate_dummy to user-mode

'vmstate_dummy' is special and only used for user-mode. Rename it to something more specific.
It was introduced restricted to user-mode in commit c71c3e99b8 ("Add a vmstate_dummy struct for CONFIG_USER_ONLY") but this restriction was later removed in commit 6afc14e92ac ("migration:
Fix warning caused by missing declaration of vmstate_dummy"). Avoid the missing declaration warning by adding a stub for the symbol, and restore the #ifdef'ry.

---
 include/hw/core/cpu.h       | 2 +-
 include/migration/vmstate.h | 4 +++-
 stubs/vmstate.c             | 4 +++-
 3 files changed, 7 insertions(+), 3 deletions(-)
include/hw/core/cpu.h +1 -1
index 140fa32a5e3..c79a58db9b9 100644
@@ -1132,7 +1132,7 @@ bool target_words_bigendian(void);
 #ifdef CONFIG_SOFTMMU
 extern const VMStateDescription vmstate_cpu_common;
 #else
-#define vmstate_cpu_common vmstate_dummy
+#define vmstate_cpu_common vmstate_user_mode_cpu_dummy
 #endif
 
 #define VMSTATE_CPU() {                                                     \
include/migration/vmstate.h +3 -1
index 075ee800960..dda65c9987d 100644
@@ -194,7 +194,9 @@ struct VMStateDescription {
     const VMStateDescription **subsections;
 };
 
-extern const VMStateDescription vmstate_dummy;
+#if defined(CONFIG_USER_ONLY)
+extern const VMStateDescription vmstate_user_mode_cpu_dummy;
+#endif
 
 extern const VMStateInfo vmstate_info_bool;
 
stubs/vmstate.c +3 -1
index cc4fe41dfc2..8da777a1fb4 100644
@@ -1,7 +1,9 @@
 #include "qemu/osdep.h"
 #include "migration/vmstate.h"
 
-const VMStateDescription vmstate_dummy = {};
+#if defined(CONFIG_USER_ONLY)
+const VMStateDescription vmstate_user_mode_cpu_dummy = {};
+#endif
 
 int vmstate_register_with_alias_id(VMStateIf *obj,
                                    uint32_t instance_id,
Signature · 1 line
2.26.2
Reviewed-by on v2 1/20
#2 lore raw

Re: [RFC PATCH v2 01/20] migration/vmstate: Restrict vmstate_dummy to user-mode

Quoted 11 lines · * Philippe Mathieu-Daudé ([email protected]) wrote:

'vmstate_dummy' is special and only used for user-mode. Rename it to something more specific.
It was introduced restricted to user-mode in commit c71c3e99b8 ("Add a vmstate_dummy struct for CONFIG_USER_ONLY") but this restriction was later removed in commit 6afc14e92ac ("migration:
Fix warning caused by missing declaration of vmstate_dummy"). Avoid the missing declaration warning by adding a stub for the symbol, and restore the #ifdef'ry.

Quoted 52 lines
---
 include/hw/core/cpu.h       | 2 +-
 include/migration/vmstate.h | 4 +++-
 stubs/vmstate.c             | 4 +++-
 3 files changed, 7 insertions(+), 3 deletions(-)
include/hw/core/cpu.h +1 -1
index 140fa32a5e3..c79a58db9b9 100644
@@ -1132,7 +1132,7 @@ bool target_words_bigendian(void);
 #ifdef CONFIG_SOFTMMU
 extern const VMStateDescription vmstate_cpu_common;
 #else
-#define vmstate_cpu_common vmstate_dummy
+#define vmstate_cpu_common vmstate_user_mode_cpu_dummy
 #endif
 
 #define VMSTATE_CPU() {                                                     \
include/migration/vmstate.h +3 -1
index 075ee800960..dda65c9987d 100644
@@ -194,7 +194,9 @@ struct VMStateDescription {
     const VMStateDescription **subsections;
 };
 
-extern const VMStateDescription vmstate_dummy;
+#if defined(CONFIG_USER_ONLY)
+extern const VMStateDescription vmstate_user_mode_cpu_dummy;
+#endif
 
 extern const VMStateInfo vmstate_info_bool;
 
stubs/vmstate.c +3 -1
index cc4fe41dfc2..8da777a1fb4 100644
@@ -1,7 +1,9 @@
 #include "qemu/osdep.h"
 #include "migration/vmstate.h"
 
-const VMStateDescription vmstate_dummy = {};
+#if defined(CONFIG_USER_ONLY)
+const VMStateDescription vmstate_user_mode_cpu_dummy = {};
+#endif
 
 int vmstate_register_with_alias_id(VMStateIf *obj,
                                    uint32_t instance_id,
Signature · 1 line
2.26.2
Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK
#3 lore raw

Re: [RFC PATCH v2 01/20] migration/vmstate: Restrict vmstate_dummy to user-mode

In reply to Philippe Mathieu-Daudé
Quoted 9 lines · Philippe Mathieu-Daudé

'vmstate_dummy' is special and only used for user-mode. Rename it to something more specific.
It was introduced restricted to user-mode in commit c71c3e99b8 ("Add a vmstate_dummy struct for CONFIG_USER_ONLY") but this restriction was later removed in commit 6afc14e92ac ("migration:
Fix warning caused by missing declaration of vmstate_dummy"). Avoid the missing declaration warning by adding a stub for the symbol, and restore the #ifdef'ry.

So what is the actual use of vmstate_dummy ? I had a grep through and as far as I can see the points where vmstate_cpu_common is used are all in softmmu-only code. I tried this patch and QEMU seems to compile OK:

include/hw/core/cpu.h +0 -2
index 140fa32a5e3..a827417a4d8 100644
@@ -1131,8 +1131,6 @@ bool target_words_bigendian(void);
 
 #ifdef CONFIG_SOFTMMU
 extern const VMStateDescription vmstate_cpu_common;
-#else
-#define vmstate_cpu_common vmstate_dummy
 #endif
 
 #define VMSTATE_CPU() {                                                     \
include/migration/vmstate.h +0 -2
index 075ee800960..8df7b69f389 100644
@@ -194,8 +194,6 @@ struct VMStateDescription {
     const VMStateDescription **subsections;
 };
 
-extern const VMStateDescription vmstate_dummy;
-
 extern const VMStateInfo vmstate_info_bool;
 
 extern const VMStateInfo vmstate_info_int8;
stubs/vmstate.c +0 -2
index cc4fe41dfc2..8513d9204e4 100644
@@ -1,8 +1,6 @@
 #include "qemu/osdep.h"
 #include "migration/vmstate.h"
 
-const VMStateDescription vmstate_dummy = {};
-
 int vmstate_register_with_alias_id(VMStateIf *obj,
                                    uint32_t instance_id,
                                    const VMStateDescription *vmsd,

thanks
-- PMM

#4 lore raw

Re: [RFC PATCH v2 01/20] migration/vmstate: Restrict vmstate_dummy to user-mode

Quoted 11 lines · Peter Maydell
Quoted 9 lines · Philippe Mathieu-Daudé

'vmstate_dummy' is special and only used for user-mode. Rename it to something more specific.
It was introduced restricted to user-mode in commit c71c3e99b8 ("Add a vmstate_dummy struct for CONFIG_USER_ONLY") but this restriction was later removed in commit 6afc14e92ac ("migration:
Fix warning caused by missing declaration of vmstate_dummy"). Avoid the missing declaration warning by adding a stub for the symbol, and restore the #ifdef'ry.

Quoted 3 lines

So what is the actual use of vmstate_dummy ? I had a grep through and as far as I can see the points where vmstate_cpu_common is used are all in softmmu-only code.

No clue, maybe simply remnant from unfinished work?

Quoted 8 lines

I tried this patch
and QEMU seems to compile OK:

include/hw/core/cpu.h +0 -0
index 140fa32a5e3..a827417a4d8 100644

include/hw/core/cpu.h bool target_words_bigendian(void); · line 1136

Quoted 8 lines
include/hw/core/cpu.h +0 -2
@@ -1131,8 +1131,6 @@ bool target_words_bigendian(void);
 
 #ifdef CONFIG_SOFTMMU
 extern const VMStateDescription vmstate_cpu_common;
-#else
-#define vmstate_cpu_common vmstate_dummy
 #endif
 
 #define VMSTATE_CPU() {                                                     \

Great! Maybe even restricting VMSTATE_CPU() to softmmu-only:

-- >8 --
@@ -1131,9 +1131,6 @@ bool target_words_bigendian(void);

#ifdef CONFIG_SOFTMMU
extern const VMStateDescription vmstate_cpu_common;
-#else
-#define vmstate_cpu_common vmstate_dummy -#endif

 #define VMSTATE_CPU() {
     \
     .name = "parent_obj",
     \
@@ -1142,6 +1139,7 @@ extern const VMStateDescription vmstate_cpu_common;
     .flags = VMS_STRUCT,
     \
     .offset = 0,
     \

}
+#endif

#endif /* NEED_CPU_H */
---

I'll wait if David/Juan have any comment, else respin based on your patch.

Thanks,

Phil.

#5 lore raw

Re: [RFC PATCH v2 01/20] migration/vmstate: Restrict vmstate_dummy to user-mode

Quoted 12 lines · * Philippe Mathieu-Daudé ([email protected]) wrote:
Quoted 11 lines · Peter Maydell
Quoted 9 lines · Philippe Mathieu-Daudé

'vmstate_dummy' is special and only used for user-mode. Rename it to something more specific.
It was introduced restricted to user-mode in commit c71c3e99b8 ("Add a vmstate_dummy struct for CONFIG_USER_ONLY") but this restriction was later removed in commit 6afc14e92ac ("migration:
Fix warning caused by missing declaration of vmstate_dummy"). Avoid the missing declaration warning by adding a stub for the symbol, and restore the #ifdef'ry.

Quoted 5 lines
Quoted 3 lines

So what is the actual use of vmstate_dummy ? I had a grep through and as far as I can see the points where vmstate_cpu_common is used are all in softmmu-only code.

No clue, maybe simply remnant from unfinished work?

Not sure either; but it looks like Paolo fixed some of it up in d9f24bf5724 a few months ago; prior to that cpu_exec_unrealizefn used it even on a USER_ONLY build.

Dave

Quoted 50 lines
Quoted 8 lines

I tried this patch
and QEMU seems to compile OK:

include/hw/core/cpu.h +0 -0
index 140fa32a5e3..a827417a4d8 100644

include/hw/core/cpu.h bool target_words_bigendian(void); · line 1136

Quoted 8 lines
include/hw/core/cpu.h +0 -2
@@ -1131,8 +1131,6 @@ bool target_words_bigendian(void);
 
 #ifdef CONFIG_SOFTMMU
 extern const VMStateDescription vmstate_cpu_common;
-#else
-#define vmstate_cpu_common vmstate_dummy
 #endif
 
 #define VMSTATE_CPU() {                                                     \

Great! Maybe even restricting VMSTATE_CPU() to softmmu-only:

-- >8 --

include/hw/core/cpu.h +0 -3
@@ -1131,9 +1131,6 @@ bool target_words_bigendian(void);
 
 #ifdef CONFIG_SOFTMMU
 extern const VMStateDescription vmstate_cpu_common;
-#else
-#define vmstate_cpu_common vmstate_dummy
-#endif
 
 #define VMSTATE_CPU() {
     \
     .name = "parent_obj",
     \
(quoted diff) +1 -0
@@ -1142,6 +1139,7 @@ extern const VMStateDescription vmstate_cpu_common;
     .flags = VMS_STRUCT,
     \
     .offset = 0,
     \
 }
+#endif
 

#endif /* NEED_CPU_H */
---

I'll wait if David/Juan have any comment, else respin based on your patch.

Thanks,

Phil.

Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK
#6 lore raw

RFC PATCH v2 2/20 hw/core/qdev: Add vmstate_qdev_no_state_to_migrate

In reply to Philippe Mathieu-Daudé

Add vmstate_qdev_no_state_to_migrate, which is simply a pointer to vmstate_no_state_to_migrate. This way all qdev devices (including "hw/qdev-core.h") don't have to include "migration/vmstate.h".

---
Unresolved issues:

https://www.mail-archive.com/[email protected]/msg721695.html
Peter:

Quoted 5 lines

Does this definitely not put any data into the migration stream? We don't want to change what's on the wire for machines that use devices that start using this. (If it does by default, it would be easy to make the migration code special case the magic symbol to act like "no vmsd specified").

https://www.mail-archive.com/[email protected]/msg727634.html
Dave:

Quoted 3 lines

I'd need to test it to be sure, but I think if we added a .needed to vmstate_no_state_to_migrate with a function that always returned false, then I think the stream would stay unchanged.

---
 include/hw/qdev-core.h      | 2 ++
 include/migration/vmstate.h | 1 +
 hw/core/qdev.c              | 3 +++
 migration/vmstate.c         | 7 +++++++
 stubs/vmstate.c             | 7 +++++++
 5 files changed, 20 insertions(+)
include/hw/qdev-core.h +2 -0
index bafc311bfa1..d2c7a46e6a2 100644
@@ -140,6 +140,8 @@ struct DeviceClass {
     const char *bus_type;
 };
 
+extern const VMStateDescription *vmstate_qdev_no_state_to_migrate;
+
 typedef struct NamedGPIOList NamedGPIOList;
 
 struct NamedGPIOList {
include/migration/vmstate.h +1 -0
index dda65c9987d..50559598eac 100644
@@ -197,6 +197,7 @@ struct VMStateDescription {
 #if defined(CONFIG_USER_ONLY)
 extern const VMStateDescription vmstate_user_mode_cpu_dummy;
 #endif
+extern const VMStateDescription vmstate_no_state_to_migrate;
 
 extern const VMStateInfo vmstate_info_bool;
 
hw/core/qdev.c +3 -0
index cefc5eaa0a9..f0d0afd438d 100644
@@ -44,6 +44,9 @@
 static bool qdev_hot_added = false;
 bool qdev_hot_removed = false;
 
+const VMStateDescription *vmstate_qdev_no_state_to_migrate =
+        &vmstate_no_state_to_migrate;
+
 const VMStateDescription *qdev_get_vmsd(DeviceState *dev)
 {
     DeviceClass *dc = DEVICE_GET_CLASS(dev);
migration/vmstate.c +7 -0
index 05f87cdddc5..2c373774dfa 100644
@@ -20,6 +20,13 @@
 #include "qemu/error-report.h"
 #include "trace.h"
 
+const VMStateDescription vmstate_no_state_to_migrate = {
+    .name = "empty-state",
+    .fields = (VMStateField[]) {
+        VMSTATE_END_OF_LIST()
+    }
+};
+
 static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
                                    void *opaque, JSONWriter *vmdesc);
 static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd,
stubs/vmstate.c +7 -0
index 8da777a1fb4..f561f9f39bd 100644
@@ -5,6 +5,13 @@
 const VMStateDescription vmstate_user_mode_cpu_dummy = {};
 #endif
 
+const VMStateDescription vmstate_no_state_to_migrate = {
+    .name = "empty-state",
+    .fields = (VMStateField[]) {
+        VMSTATE_END_OF_LIST()
+    }
+};
+
 int vmstate_register_with_alias_id(VMStateIf *obj,
                                    uint32_t instance_id,
                                    const VMStateDescription *vmsd,
Signature · 1 line
2.26.2
#7 lore raw

Re: [RFC PATCH v2 02/20] hw/core/qdev: Add vmstate_qdev_no_state_to_migrate

Quoted 11 lines · * Philippe Mathieu-Daudé ([email protected]) wrote:

Add vmstate_qdev_no_state_to_migrate, which is simply a pointer to vmstate_no_state_to_migrate. This way all qdev devices (including "hw/qdev-core.h") don't have to include "migration/vmstate.h".

---
Unresolved issues:

https://www.mail-archive.com/[email protected]/msg721695.html
Peter:

Quoted 11 lines
Quoted 5 lines

Does this definitely not put any data into the migration stream? We don't want to change what's on the wire for machines that use devices that start using this. (If it does by default, it would be easy to make the migration code special case the magic symbol to act like "no vmsd specified").

https://www.mail-archive.com/[email protected]/msg727634.html
Dave:

Quoted 3 lines

I'd need to test it to be sure, but I think if we added a .needed to vmstate_no_state_to_migrate with a function that always returned false, then I think the stream would stay unchanged.

Yes I still think you need that; if you only use this for base classes rather than devices themselves you're probably OK; but if you use it on a device I think you'll end up with an empty-state entry in the migration stream.

Dave

Quoted 86 lines
---
 include/hw/qdev-core.h      | 2 ++
 include/migration/vmstate.h | 1 +
 hw/core/qdev.c              | 3 +++
 migration/vmstate.c         | 7 +++++++
 stubs/vmstate.c             | 7 +++++++
 5 files changed, 20 insertions(+)
include/hw/qdev-core.h +2 -0
index bafc311bfa1..d2c7a46e6a2 100644
@@ -140,6 +140,8 @@ struct DeviceClass {
     const char *bus_type;
 };
 
+extern const VMStateDescription *vmstate_qdev_no_state_to_migrate;
+
 typedef struct NamedGPIOList NamedGPIOList;
 
 struct NamedGPIOList {
include/migration/vmstate.h +1 -0
index dda65c9987d..50559598eac 100644
@@ -197,6 +197,7 @@ struct VMStateDescription {
 #if defined(CONFIG_USER_ONLY)
 extern const VMStateDescription vmstate_user_mode_cpu_dummy;
 #endif
+extern const VMStateDescription vmstate_no_state_to_migrate;
 
 extern const VMStateInfo vmstate_info_bool;
 
hw/core/qdev.c +3 -0
index cefc5eaa0a9..f0d0afd438d 100644
@@ -44,6 +44,9 @@
 static bool qdev_hot_added = false;
 bool qdev_hot_removed = false;
 
+const VMStateDescription *vmstate_qdev_no_state_to_migrate =
+        &vmstate_no_state_to_migrate;
+
 const VMStateDescription *qdev_get_vmsd(DeviceState *dev)
 {
     DeviceClass *dc = DEVICE_GET_CLASS(dev);
migration/vmstate.c +7 -0
index 05f87cdddc5..2c373774dfa 100644
@@ -20,6 +20,13 @@
 #include "qemu/error-report.h"
 #include "trace.h"
 
+const VMStateDescription vmstate_no_state_to_migrate = {
+    .name = "empty-state",
+    .fields = (VMStateField[]) {
+        VMSTATE_END_OF_LIST()
+    }
+};
+
 static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
                                    void *opaque, JSONWriter *vmdesc);
 static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd,
stubs/vmstate.c +7 -0
index 8da777a1fb4..f561f9f39bd 100644
@@ -5,6 +5,13 @@
 const VMStateDescription vmstate_user_mode_cpu_dummy = {};
 #endif
 
+const VMStateDescription vmstate_no_state_to_migrate = {
+    .name = "empty-state",
+    .fields = (VMStateField[]) {
+        VMSTATE_END_OF_LIST()
+    }
+};
+
 int vmstate_register_with_alias_id(VMStateIf *obj,
                                    uint32_t instance_id,
                                    const VMStateDescription *vmsd,
Signature · 1 line
2.26.2
Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK
#8 lore raw

Re: [RFC PATCH v2 02/20] hw/core/qdev: Add vmstate_qdev_no_state_to_migrate

In reply to Philippe Mathieu-Daudé
Quoted 18 lines · Philippe Mathieu-Daudé

Add vmstate_qdev_no_state_to_migrate, which is simply a pointer to vmstate_no_state_to_migrate. This way all qdev devices (including "hw/qdev-core.h") don't have to include "migration/vmstate.h".

---
Unresolved issues:

https://www.mail-archive.com/[email protected]/msg721695.html
Peter:

Quoted 5 lines

Does this definitely not put any data into the migration stream? We don't want to change what's on the wire for machines that use devices that start using this. (If it does by default, it would be easy to make the migration code special case the magic symbol to act like "no vmsd specified").

Quoted 6 lines

https://www.mail-archive.com/[email protected]/msg727634.html
Dave:

Quoted 3 lines

I'd need to test it to be sure, but I think if we added a .needed to vmstate_no_state_to_migrate with a function that always returned false, then I think the stream would stay unchanged.

---

It should be easy to test -- just do a 'savevm' of a running system with a machine model that uses one of the devices that has been marked as "no state to migrate", then apply the patchseries, and see if 'loadvm' works or not.

thanks
-- PMM

#9 lore raw

RFC PATCH v2 3/20 hw/arm/armv7m: Mark the device with no migratable fields

In reply to Philippe Mathieu-Daudé

The TYPE_BITBAND device doesn't have fields to migrate. Be explicit by using vmstate_qdev_no_state_to_migrate.

---
v2: Reworded (Peter)

---
 hw/arm/armv7m.c | 1 +
 1 file changed, 1 insertion(+)
hw/arm/armv7m.c +1 -0
index 8224d4ade9f..41ac1b88ab4 100644
@@ -347,6 +347,7 @@ static void bitband_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
 
     dc->realize = bitband_realize;
+    dc->vmsd = vmstate_qdev_no_state_to_migrate;
     device_class_set_props(dc, bitband_properties);
 }
 
Signature · 1 line
2.26.2
#10 lore raw

RFC PATCH v2 4/20 hw/arm/aspeed_soc: Mark the device with no migratable fields

In reply to Philippe Mathieu-Daudé

This device doesn't have fields to migrate. Be explicit by using vmstate_qdev_no_state_to_migrate.

---
 hw/arm/aspeed_soc.c | 1 +
 1 file changed, 1 insertion(+)
hw/arm/aspeed_soc.c +1 -0
index 7eefd54ac07..b503d32fef6 100644
@@ -407,6 +407,7 @@ static void aspeed_soc_class_init(ObjectClass *oc, void *data)
     dc->realize = aspeed_soc_realize;
     /* Reason: Uses serial_hds and nd_table in realize() directly */
     dc->user_creatable = false;
+    dc->vmsd = vmstate_qdev_no_state_to_migrate;
     device_class_set_props(dc, aspeed_soc_properties);
 }
 
Signature · 1 line
2.26.2
#12 lore raw

RFC PATCH v2 5/20 hw/arm/bcm283x: Mark devices with no migratable fields

In reply to Philippe Mathieu-Daudé

These devices don't have fields to migrate. Be explicit by using vmstate_qdev_no_state_to_migrate.

Add a more descriptive comment to keep a clear separation between static property vs runtime changeable.

---
 include/hw/arm/bcm2836.h     | 5 +++--
 hw/arm/bcm2835_peripherals.c | 1 +
 hw/arm/bcm2836.c             | 1 +
 3 files changed, 5 insertions(+), 2 deletions(-)
include/hw/arm/bcm2836.h +3 -2
index 6f90cabfa3a..becb6cfd0a7 100644
@@ -35,13 +35,14 @@ struct BCM283XState {
     DeviceState parent_obj;
     /*< public >*/
 
-    uint32_t enabled_cpus;
-
     struct {
         ARMCPU core;
     } cpu[BCM283X_NCPUS];
     BCM2836ControlState control;
     BCM2835PeripheralState peripherals;
+
+    /* Properties */
+    uint32_t enabled_cpus;
 };
 
 #endif /* BCM2836_H */
hw/arm/bcm2835_peripherals.c +1 -0
index dcff13433e5..8cf85f028fd 100644
@@ -386,6 +386,7 @@ static void bcm2835_peripherals_class_init(ObjectClass *oc, void *data)
     DeviceClass *dc = DEVICE_CLASS(oc);
 
     dc->realize = bcm2835_peripherals_realize;
+    dc->vmsd = vmstate_qdev_no_state_to_migrate;
 }
 
 static const TypeInfo bcm2835_peripherals_type_info = {
hw/arm/bcm2836.c +1 -0
index de7ade2878e..d2de99147cc 100644
@@ -176,6 +176,7 @@ static void bcm283x_class_init(ObjectClass *oc, void *data)
 
     /* Reason: Must be wired up in code (see raspi_init() function) */
     dc->user_creatable = false;
+    dc->vmsd = vmstate_qdev_no_state_to_migrate;
 }
 
 static void bcm2835_class_init(ObjectClass *oc, void *data)
Signature · 1 line
2.26.2
#13 lore raw

RFC PATCH v2 6/20 hw/arm/msf2-soc: Mark the device with no migratable fields

In reply to Philippe Mathieu-Daudé

This device doesn't have fields to migrate. Be explicit by using vmstate_qdev_no_state_to_migrate.

Add a more descriptive comment to keep a clear separation between static property vs runtime changeable.

---
 include/hw/arm/msf2-soc.h | 11 ++++++-----
 hw/arm/msf2-soc.c         |  1 +
 2 files changed, 7 insertions(+), 5 deletions(-)
include/hw/arm/msf2-soc.h +6 -5
index d4061846855..41a328c77f9 100644
@@ -52,6 +52,12 @@ struct MSF2State {
 
     ARMv7MState armv7m;
 
+    MSF2SysregState sysreg;
+    MSSTimerState timer;
+    MSSSpiState spi[MSF2_NUM_SPIS];
+    MSF2EmacState emac;
+
+    /* Properties */
     char *cpu_type;
     char *part_name;
     uint64_t envm_size;
@@ -60,11 +66,6 @@ struct MSF2State {
     uint32_t m3clk;
     uint8_t apb0div;
     uint8_t apb1div;
-
-    MSF2SysregState sysreg;
-    MSSTimerState timer;
-    MSSSpiState spi[MSF2_NUM_SPIS];
-    MSF2EmacState emac;
 };
 
 #endif
hw/arm/msf2-soc.c +1 -0
index d2c29e82d13..2d163710f54 100644
@@ -224,6 +224,7 @@ static void m2sxxx_soc_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
 
     dc->realize = m2sxxx_soc_realize;
+    dc->vmsd = vmstate_qdev_no_state_to_migrate;
     device_class_set_props(dc, m2sxxx_soc_properties);
 }
 
Signature · 1 line
2.26.2
#14 lore raw

RFC PATCH v2 7/20 hw/core/split-irq: Mark the device with no migratable fields

In reply to Philippe Mathieu-Daudé

This device doesn't have fields to migrate. Be explicit by using vmstate_qdev_no_state_to_migrate.

---
 hw/core/split-irq.c | 1 +
 1 file changed, 1 insertion(+)
hw/core/split-irq.c +1 -0
index 3b90af2e8f9..a7072f922cd 100644
@@ -71,6 +71,7 @@ static void split_irq_class_init(ObjectClass *klass, void *data)
     /* No state to reset or migrate */
     device_class_set_props(dc, split_irq_properties);
     dc->realize = split_irq_realize;
+    dc->vmsd = vmstate_qdev_no_state_to_migrate;
 
     /* Reason: Needs to be wired up to work */
     dc->user_creatable = false;
Signature · 1 line
2.26.2
#15 lore raw

RFC PATCH v2 8/20 hw/cpu/a9mpcore: Mark the device with no migratable fields

In reply to Philippe Mathieu-Daudé

This device doesn't have fields to migrate. Be explicit by using vmstate_qdev_no_state_to_migrate.

Add a more descriptive comment to keep a clear separation between static property vs runtime changeable.

---
 include/hw/cpu/a9mpcore.h | 3 ++-
 hw/cpu/a9mpcore.c         | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)
include/hw/cpu/a9mpcore.h +2 -1
index e0396ab6af7..234ac13be2c 100644
@@ -25,10 +25,11 @@ struct A9MPPrivState {
     SysBusDevice parent_obj;
     /*< public >*/
 
+    /* Properties */
     uint32_t num_cpu;
-    MemoryRegion container;
     uint32_t num_irq;
 
+    MemoryRegion container;
     A9SCUState scu;
     GICState gic;
     A9GTimerState gtimer;
hw/cpu/a9mpcore.c +1 -0
index d03f57e579b..2e1d2d46b5b 100644
@@ -175,6 +175,7 @@ static void a9mp_priv_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
 
     dc->realize = a9mp_priv_realize;
+    dc->vmsd = vmstate_qdev_no_state_to_migrate;
     device_class_set_props(dc, a9mp_priv_properties);
 }
 
Signature · 1 line
2.26.2
#16 lore raw

RFC PATCH v2 9/20 hw/cpu/cluster: Mark the device with no migratable fields

In reply to Philippe Mathieu-Daudé

This device doesn't have fields to migrate. Be explicit by using vmstate_qdev_no_state_to_migrate.

---
 hw/cpu/cluster.c | 1 +
 1 file changed, 1 insertion(+)
hw/cpu/cluster.c +1 -0
index e444b7c29d1..95653a643ad 100644
@@ -80,6 +80,7 @@ static void cpu_cluster_class_init(ObjectClass *klass, void *data)
 
     device_class_set_props(dc, cpu_cluster_properties);
     dc->realize = cpu_cluster_realize;
+    dc->vmsd = vmstate_qdev_no_state_to_migrate;
 
     /* This is not directly for users, CPU children must be attached by code */
     dc->user_creatable = false;
Signature · 1 line
2.26.2
#17 lore raw

RFC PATCH v2 10/20 hw/usb/hcd-ohci: Mark the device with no migratable fields

In reply to Philippe Mathieu-Daudé

This device doesn't have fields to migrate. Be explicit by using vmstate_qdev_no_state_to_migrate.

Add a more descriptive comment to keep a clear separation between static property vs runtime changeable.

---
 hw/usb/hcd-ohci.h | 2 ++
 hw/usb/hcd-ohci.c | 1 +
 2 files changed, 3 insertions(+)
hw/usb/hcd-ohci.h +2 -0
index 11ac57058d1..fd4842a352f 100644
@@ -101,6 +101,8 @@ struct OHCISysBusState {
     /*< public >*/
 
     OHCIState ohci;
+
+    /* Properties */
     char *masterbus;
     uint32_t num_ports;
     uint32_t firstport;
hw/usb/hcd-ohci.c +1 -0
index f8c64c8b95b..302aab30992 100644
@@ -2007,6 +2007,7 @@ static void ohci_sysbus_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
 
     dc->realize = ohci_realize_pxa;
+    dc->vmsd = vmstate_qdev_no_state_to_migrate;
     set_bit(DEVICE_CATEGORY_USB, dc->categories);
     dc->desc = "OHCI USB Controller";
     device_class_set_props(dc, ohci_sysbus_properties);
Signature · 1 line
2.26.2
Reviewed-by on v2 10/20
#18 lore raw

Re: [RFC PATCH v2 10/20] hw/usb/hcd-ohci: Mark the device with no migratable fields

Quoted 7 lines · * Philippe Mathieu-Daudé ([email protected]) wrote:

This device doesn't have fields to migrate. Be explicit by using vmstate_qdev_no_state_to_migrate.

Add a more descriptive comment to keep a clear separation between static property vs runtime changeable.

OK,

although I think it's quite interesting; I think we have a base class which has data to migrate which expects any child classes to migrate it's data; so marking it as not actually having any state is not quite right.

Quoted 33 lines
---
 hw/usb/hcd-ohci.h | 2 ++
 hw/usb/hcd-ohci.c | 1 +
 2 files changed, 3 insertions(+)
hw/usb/hcd-ohci.h +2 -0
index 11ac57058d1..fd4842a352f 100644
@@ -101,6 +101,8 @@ struct OHCISysBusState {
     /*< public >*/
 
     OHCIState ohci;
+
+    /* Properties */
     char *masterbus;
     uint32_t num_ports;
     uint32_t firstport;
hw/usb/hcd-ohci.c +1 -0
index f8c64c8b95b..302aab30992 100644
@@ -2007,6 +2007,7 @@ static void ohci_sysbus_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
 
     dc->realize = ohci_realize_pxa;
+    dc->vmsd = vmstate_qdev_no_state_to_migrate;
     set_bit(DEVICE_CATEGORY_USB, dc->categories);
     dc->desc = "OHCI USB Controller";
     device_class_set_props(dc, ohci_sysbus_properties);
Signature · 1 line
2.26.2
Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK
#19 lore raw

RFC PATCH v2 11/20 hw/intc/arm_gicv2m: Mark the device with no migratable fields

In reply to Philippe Mathieu-Daudé

This device doesn't have fields to migrate. Be explicit by using vmstate_qdev_no_state_to_migrate.

Add a more descriptive comment to keep a clear separation between static property vs runtime changeable.

---
 hw/intc/arm_gicv2m.c | 2 ++
 1 file changed, 2 insertions(+)
hw/intc/arm_gicv2m.c +2 -0
index d564b857eba..664cc9fb032 100644
@@ -55,6 +55,7 @@ struct ARMGICv2mState {
     MemoryRegion iomem;
     qemu_irq spi[GICV2M_NUM_SPI_MAX];
 
+    /* Properties */
     uint32_t base_spi;
     uint32_t num_spi;
 };
@@ -182,6 +183,7 @@ static void gicv2m_class_init(ObjectClass *klass, void *data)
 
     device_class_set_props(dc, gicv2m_properties);
     dc->realize = gicv2m_realize;
+    dc->vmsd = vmstate_qdev_no_state_to_migrate;
 }
 
 static const TypeInfo gicv2m_info = {
Signature · 1 line
2.26.2
#20 lore raw

RFC PATCH v2 12/20 hw/misc/armsse-cpuid: Mark the device with no migratable fields

In reply to Philippe Mathieu-Daudé

This device doesn't have fields to migrate. Be explicit by using vmstate_qdev_no_state_to_migrate.

---
 hw/misc/armsse-cpuid.c | 1 +
 1 file changed, 1 insertion(+)
hw/misc/armsse-cpuid.c +1 -0
index d58138dc28c..61251d538b9 100644
@@ -115,6 +115,7 @@ static void armsse_cpuid_class_init(ObjectClass *klass, void *data)
      * This device has no guest-modifiable state and so it
      * does not need a reset function or VMState.
      */
+    dc->vmsd = vmstate_qdev_no_state_to_migrate;
 
     device_class_set_props(dc, armsse_cpuid_props);
 }
Signature · 1 line
2.26.2
#21 lore raw

RFC PATCH v2 13/20 hw/misc/iotkit-sysinfo: Mark the device with no migratable fields

In reply to Philippe Mathieu-Daudé

This device doesn't have fields to migrate. Be explicit by using vmstate_qdev_no_state_to_migrate.

---
 hw/misc/iotkit-sysinfo.c | 1 +
 1 file changed, 1 insertion(+)
hw/misc/iotkit-sysinfo.c +1 -0
index b2dcfc4376c..8bb9a2ef8b2 100644
@@ -120,6 +120,7 @@ static void iotkit_sysinfo_class_init(ObjectClass *klass, void *data)
      * This device has no guest-modifiable state and so it
      * does not need a reset function or VMState.
      */
+    dc->vmsd = vmstate_qdev_no_state_to_migrate;
 
     device_class_set_props(dc, iotkit_sysinfo_props);
 }
Signature · 1 line
2.26.2
#22 lore raw

RFC PATCH v2 14/20 hw/misc/unimp: Mark the device with no migratable fields

In reply to Philippe Mathieu-Daudé

This device doesn't have fields to migrate. Be explicit by using vmstate_qdev_no_state_to_migrate.

---
 hw/misc/unimp.c | 1 +
 1 file changed, 1 insertion(+)
hw/misc/unimp.c +1 -0
index 6cfc5727f0b..e5ede95c124 100644
@@ -81,6 +81,7 @@ static void unimp_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
 
     dc->realize = unimp_realize;
+    dc->vmsd = vmstate_qdev_no_state_to_migrate;
     device_class_set_props(dc, unimp_properties);
 }
 
Signature · 1 line
2.26.2
#23 lore raw

RFC PATCH v2 15/20 hw/nubus/mac-nubus-bridge: Mark the device with no migratable fields

In reply to Philippe Mathieu-Daudé

This device doesn't have fields to migrate. Be explicit by using vmstate_qdev_no_state_to_migrate.

---
 hw/nubus/mac-nubus-bridge.c | 1 +
 1 file changed, 1 insertion(+)
hw/nubus/mac-nubus-bridge.c +1 -0
index 7c329300b82..ede36ccc5dd 100644
@@ -27,6 +27,7 @@ static void mac_nubus_bridge_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
 
     dc->desc = "Nubus bridge";
+    dc->vmsd = vmstate_qdev_no_state_to_migrate;
 }
 
 static const TypeInfo mac_nubus_bridge_info = {
Signature · 1 line
2.26.2
Reviewed-by on v2 15/20
#24 lore raw

Re: [RFC PATCH v2 15/20] hw/nubus/mac-nubus-bridge: Mark the device with no migratable fields

Le 17/01/2021 à 20:24, Philippe Mathieu-Daudé a écrit :

Quoted 14 lines

This device doesn't have fields to migrate. Be explicit by using vmstate_qdev_no_state_to_migrate.

---
 hw/nubus/mac-nubus-bridge.c | 1 +
 1 file changed, 1 insertion(+)
hw/nubus/mac-nubus-bridge.c +0 -0
index 7c329300b82..ede36ccc5dd 100644

hw/nubus/mac-nubus-bridge.c static void mac_nubus_bridge_class_init(ObjectClass *klass, void *data) · line 33

Quoted 7 lines
hw/nubus/mac-nubus-bridge.c +1 -0
@@ -27,6 +27,7 @@ static void mac_nubus_bridge_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
 
     dc->desc = "Nubus bridge";
+    dc->vmsd = vmstate_qdev_no_state_to_migrate;
 }
 
 static const TypeInfo mac_nubus_bridge_info = {
#25 lore raw

RFC PATCH v2 16/20 hw/sparc64/sun4u: Mark devices with no migratable fields

In reply to Philippe Mathieu-Daudé

These devices don't have fields to migrate. Be explicit by using vmstate_qdev_no_state_to_migrate.

Add a more descriptive comment to keep a clear separation between static property vs runtime changeable.

---
 hw/sparc64/sun4u.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
hw/sparc64/sun4u.c +5 -1
index 0fa13a73302..fdf0aa875be 100644
@@ -84,12 +84,15 @@ struct hwdef {
 struct EbusState {
     /*< private >*/
     PCIDevice parent_obj;
+    /*< public >*/
 
     ISABus *isa_bus;
     qemu_irq isa_bus_irqs[ISA_NUM_IRQS];
-    uint64_t console_serial_base;
     MemoryRegion bar0;
     MemoryRegion bar1;
+
+    /* Properties */
+    uint64_t console_serial_base;
 };
 
 #define TYPE_EBUS "ebus"
@@ -386,6 +389,7 @@ static void ebus_class_init(ObjectClass *klass, void *data)
     k->device_id = PCI_DEVICE_ID_SUN_EBUS;
     k->revision = 0x01;
     k->class_id = PCI_CLASS_BRIDGE_OTHER;
+    dc->vmsd = vmstate_qdev_no_state_to_migrate;
     device_class_set_props(dc, ebus_properties);
 }
 
Signature · 1 line
2.26.2
Reviewed-by on v2 16/20
#26 lore raw

Re: [RFC PATCH v2 16/20] hw/sparc64/sun4u: Mark devices with no migratable fields

вс, 17 янв. 2021 г., 20:26 Philippe Mathieu-Daudé <[email protected]>:

Quoted 6 lines

These devices don't have fields to migrate. Be explicit by using vmstate_qdev_no_state_to_migrate.

Add a more descriptive comment to keep a clear separation between static property vs runtime changeable.

Nice, thanks for this!

Quoted 2 lines

---

Quoted 37 lines
 hw/sparc64/sun4u.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
hw/sparc64/sun4u.c +5 -2
index 0fa13a73302..fdf0aa875be 100644
@@ -84,12 +84,15 @@ struct hwdef {
 struct EbusState {
     /*< private >*/
     PCIDevice parent_obj;
+    /*< public >*/
 
     ISABus *isa_bus;
     qemu_irq isa_bus_irqs[ISA_NUM_IRQS];
-    uint64_t console_serial_base;
     MemoryRegion bar0;
     MemoryRegion bar1;
+
+    /* Properties */
+    uint64_t console_serial_base;
 };
 
 #define TYPE_EBUS "ebus"
@@ -386,6 +389,7 @@ static void ebus_class_init(ObjectClass *klass, void
 *data)
     k->device_id = PCI_DEVICE_ID_SUN_EBUS;
     k->revision = 0x01;
     k->class_id = PCI_CLASS_BRIDGE_OTHER;
+    dc->vmsd = vmstate_qdev_no_state_to_migrate;
     device_class_set_props(dc, ebus_properties);
 }
 
--

2.26.2

#27 lore raw

RFC PATCH v2 17/20 hw/pci-host/gpex: Mark device with no migratable fields

In reply to Philippe Mathieu-Daudé

TYPE_GPEX_HOST does not have internal state to migrate. Its only interesting state is in the GPEXRootState, which is a TYPE_GPEX_ROOT_DEVICE which migrates itself. Explicit there is nothing to migrate by using the special vmstate_qdev_no_state_to_migrate.

---
 hw/pci-host/gpex.c | 1 +
 1 file changed, 1 insertion(+)
hw/pci-host/gpex.c +1 -0
index 2bdbe7b4561..2565dc27ae4 100644
@@ -115,6 +115,7 @@ static void gpex_host_class_init(ObjectClass *klass, void *data)
 
     hc->root_bus_path = gpex_host_root_bus_path;
     dc->realize = gpex_host_realize;
+    dc->vmsd = vmstate_qdev_no_state_to_migrate;
     set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
     dc->fw_name = "pci";
 }
Signature · 1 line
2.26.2
#28 lore raw

RFC PATCH v2 18/20 hw/core/qdev: Display warning for devices missing migration state

In reply to Philippe Mathieu-Daudé

When built with --enable-qdev-debug, QEMU displays warnings listing devices missing migration state:

  $ qemu-system-arm -S -M spitz
  qemu-system-arm: warning: missing migration state for type: 'pxa270-c0-arm-cpu'
  qemu-system-arm: warning: missing migration state for type: 'serial'
  qemu-system-arm: warning: missing migration state for type: 'pxa2xx-pcmcia'
  qemu-system-arm: warning: missing migration state for type: 'pxa2xx-pcmcia'
  qemu-system-arm: warning: missing migration state for type: 'pxa2xx-i2c-slave'
  qemu-system-arm: warning: missing migration state for type: 'pxa2xx-i2c-slave'
  qemu-system-arm: warning: missing migration state for type: 'ads7846'
  qemu-system-arm: warning: missing migration state for type: 'max1111'

---
Unresolved issue:

https://www.mail-archive.com/[email protected]/msg721700.html
Peter:

Quoted 8 lines

I think where we'd like to get to is installing a migration blocker if the machine has any devices which don't have a vmsd. But for that we'd need to be pretty sure we'd got all the devices on machines where we care about migration, and we're clearly a fair way from that (eg we need to do something about the devices like the CPU which don't have a vmsd but handle their migration some other way so they don't trigger the condition for warning/migration-blocker).

---
 configure      | 10 ++++++++++
 meson.build    |  1 +
 hw/core/qdev.c |  5 +++++
 3 files changed, 16 insertions(+)
configure +10 -0
index 155dda124c2..984befbb99d 100755
@@ -383,6 +383,7 @@ blobs="true"
 pkgversion=""
 pie=""
 qom_cast_debug="yes"
+qdev_debug="no"
 trace_backends="log"
 trace_file="trace"
 spice="$default_feature"
@@ -1005,6 +1006,10 @@ for opt do
   ;;
   --enable-qom-cast-debug) qom_cast_debug="yes"
   ;;
+  --disable-qdev-debug) qdev_debug="no"
+  ;;
+  --enable-qdev-debug) qdev_debug="yes"
+  ;;
   --disable-virtfs) virtfs="disabled"
   ;;
   --enable-virtfs) virtfs="enabled"
@@ -1048,6 +1053,7 @@ for opt do
       debug="yes"
       strip_opt="no"
       fortify_source="no"
+      qdev_debug="yes"
   ;;
   --enable-sanitizers) sanitizers="yes"
   ;;
@@ -5912,6 +5918,10 @@ if test "$qom_cast_debug" = "yes" ; then
   echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak
 fi
 
+if test "$qdev_debug" = "yes" ; then
+  echo "CONFIG_QDEV_DEBUG=y" >> $config_host_mak
+fi
+
 echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
 if test "$coroutine_pool" = "yes" ; then
   echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak
meson.build +1 -0
index 3d889857a09..545c8f9f88b 100644
@@ -2472,6 +2472,7 @@
 summary_info += {'TPM support':       config_host.has_key('CONFIG_TPM')}
 summary_info += {'libssh support':    config_host.has_key('CONFIG_LIBSSH')}
 summary_info += {'QOM debugging':     config_host.has_key('CONFIG_QOM_CAST_DEBUG')}
+summary_info += {'QDEV debugging':    config_host.has_key('CONFIG_QDEV_DEBUG')}
 summary_info += {'Live block migration': config_host.has_key('CONFIG_LIVE_BLOCK_MIGRATION')}
 summary_info += {'lzo support':       lzo.found()}
 summary_info += {'snappy support':    snappy.found()}
hw/core/qdev.c +5 -0
index f0d0afd438d..9a73a242fa4 100644
@@ -792,6 +792,11 @@ static void device_set_realized(Object *obj, bool value, Error **errp)
                                                &local_err) < 0) {
                 goto post_realize_fail;
             }
+        } else {
+#ifdef CONFIG_QDEV_DEBUG
+            warn_report("missing migration state for type: '%s'",
+                        object_get_typename(OBJECT(dev)));
+#endif
         }
 
         /*
Signature · 1 line
2.26.2
#29 lore raw

RFC PATCH v2 19/20 stubs/vmstate: Add VMSTATE_END_OF_LIST to vmstate_user_mode_cpu_dummy

In reply to Philippe Mathieu-Daudé

Add a name and end marker to the vmstate_user_mode_cpu_dummy variable.

---
 stubs/vmstate.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
stubs/vmstate.c +6 -1
index f561f9f39bd..1d0e03e233b 100644
@@ -2,7 +2,12 @@
 #include "migration/vmstate.h"
 
 #if defined(CONFIG_USER_ONLY)
-const VMStateDescription vmstate_user_mode_cpu_dummy = {};
+const VMStateDescription vmstate_user_mode_cpu_dummy = {
+    .name = "cpu_common_user",
+    .fields = (VMStateField[]) {
+        VMSTATE_END_OF_LIST()
+    },
+};
 #endif
 
 const VMStateDescription vmstate_no_state_to_migrate = {
Signature · 1 line
2.26.2
Reviewed-by on v2 19/20
#30 lore raw

Re: [RFC PATCH v2 19/20] stubs/vmstate: Add VMSTATE_END_OF_LIST to vmstate_user_mode_cpu_dummy

Quoted 4 lines · * Philippe Mathieu-Daudé ([email protected]) wrote:

Add a name and end marker to the vmstate_user_mode_cpu_dummy variable.

Quoted 25 lines
---
 stubs/vmstate.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
stubs/vmstate.c +6 -1
index f561f9f39bd..1d0e03e233b 100644
@@ -2,7 +2,12 @@
 #include "migration/vmstate.h"
 
 #if defined(CONFIG_USER_ONLY)
-const VMStateDescription vmstate_user_mode_cpu_dummy = {};
+const VMStateDescription vmstate_user_mode_cpu_dummy = {
+    .name = "cpu_common_user",
+    .fields = (VMStateField[]) {
+        VMSTATE_END_OF_LIST()
+    },
+};
 #endif
 
 const VMStateDescription vmstate_no_state_to_migrate = {
Signature · 1 line
2.26.2
Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK
#31 lore raw

RFC PATCH v2 20/20 migration/vmstate: Simplify vmstate for user-mode CPU

In reply to Philippe Mathieu-Daudé

User-mode wants an empty vmstate for the CPUs. We can use the generic vmstate_no_state_to_migrate object which is the same.

---
 include/hw/core/cpu.h       | 2 +-
 include/migration/vmstate.h | 3 ---
 stubs/vmstate.c             | 9 ---------
 3 files changed, 1 insertion(+), 13 deletions(-)
include/hw/core/cpu.h +1 -1
index c79a58db9b9..01e75cc7403 100644
@@ -1132,7 +1132,7 @@ bool target_words_bigendian(void);
 #ifdef CONFIG_SOFTMMU
 extern const VMStateDescription vmstate_cpu_common;
 #else
-#define vmstate_cpu_common vmstate_user_mode_cpu_dummy
+#define vmstate_cpu_common vmstate_no_state_to_migrate
 #endif
 
 #define VMSTATE_CPU() {                                                     \
include/migration/vmstate.h +0 -3
index 50559598eac..dfe20b5caa1 100644
@@ -194,9 +194,6 @@ struct VMStateDescription {
     const VMStateDescription **subsections;
 };
 
-#if defined(CONFIG_USER_ONLY)
-extern const VMStateDescription vmstate_user_mode_cpu_dummy;
-#endif
 extern const VMStateDescription vmstate_no_state_to_migrate;
 
 extern const VMStateInfo vmstate_info_bool;
stubs/vmstate.c +0 -9
index 1d0e03e233b..c360a929f60 100644
@@ -1,15 +1,6 @@
 #include "qemu/osdep.h"
 #include "migration/vmstate.h"
 
-#if defined(CONFIG_USER_ONLY)
-const VMStateDescription vmstate_user_mode_cpu_dummy = {
-    .name = "cpu_common_user",
-    .fields = (VMStateField[]) {
-        VMSTATE_END_OF_LIST()
-    },
-};
-#endif
-
 const VMStateDescription vmstate_no_state_to_migrate = {
     .name = "empty-state",
     .fields = (VMStateField[]) {
Signature · 1 line
2.26.2