From patchwork Mon Feb 22 20:25:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 8383421 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 39178C0553 for ; Mon, 22 Feb 2016 21:07:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8088320483 for ; Mon, 22 Feb 2016 21:07:54 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BCE9020461 for ; Mon, 22 Feb 2016 21:07:53 +0000 (UTC) Received: from localhost ([::1]:51983 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXxhx-0008Tv-10 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 22 Feb 2016 16:07:53 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57881) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXxg8-0005Kx-QI for qemu-devel@nongnu.org; Mon, 22 Feb 2016 16:06:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aXxg7-0004Cn-HF for qemu-devel@nongnu.org; Mon, 22 Feb 2016 16:06:00 -0500 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:55906) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXxg7-0004CT-AB; Mon, 22 Feb 2016 16:05:59 -0500 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.84) (envelope-from ) id 1aXx2u-0001RN-FC; Mon, 22 Feb 2016 20:25:28 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 22 Feb 2016 20:25:20 +0000 Message-Id: <1456172720-12650-6-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1456172720-12650-1-git-send-email-peter.maydell@linaro.org> References: <1456172720-12650-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:8b0:1d0::2 Cc: Shlomo Pongratz , qemu-arm@nongnu.org, Pavel Fedin Subject: [Qemu-devel] [RFC 5/5] hw/intc/arm_gicv3_common: Add vmstate descriptors X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Pavel Fedin Add state structure descriptors and actually enable live migration. In order to describe fixed-size bitmaps, VMSTATE_BITMAP_STATIC() macro is introduced. Signed-off-by: Pavel Fedin [PMM: Adjust to renamed struct fields] --- hw/intc/arm_gicv3_common.c | 45 ++++++++++++++++++++++++++++++++++++++++++++- include/migration/vmstate.h | 9 +++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/hw/intc/arm_gicv3_common.c b/hw/intc/arm_gicv3_common.c index a1ce4c1..e1078a5 100644 --- a/hw/intc/arm_gicv3_common.c +++ b/hw/intc/arm_gicv3_common.c @@ -48,11 +48,54 @@ static int gicv3_post_load(void *opaque, int version_id) return 0; } +static const VMStateDescription vmstate_gicv3_cpu = { + .name = "arm_gicv3_cpu", + .version_id = 1, + .minimum_version_id = 1, + .fields = (VMStateField[]) { + VMSTATE_UINT32(level, GICv3CPUState), + VMSTATE_UINT32(gicr_ctlr, GICv3CPUState), + VMSTATE_UINT32(gicr_waker, GICv3CPUState), + VMSTATE_UINT64(gicr_propbaser, GICv3CPUState), + VMSTATE_UINT64(gicr_pendbaser, GICv3CPUState), + VMSTATE_UINT32(gicr_igroupr0, GICv3CPUState), + VMSTATE_UINT32(gicr_ienabler0, GICv3CPUState), + VMSTATE_UINT32(gicr_ipendr0, GICv3CPUState), + VMSTATE_UINT32(gicr_iactiver0, GICv3CPUState), + VMSTATE_UINT32(gicr_icfgr0, GICv3CPUState), + VMSTATE_UINT32(gicr_icfgr1, GICv3CPUState), + VMSTATE_UINT8_ARRAY(gicr_ipriorityr, GICv3CPUState, GIC_INTERNAL), + VMSTATE_UINT64_ARRAY(icc_ctlr_el1, GICv3CPUState, 2), + VMSTATE_UINT64(icc_pmr_el1, GICv3CPUState), + VMSTATE_UINT64_ARRAY(icc_bpr, GICv3CPUState, 2), + VMSTATE_UINT64_2DARRAY(icc_ap1r, GICv3CPUState, 4, 2), + VMSTATE_UINT64(icc_igrpen0_el1, GICv3CPUState), + VMSTATE_UINT64(icc_igrpen1_el1, GICv3CPUState), + VMSTATE_END_OF_LIST() + } +}; + static const VMStateDescription vmstate_gicv3 = { .name = "arm_gicv3", - .unmigratable = 1, + .version_id = 1, + .minimum_version_id = 1, .pre_save = gicv3_pre_save, .post_load = gicv3_post_load, + .fields = (VMStateField[]) { + VMSTATE_UINT32(gicd_ctlr, GICv3State), + VMSTATE_BITMAP_STATIC(group, GICv3State , 0, GICV3_MAXSPI), + VMSTATE_BITMAP_STATIC(enabled, GICv3State , 0, GICV3_MAXSPI), + VMSTATE_BITMAP_STATIC(pending, GICv3State , 0, GICV3_MAXSPI), + VMSTATE_BITMAP_STATIC(active, GICv3State , 0, GICV3_MAXSPI), + VMSTATE_BITMAP_STATIC(level, GICv3State , 0, GICV3_MAXSPI), + VMSTATE_BITMAP_STATIC(edge_trigger, GICv3State , 0, GICV3_MAXSPI), + VMSTATE_UINT8_ARRAY(gicd_ipriority, GICv3State, GICV3_MAXSPI), + VMSTATE_UINT8_ARRAY(gicd_itargetsr, GICv3State, GICV3_MAXSPI), + VMSTATE_UINT64_ARRAY(gicd_irouter, GICv3State, GICV3_MAXSPI), + VMSTATE_STRUCT_VARRAY_POINTER_UINT32(cpu, GICv3State, num_cpu, + vmstate_gicv3_cpu, GICv3CPUState), + VMSTATE_END_OF_LIST() + } }; void gicv3_init_irqs_and_mmio(GICv3State *s, qemu_irq_handler handler, diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index ecc4992..934809a 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -564,6 +564,15 @@ extern const VMStateInfo vmstate_info_bitmap; .offset = offsetof(_state, _field), \ } +#define VMSTATE_BITMAP_STATIC(_field, _state, _version, _size) { \ + .name = (stringify(_field)), \ + .version_id = (_version), \ + .size = (_size), \ + .info = &vmstate_info_bitmap, \ + .flags = VMS_BUFFER, \ + .offset = offsetof(_state, _field), \ +} + /* _f : field name _f_n : num of elements field_name _n : num of elements