From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, patches@linaro.org
Subject: [Qemu-devel] [RFC v2 3/6] hw/arm_gic: Add presave/postload hooks
Date: Wed, 10 Oct 2012 16:07:36 +0100 [thread overview]
Message-ID: <1349881659-8403-4-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1349881659-8403-1-git-send-email-peter.maydell@linaro.org>
Add presave/postload hooks to the ARM GIC common base class.
These will be used by the KVM in-kernel GIC subclass to sync
state between kernel and userspace when migrating.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/arm_gic_common.c | 10 ++++++++++
hw/arm_gic_internal.h | 2 ++
2 files changed, 12 insertions(+)
diff --git a/hw/arm_gic_common.c b/hw/arm_gic_common.c
index 360e782..d972755 100644
--- a/hw/arm_gic_common.c
+++ b/hw/arm_gic_common.c
@@ -23,9 +23,14 @@
static void gic_save(QEMUFile *f, void *opaque)
{
gic_state *s = (gic_state *)opaque;
+ ARMGICCommonClass *c = ARM_GIC_COMMON_GET_CLASS(s);
int i;
int j;
+ if (c->pre_save) {
+ c->pre_save(s);
+ }
+
qemu_put_be32(f, s->enabled);
for (i = 0; i < s->num_cpu; i++) {
qemu_put_be32(f, s->cpu_enabled[i]);
@@ -57,6 +62,7 @@ static void gic_save(QEMUFile *f, void *opaque)
static int gic_load(QEMUFile *f, void *opaque, int version_id)
{
gic_state *s = (gic_state *)opaque;
+ ARMGICCommonClass *c = ARM_GIC_COMMON_GET_CLASS(s);
int i;
int j;
@@ -91,6 +97,10 @@ static int gic_load(QEMUFile *f, void *opaque, int version_id)
s->irq_state[i].trigger = qemu_get_byte(f);
}
+ if (c->post_load) {
+ c->post_load(s);
+ }
+
return 0;
}
diff --git a/hw/arm_gic_internal.h b/hw/arm_gic_internal.h
index db4fad5..183dca6 100644
--- a/hw/arm_gic_internal.h
+++ b/hw/arm_gic_internal.h
@@ -118,6 +118,8 @@ void gic_init_irqs_and_distributor(gic_state *s, int num_irq);
typedef struct ARMGICCommonClass {
SysBusDeviceClass parent_class;
+ void (*pre_save)(gic_state *s);
+ void (*post_load)(gic_state *s);
} ARMGICCommonClass;
#define TYPE_ARM_GIC "arm_gic"
--
1.7.9.5
next prev parent reply other threads:[~2012-10-10 15:08 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-10 15:07 [Qemu-devel] [RFC v2 0/6] QEMU: Support KVM on ARM Peter Maydell
2012-10-10 15:07 ` [Qemu-devel] [RFC v2 1/6] linux-headers: Add ARM KVM headers (not for upstream) Peter Maydell
2012-10-10 15:07 ` [Qemu-devel] [RFC v2 2/6] ARM: KVM: Add support for KVM on ARM architecture Peter Maydell
2012-10-13 9:09 ` Blue Swirl
2012-10-13 19:19 ` Peter Maydell
2012-10-18 12:37 ` Peter Maydell
2012-10-18 17:41 ` Jan Kiszka
2012-10-18 17:53 ` Peter Maydell
2012-10-10 15:07 ` Peter Maydell [this message]
2012-10-10 17:29 ` [Qemu-devel] [RFC v2 3/6] hw/arm_gic: Add presave/postload hooks Andreas Färber
2012-10-10 15:07 ` [Qemu-devel] [RFC v2 4/6] hw/kvm/arm_gic: Implement support for KVM in-kernel ARM GIC Peter Maydell
2012-10-10 17:23 ` Andreas Färber
2012-10-10 17:35 ` Peter Maydell
2012-10-10 15:07 ` [Qemu-devel] [RFC v2 5/6] ARM KVM: save and load VFP registers from kernel Peter Maydell
2012-10-10 15:07 ` [Qemu-devel] [RFC v2 6/6] configure: Enable KVM on ARM Peter Maydell
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=1349881659-8403-4-git-send-email-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=patches@linaro.org \
--cc=qemu-devel@nongnu.org \
/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).