From: Michael Walle <michael@walle.cc>
To: "Andreas Färber" <afaerber@suse.de>
Cc: qemu-devel@nongnu.org, ehabkost@redhat.com, quintela@redhat.com
Subject: Re: [Qemu-devel] [PATCH qom-cpu v3 6/6] target-lm32: Update VMStateDescription to LM32CPU
Date: Wed, 6 Mar 2013 00:48:10 +0100 [thread overview]
Message-ID: <201303060048.10591.michael@walle.cc> (raw)
In-Reply-To: <1361816570-8707-7-git-send-email-afaerber@suse.de>
Am Montag 25 Februar 2013, 19:22:50 schrieb Andreas Färber:
> Add a vmstate_lm32_cpu referencing the previous VMStateDescription as a
> sub-struct and hook it up to CPUClass::vmsd. Drop cpu_{save,load}().
>
> Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Michael Walle <michael@walle.cc>
> ---
> target-lm32/cpu-qom.h | 4 ++++
> target-lm32/cpu.c | 2 ++
> target-lm32/cpu.h | 2 --
> target-lm32/machine.c | 25 +++++++++++++------------
> 4 Dateien geändert, 19 Zeilen hinzugefügt(+), 14 Zeilen entfernt(-)
>
> diff --git a/target-lm32/cpu-qom.h b/target-lm32/cpu-qom.h
> index c0b6ce5..e00cca6 100644
> --- a/target-lm32/cpu-qom.h
> +++ b/target-lm32/cpu-qom.h
> @@ -71,4 +71,8 @@ static inline LM32CPU *lm32_env_get_cpu(CPULM32State
> *env)
>
> #define ENV_OFFSET offsetof(LM32CPU, env)
>
> +#ifndef CONFIG_USER_ONLY
> +extern const struct VMStateDescription vmstate_lm32_cpu;
> +#endif
> +
> #endif
> diff --git a/target-lm32/cpu.c b/target-lm32/cpu.c
> index a2badb5..3199102 100644
> --- a/target-lm32/cpu.c
> +++ b/target-lm32/cpu.c
> @@ -83,6 +83,8 @@ static void lm32_cpu_class_init(ObjectClass *oc, void
> *data)
>
> lcc->parent_reset = cc->reset;
> cc->reset = lm32_cpu_reset;
> +
> + cpu_class_set_vmsd(cc, &vmstate_lm32_cpu);
> }
>
> static const TypeInfo lm32_cpu_type_info = {
> diff --git a/target-lm32/cpu.h b/target-lm32/cpu.h
> index 6948d0e..e0bbe04 100644
> --- a/target-lm32/cpu.h
> +++ b/target-lm32/cpu.h
> @@ -212,8 +212,6 @@ static inline CPULM32State *cpu_init(const char
> *cpu_model) #define cpu_gen_code cpu_lm32_gen_code
> #define cpu_signal_handler cpu_lm32_signal_handler
>
> -#define CPU_SAVE_VERSION 1
> -
> int cpu_lm32_handle_mmu_fault(CPULM32State *env, target_ulong address, int
> rw, int mmu_idx);
> #define cpu_handle_mmu_fault cpu_lm32_handle_mmu_fault
> diff --git a/target-lm32/machine.c b/target-lm32/machine.c
> index 6802e81..9e0919c 100644
> --- a/target-lm32/machine.c
> +++ b/target-lm32/machine.c
> @@ -1,9 +1,9 @@
> #include "hw/hw.h"
> #include "hw/boards.h"
>
> -static const VMStateDescription vmstate_cpu = {
> - .name = "cpu",
> - .version_id = CPU_SAVE_VERSION,
> +static const VMStateDescription vmstate_env = {
> + .name = "env",
> + .version_id = 1,
> .minimum_version_id = 1,
> .minimum_version_id_old = 1,
> .fields = (VMStateField[]) {
> @@ -22,12 +22,13 @@ static const VMStateDescription vmstate_cpu = {
> }
> };
>
> -void cpu_save(QEMUFile *f, void *opaque)
> -{
> - vmstate_save_state(f, &vmstate_cpu, opaque);
> -}
> -
> -int cpu_load(QEMUFile *f, void *opaque, int version_id)
> -{
> - return vmstate_load_state(f, &vmstate_cpu, opaque, version_id);
> -}
> +const VMStateDescription vmstate_lm32_cpu = {
> + .name = "cpu",
> + .version_id = 1,
> + .minimum_version_id = 1,
> + .minimum_version_id_old = 1,
> + .fields = (VMStateField[]) {
> + VMSTATE_STRUCT(env, LM32CPU, 1, vmstate_env, CPULM32State),
> + VMSTATE_END_OF_LIST()
> + }
> +};
prev parent reply other threads:[~2013-03-05 23:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1361816570-8707-1-git-send-email-afaerber@suse.de>
[not found] ` <1361816570-8707-5-git-send-email-afaerber@suse.de>
[not found] ` <20130226193203.GC32578@otherpad.lan.raisama.net>
2013-03-05 17:10 ` [Qemu-devel] [PATCH qom-cpu v3 4/6] cpu: Introduce cpu_class_set_vmsd() Andreas Färber
2013-03-05 18:21 ` [Qemu-devel] [PATCH qom-cpu v3 0/6] QOM CPUState VMStateDescriptions Andreas Färber
[not found] ` <1361816570-8707-7-git-send-email-afaerber@suse.de>
2013-03-05 23:48 ` Michael Walle [this message]
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=201303060048.10591.michael@walle.cc \
--to=michael@walle.cc \
--cc=afaerber@suse.de \
--cc=ehabkost@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/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).