qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] target-moxie: Fix VMState registration
@ 2013-04-08 15:51 Peter Maydell
  2013-04-08 16:11 ` Andreas Färber
  2013-04-12 11:32 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
  0 siblings, 2 replies; 3+ messages in thread
From: Peter Maydell @ 2013-04-08 15:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Anthony Green, patches

Register the CPU VMState in the correct way, via cpu_class_set_vmsd(),
rather than doing it in two different wrong ways (once by providing
cpu_save and cpu_load functions, and once by setting the vmsd field in
DeviceClass).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
Having just revamped the target-arm vmstate code I now have a
better grasp of how it should work, so I noticed we didn't quite
get moxie right. Not really very tested since I couldn't find a test
image to try, but should work better than the previous code...

 target-moxie/cpu.c     |    2 +-
 target-moxie/cpu.h     |    2 --
 target-moxie/machine.c |   12 +-----------
 3 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/target-moxie/cpu.c b/target-moxie/cpu.c
index c0855f0..f2b0791 100644
--- a/target-moxie/cpu.c
+++ b/target-moxie/cpu.c
@@ -97,7 +97,7 @@ static void moxie_cpu_class_init(ObjectClass *oc, void *data)
 
     cc->class_by_name = moxie_cpu_class_by_name;
 
-    dc->vmsd = &vmstate_moxie_cpu;
+    cpu_class_set_vmsd(cc, &vmstate_moxie_cpu);
     cc->do_interrupt = moxie_cpu_do_interrupt;
 }
 
diff --git a/target-moxie/cpu.h b/target-moxie/cpu.h
index 988729a..a9d9ace 100644
--- a/target-moxie/cpu.h
+++ b/target-moxie/cpu.h
@@ -28,8 +28,6 @@
 
 #define TARGET_HAS_ICE 1
 
-#define CPU_SAVE_VERSION 1
-
 #define ELF_MACHINE     0xFEED /* EM_MOXIE */
 
 #define MOXIE_EX_DIV0        0
diff --git a/target-moxie/machine.c b/target-moxie/machine.c
index 5bfdb28..0f5992b 100644
--- a/target-moxie/machine.c
+++ b/target-moxie/machine.c
@@ -3,7 +3,7 @@
 
 const VMStateDescription vmstate_moxie_cpu = {
     .name = "cpu",
-    .version_id = CPU_SAVE_VERSION,
+    .version_id = 1,
     .minimum_version_id = 1,
     .minimum_version_id_old = 1,
     .fields      = (VMStateField[]) {
@@ -16,13 +16,3 @@ const VMStateDescription vmstate_moxie_cpu = {
         VMSTATE_END_OF_LIST()
     }
 };
-
-void cpu_save(QEMUFile *f, void *opaque)
-{
-    vmstate_save_state(f, &vmstate_moxie_cpu, opaque);
-}
-
-int cpu_load(QEMUFile *f, void *opaque, int version_id)
-{
-    return vmstate_load_state(f, &vmstate_moxie_cpu, opaque, version_id);
-}
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] target-moxie: Fix VMState registration
  2013-04-08 15:51 [Qemu-devel] [PATCH] target-moxie: Fix VMState registration Peter Maydell
@ 2013-04-08 16:11 ` Andreas Färber
  2013-04-12 11:32 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Färber @ 2013-04-08 16:11 UTC (permalink / raw)
  To: Peter Maydell
  Cc: qemu-trivial, Anthony Green, Juan Quintela, qemu-devel, patches

Am 08.04.2013 17:51, schrieb Peter Maydell:
> Register the CPU VMState in the correct way, via cpu_class_set_vmsd(),
> rather than doing it in two different wrong ways (once by providing
> cpu_save and cpu_load functions, and once by setting the vmsd field in
> DeviceClass).
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> Having just revamped the target-arm vmstate code I now have a
> better grasp of how it should work, so I noticed we didn't quite
> get moxie right. Not really very tested since I couldn't find a test
> image to try, but should work better than the previous code...

Reviewed-by: Andreas Färber <afaerber@suse.de>

Thanks for fixing this,

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [Qemu-trivial] [PATCH] target-moxie: Fix VMState registration
  2013-04-08 15:51 [Qemu-devel] [PATCH] target-moxie: Fix VMState registration Peter Maydell
  2013-04-08 16:11 ` Andreas Färber
@ 2013-04-12 11:32 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2013-04-12 11:32 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-trivial, Anthony Green, qemu-devel, patches

On Mon, Apr 08, 2013 at 04:51:46PM +0100, Peter Maydell wrote:
> Register the CPU VMState in the correct way, via cpu_class_set_vmsd(),
> rather than doing it in two different wrong ways (once by providing
> cpu_save and cpu_load functions, and once by setting the vmsd field in
> DeviceClass).
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> Having just revamped the target-arm vmstate code I now have a
> better grasp of how it should work, so I noticed we didn't quite
> get moxie right. Not really very tested since I couldn't find a test
> image to try, but should work better than the previous code...
> 
>  target-moxie/cpu.c     |    2 +-
>  target-moxie/cpu.h     |    2 --
>  target-moxie/machine.c |   12 +-----------
>  3 files changed, 2 insertions(+), 14 deletions(-)

Thanks, applied to the trivial patches tree:
https://github.com/stefanha/qemu/commits/trivial-patches

Stefan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-04-12 11:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-08 15:51 [Qemu-devel] [PATCH] target-moxie: Fix VMState registration Peter Maydell
2013-04-08 16:11 ` Andreas Färber
2013-04-12 11:32 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi

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).