From patchwork Tue Feb 26 17:40:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 15091 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 90EE623DFE for ; Tue, 26 Feb 2013 17:40:34 +0000 (UTC) Received: from mail-ve0-f172.google.com (mail-ve0-f172.google.com [209.85.128.172]) by fiordland.canonical.com (Postfix) with ESMTP id 37A3EA18B64 for ; Tue, 26 Feb 2013 17:40:34 +0000 (UTC) Received: by mail-ve0-f172.google.com with SMTP id cz11so3922240veb.31 for ; Tue, 26 Feb 2013 09:40:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:mime-version:content-type :content-transfer-encoding:x-gm-message-state; bh=gEbuLHOTK+J9KzjJTGNfhF0s+LJDypwJi4ITHmwp5Mw=; b=livLR5egX6Uf6rtSEYYjhlGqzsKLpZo8VWpwi+cm/0QJFAy5qSdbhCjQJU00emaJye Q4DpDJrXLAG67LPnr2f05w5rR2dm4zo7We7CtwaFk+3TrRBLA3KVde3IWMidh4cSPzFn IfTuBvHNrB6yGllsz3rBu6DpjFEHaC4PIHo4gJuOJquAz1+ZqnVKVQ3EYk2ih3ain902 Ig7eJzspm9JGwRYg5ki7umOwvjGxiJ/h2dq2TEZMko2u2hv+N6rqxajp7nWBUFXhNorL RKoaRxKD9QQEg9xP/RzF4uQSI44tlsXDADPXzXhrtABREZi4FMVN94LJy7pWt7cggXYp Xlzw== X-Received: by 10.58.48.166 with SMTP id m6mr3057911ven.59.1361900433708; Tue, 26 Feb 2013 09:40:33 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.145.101 with SMTP id st5csp125905veb; Tue, 26 Feb 2013 09:40:33 -0800 (PST) X-Received: by 10.205.137.138 with SMTP id io10mr6934937bkc.4.1361900427888; Tue, 26 Feb 2013 09:40:27 -0800 (PST) Received: from mnementh.archaic.org.uk (1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.1.0.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id he17si5004166bkc.38.2013.02.26.09.40.27 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 26 Feb 2013 09:40:27 -0800 (PST) Received-SPF: neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) client-ip=2001:8b0:1d0::1; Authentication-Results: mx.google.com; spf=neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1UAOVp-0007Nx-Pd; Tue, 26 Feb 2013 17:40:21 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, kvm@vger.kernel.org, Marcelo Tosatti , kvmarm@lists.cs.columbia.edu, Blue Swirl , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Gleb Natapov , Paolo Bonzini Subject: [PATCH v7 06/11] hw/arm_gic: Add presave/postload hooks Date: Tue, 26 Feb 2013 17:40:16 +0000 Message-Id: <1361900421-28354-7-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1361900421-28354-1-git-send-email-peter.maydell@linaro.org> References: <1361900421-28354-1-git-send-email-peter.maydell@linaro.org> MIME-Version: 1.0 X-Gm-Message-State: ALoCoQmJ/XSn4Pg9qUXGaufesXvCbRVlffqcNNQew3LLyl/uWUGKo2dbGjj4+loXOcXsmpYe1lu0 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 Reviewed-by: Andreas Färber Reviewed-by: Paolo Bonzini --- 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 40e8dd7..2947622 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) { GICState *s = (GICState *)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) { GICState *s = (GICState *)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 699352c..3640be0 100644 --- a/hw/arm_gic_internal.h +++ b/hw/arm_gic_internal.h @@ -118,6 +118,8 @@ void gic_init_irqs_and_distributor(GICState *s, int num_irq); typedef struct ARMGICCommonClass { SysBusDeviceClass parent_class; + void (*pre_save)(GICState *s); + void (*post_load)(GICState *s); } ARMGICCommonClass; #define TYPE_ARM_GIC "arm_gic"