qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: "Richard Henderson" <rth@twiddle.net>,
	"Andreas Färber" <afaerber@suse.de>,
	quintela@redhat.com
Subject: [Qemu-devel] [PATCH qom-cpu v3 4/6] target-alpha: Register VMStateDescription for AlphaCPU
Date: Tue, 18 Jun 2013 02:29:43 +0200	[thread overview]
Message-ID: <1371515385-32203-5-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1371515385-32203-1-git-send-email-afaerber@suse.de>

Commit b758aca1f6cdb175634812b79f5560c36c902d00 (target-alpha: Enable
the alpha-softmmu target.) introduced cpu_{save,load}() functions but
didn't define CPU_SAVE_VERSION, so they were never registered.

Drop cpu_{save,load}() and register the VMStateDescription via DeviceClass.
This operates on the AlphaCPU object instead of CPUAlphaState.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-alpha/cpu-qom.h |  4 ++++
 target-alpha/cpu.c     |  2 ++
 target-alpha/machine.c | 28 ++++++++++++++++------------
 3 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/target-alpha/cpu-qom.h b/target-alpha/cpu-qom.h
index 32ee286..ee10ed6 100644
--- a/target-alpha/cpu-qom.h
+++ b/target-alpha/cpu-qom.h
@@ -74,6 +74,10 @@ static inline AlphaCPU *alpha_env_get_cpu(CPUAlphaState *env)
 
 #define ENV_OFFSET offsetof(AlphaCPU, env)
 
+#ifndef CONFIG_USER_ONLY
+extern const struct VMStateDescription vmstate_alpha_cpu;
+#endif
+
 void alpha_cpu_do_interrupt(CPUState *cpu);
 
 #endif
diff --git a/target-alpha/cpu.c b/target-alpha/cpu.c
index cad1716..8252cea 100644
--- a/target-alpha/cpu.c
+++ b/target-alpha/cpu.c
@@ -21,6 +21,7 @@
 
 #include "cpu.h"
 #include "qemu-common.h"
+#include "migration/vmstate.h"
 
 
 static void alpha_cpu_realizefn(DeviceState *dev, Error **errp)
@@ -264,6 +265,7 @@ static void alpha_cpu_class_init(ObjectClass *oc, void *data)
 
     cc->class_by_name = alpha_cpu_class_by_name;
     cc->do_interrupt = alpha_cpu_do_interrupt;
+    device_class_set_vmsd(dc, &vmstate_alpha_cpu);
 }
 
 static const TypeInfo alpha_cpu_type_info = {
diff --git a/target-alpha/machine.c b/target-alpha/machine.c
index 1c9edd1..889f2fc 100644
--- a/target-alpha/machine.c
+++ b/target-alpha/machine.c
@@ -20,7 +20,7 @@ static const VMStateInfo vmstate_fpcr = {
     .put = put_fpcr,
 };
 
-static VMStateField vmstate_cpu_fields[] = {
+static VMStateField vmstate_env_fields[] = {
     VMSTATE_UINTTL_ARRAY(ir, CPUAlphaState, 31),
     VMSTATE_UINTTL_ARRAY(fir, CPUAlphaState, 31),
     /* Save the architecture value of the fpcr, not the internally
@@ -68,20 +68,24 @@ static VMStateField vmstate_cpu_fields[] = {
     VMSTATE_END_OF_LIST()
 };
 
-static const VMStateDescription vmstate_cpu = {
-    .name = "cpu",
+static const VMStateDescription vmstate_env = {
+    .name = "env",
     .version_id = 1,
     .minimum_version_id = 1,
     .minimum_version_id_old = 1,
-    .fields = vmstate_cpu_fields,
+    .fields = vmstate_env_fields,
 };
 
-void cpu_save(QEMUFile *f, void *opaque)
-{
-    vmstate_save_state(f, &vmstate_cpu, opaque);
-}
+static VMStateField vmstate_cpu_fields[] = {
+    VMSTATE_CPU(),
+    VMSTATE_STRUCT(env, AlphaCPU, 1, vmstate_env, CPUAlphaState),
+    VMSTATE_END_OF_LIST()
+};
 
-int cpu_load(QEMUFile *f, void *opaque, int version_id)
-{
-    return vmstate_load_state(f, &vmstate_cpu, opaque, version_id);
-}
+const VMStateDescription vmstate_alpha_cpu = {
+    .name = "cpu",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .minimum_version_id_old = 1,
+    .fields = vmstate_cpu_fields,
+};
-- 
1.8.1.4

  parent reply	other threads:[~2013-06-18  0:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-18  0:29 [Qemu-devel] [PATCH qom-cpu v3 0/6] QOM CPUState migration, next generation Andreas Färber
2013-06-18  0:29 ` [Qemu-devel] [PATCH qom-cpu v3 1/6] cpu: Fix cpu_class_set_vmsd() documentation Andreas Färber
2013-06-18  2:30   ` li guang
2013-06-18 11:43   ` Juan Quintela
2013-06-18  0:29 ` [Qemu-devel] [PATCH qom-cpu v3 2/6] cpu: Introduce device_class_set_vmsd() helper Andreas Färber
2013-06-18 11:45   ` Juan Quintela
2013-06-18  0:29 ` [Qemu-devel] [PATCH qom-cpu v3 3/6] cpu: Introduce VMSTATE_CPU() macro for CPUState Andreas Färber
2013-06-18  0:29 ` Andreas Färber [this message]
2013-06-18 11:50   ` [Qemu-devel] [PATCH qom-cpu v3 4/6] target-alpha: Register VMStateDescription for AlphaCPU Juan Quintela
2013-06-18 14:40   ` Richard Henderson
2013-06-18  0:29 ` [Qemu-devel] [PATCH qom-cpu v3 5/6] target-openrisc: Register VMStateDescription for OpenRISCCPU Andreas Färber
2013-06-18 11:51   ` Juan Quintela
2013-06-18  0:29 ` [Qemu-devel] [PATCH qom-cpu v3 6/6] cpu: Guard cpu_{save, load}() definitions Andreas Färber
2013-06-18 11:51   ` Juan Quintela
2013-06-18 15:33 ` [Qemu-devel] [PATCH qom-cpu v3 0/6] QOM CPUState migration, next generation Andreas Färber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1371515385-32203-5-git-send-email-afaerber@suse.de \
    --to=afaerber@suse.de \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).