From patchwork Sun Apr 16 23:23:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stafford Horne X-Patchwork-Id: 9683263 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F029760138 for ; Sun, 16 Apr 2017 23:28:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E204E27BA5 for ; Sun, 16 Apr 2017 23:28:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D6BD227CF3; Sun, 16 Apr 2017 23:28:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id 8F45F27BA5 for ; Sun, 16 Apr 2017 23:28:12 +0000 (UTC) Received: from localhost ([::1]:33924 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cztaV-00060r-Rz for patchwork-qemu-devel@patchwork.kernel.org; Sun, 16 Apr 2017 19:28:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37996) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cztWn-0003pp-5j for qemu-devel@nongnu.org; Sun, 16 Apr 2017 19:24:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cztWm-00080g-9U for qemu-devel@nongnu.org; Sun, 16 Apr 2017 19:24:21 -0400 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]:34155) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cztWm-000804-3e for qemu-devel@nongnu.org; Sun, 16 Apr 2017 19:24:20 -0400 Received: by mail-pg0-x244.google.com with SMTP id o123so24023636pga.1 for ; Sun, 16 Apr 2017 16:24:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=1ULqFvCAucxpqTx+6eOt1U2rQEOVWS/jn5Ic4C9K95s=; b=Eyf4H8PDfBfSwheKZg7aaKoq7B2hdLHgFqbf4pSnQL3uAXz2wvCoV+gmtwiHYWDJlU tXzNxcUiLa1hkV8ZteIpv+McW8zZn8GPKSRgCZtTZ5thOHxGbq9yx98QSCr7z/kasi+T L2WwRsuFx2g0BTmnq/luyR2UI13MiIZk7otc78QU2p6H/KW5C5LpaSiA+8iLotGu2/OF STBRP+Y+5JDOQXquQcdsGvdQua2OzjOjgmbRMgM6GkeRwtpCfKMkPH1gvaZVjibqW6ST mXe/UTRzx6zqQvBXkFMV3/WegzCUl7TFSmb6J7r/khx/dBpse0XELtq+OlK6GcaT3BcX 9xhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=1ULqFvCAucxpqTx+6eOt1U2rQEOVWS/jn5Ic4C9K95s=; b=LN+1790EPpMyLW+Xakv13PVSCu6EToStrqYI6v+byDbSQLvTlN+yojFoIqbSP9gbU3 PBVDnejJ3jX6riP30KYF1mqyVhVMOGf4SPsGXYUBJZPndEAjZW3MW0dQ6Rsbj76bJvZu FahFHlwgGPLN38wsG9anTi0BXLXKPm2lT2K9FSSWx11AEWE+Ltb0/IDClX8xFDgp4HPn sWM27/OTuIttli+9UhSLVu9kCnvQa/1QtoXhxMVTdcLTqnJgIu8xF1ju5dmPw3hdoO9r QRHJEgqiFb5gZr6k7fmx/S/GRLN2ryuxl3oLLtiNsH2mAPfJ9tZ9L2h+1ZoCcsNKfa7m R/TA== X-Gm-Message-State: AN3rC/4bf1ThvPkKv3ydGG+d9XTn9arHoriKG1o7DkwKkLHw4lcZuMmr E5HQ4XTbWVBPIQ== X-Received: by 10.84.218.72 with SMTP id f8mr12043906plm.146.1492385059238; Sun, 16 Apr 2017 16:24:19 -0700 (PDT) Received: from localhost (z24.124-44-184.ppp.wakwak.ne.jp. [124.44.184.24]) by smtp.gmail.com with ESMTPSA id v1sm14028358pgv.14.2017.04.16.16.24.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 16 Apr 2017 16:24:18 -0700 (PDT) From: Stafford Horne To: qemu-devel@nongnu.org Date: Mon, 17 Apr 2017 08:23:55 +0900 Message-Id: X-Mailer: git-send-email 2.9.3 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c05::244 Subject: [Qemu-devel] [PATCH 6/7] migration: Add VMSTATE_STRUCT_2DARRAY() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stafford Horne , openrisc@lists.librecores.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP For openrisc we implement tlb state as a 2d array of tlb entry structs. This is added to allow easy storing of state of 2d arrays. Signed-off-by: Stafford Horne --- include/migration/vmstate.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index f2dbf84..9b7dcdc 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -499,6 +499,17 @@ extern const VMStateInfo vmstate_info_qtailq; .offset = vmstate_offset_array(_state, _field, _type, _num),\ } +#define VMSTATE_STRUCT_2DARRAY_TEST(_field, _state, _n1, _n2, _test, _version, _vmsd, _type) { \ + .name = (stringify(_field)), \ + .num = (_n1) * (_n2), \ + .field_exists = (_test), \ + .version_id = (_version), \ + .vmsd = &(_vmsd), \ + .size = sizeof(_type), \ + .flags = VMS_STRUCT|VMS_ARRAY, \ + .offset = vmstate_offset_2darray(_state, _field, _type, _n1, _n2),\ +} + #define VMSTATE_STRUCT_VARRAY_UINT8(_field, _state, _field_num, _version, _vmsd, _type) { \ .name = (stringify(_field)), \ .num_offset = vmstate_offset_value(_state, _field_num, uint8_t), \ @@ -746,6 +757,10 @@ extern const VMStateInfo vmstate_info_qtailq; VMSTATE_STRUCT_ARRAY_TEST(_field, _state, _num, NULL, _version, \ _vmsd, _type) +#define VMSTATE_STRUCT_2DARRAY(_field, _state, _n1, _n2, _version, _vmsd, _type) \ + VMSTATE_STRUCT_2DARRAY_TEST(_field, _state, _n1, _n2, NULL, _version, \ + _vmsd, _type) + #define VMSTATE_BUFFER_UNSAFE_INFO(_field, _state, _version, _info, _size) \ VMSTATE_BUFFER_UNSAFE_INFO_TEST(_field, _state, NULL, _version, _info, \ _size)