Skip to contentSkip to conversation

cpu: Fix VMSTATE_CPU() semantics

PATCH In review Andreas Färber 2 participants 2 messages Jul 29, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpu: Fix VMSTATE_CPU() semantics

Commit 1a1562f5ea3da17d45d3829e35b5f49da9ec2db5 prepared a VMSTATE_CPU() macro for device-style VMStateDescription registration, but missed to adapt cpu_exec_init(), so that the "cpu_common" VMStateDescription was still registered for AlphaCPU (fe31e7374299c0c6172ce618b29bf2fecbd881c7) and OpenRISCCPU (da69721460e652072b6a3dd52b7693da21ffe237). Fix this.

Cc Richard Henderson <[email protected]>
Cc Jia Liu <[email protected]>
---
 exec.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
exec.c +4 -1
index c4f2894..3ca9381 100644
@@ -402,11 +402,14 @@ void cpu_exec_init(CPUArchState *env)
 #if defined(CONFIG_USER_ONLY)
     cpu_list_unlock();
 #endif
-    vmstate_register(NULL, cpu_index, &vmstate_cpu_common, cpu);
+    if (qdev_get_vmsd(DEVICE(cpu)) == NULL) {
+        vmstate_register(NULL, cpu_index, &vmstate_cpu_common, cpu);
+    }
 #if defined(CPU_SAVE_VERSION) && !defined(CONFIG_USER_ONLY)
     register_savevm(NULL, "cpu", cpu_index, CPU_SAVE_VERSION,
                     cpu_save, cpu_load, env);
     assert(cc->vmsd == NULL);
+    assert(qdev_get_vmsd(DEVICE(cpu)) == NULL);
 #endif
     if (cc->vmsd != NULL) {
         vmstate_register(NULL, cpu_index, cc->vmsd, cpu);
Signature · 1 line
1.8.1.4
Tested-by on v1 1/1
#1 lore raw
Quoted 23 lines · Andreas Färber

Commit 1a1562f5ea3da17d45d3829e35b5f49da9ec2db5 prepared a VMSTATE_CPU() macro for device-style VMStateDescription registration, but missed to adapt cpu_exec_init(), so that the "cpu_common" VMStateDescription was still registered for AlphaCPU (fe31e7374299c0c6172ce618b29bf2fecbd881c7) and OpenRISCCPU (da69721460e652072b6a3dd52b7693da21ffe237). Fix this.

Cc Richard Henderson <[email protected]>
Cc Jia Liu <[email protected]>
---
 exec.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
exec.c +1 -1
index c4f2894..3ca9381 100644
@@ -402,11 +402,14 @@ void cpu_exec_init(CPUArchState *env)
 #if defined(CONFIG_USER_ONLY)
     cpu_list_unlock();
 #endif
-    vmstate_register(NULL, cpu_index, &vmstate_cpu_common, cpu);
+    if (qdev_get_vmsd(DEVICE(cpu)) == NULL) {

exec.c void cpu_exec_init(CPUArchState *env) · line 415

Quoted 10 lines
exec.c +3 -0
+        vmstate_register(NULL, cpu_index, &vmstate_cpu_common, cpu);
+    }
 #if defined(CPU_SAVE_VERSION) && !defined(CONFIG_USER_ONLY)
     register_savevm(NULL, "cpu", cpu_index, CPU_SAVE_VERSION,
                     cpu_save, cpu_load, env);
     assert(cc->vmsd == NULL);
+    assert(qdev_get_vmsd(DEVICE(cpu)) == NULL);
 #endif
     if (cc->vmsd != NULL) {
         vmstate_register(NULL, cpu_index, cc->vmsd, cpu);
Quoted 3 lines

--
1.8.1.4

Regards,
Jia