From patchwork Sun Apr 30 23:14:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stafford Horne X-Patchwork-Id: 9706259 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 BBE6F602CA for ; Sun, 30 Apr 2017 23:19:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD4F525E13 for ; Sun, 30 Apr 2017 23:19:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A14162623C; Sun, 30 Apr 2017 23:19:09 +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 56E2725E13 for ; Sun, 30 Apr 2017 23:19:09 +0000 (UTC) Received: from localhost ([::1]:46188 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d4y7Q-0004Cn-Do for patchwork-qemu-devel@patchwork.kernel.org; Sun, 30 Apr 2017 19:19:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60465) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d4y3c-00025d-Fk for qemu-devel@nongnu.org; Sun, 30 Apr 2017 19:15:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d4y3b-0006g4-4p for qemu-devel@nongnu.org; Sun, 30 Apr 2017 19:15:12 -0400 Received: from mail-pf0-x244.google.com ([2607:f8b0:400e:c00::244]:34181) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d4y3a-0006fT-Vw for qemu-devel@nongnu.org; Sun, 30 Apr 2017 19:15:11 -0400 Received: by mail-pf0-x244.google.com with SMTP id g23so25781712pfj.1 for ; Sun, 30 Apr 2017 16:15:10 -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=ico4M/UqcNgvX0DRtcdMF0rTsSRDXyL4nY72zeR6LF3RT1Hjs68vEocDkI+FmtfQUY oiyKMxCRZooBgDOvbPFaKdExeADqTcVzYbzLZUAbZrujgP2RKZmR9bP97KXSGymWxFiF XRy1nG5gUQt7Cpq7LlDt5+qe0cNE1FSUyUfc1+EIhpp4EpcXasKIEtBvA0Cw+L0GFEwe qkS8LXMlIcdmPPLlYOgG8dU7kpQmRQYHnM5mXYtEcjEEe0r4wyGawrVo33CpXXZkyH/x PyF8VNOMKpQq9ByRrCbMjEOdyRz5Qd6BLfqQFwsw+cswDK87eIRDyr9l5A0ebVJ4xyRT mynw== 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=l8m67KDl+YeZK0NzD4xGh5mNUUf+3FKak/otjv3Q2lQBLr6LJQJ3ZOwESOyx9lwzCU rs0ebTHJ4cofzvzKliz6LpOS87n1i0F5m+TqH8z1NiRtsf+u7e3hTh0jUb+TZ2t6yDTt Zuck0pi/0gVABi69XwoMGt2QW55WlUMwgGLC7OsMAAnF4nqTO7UfnXP1lrDM74seAJea MxpKemxFg3mRkf0hrdEGoCD1XPwrOi2rXE+1pUrv42Dn6aWgAi6saaTrZk7qZGlHEz1M TjVhWoBrVTbrO+0TqfgaUtGsfZE6hJkKsBYSNenuOEI3qnM/DCMnYQu2Z+Znm6baXYGC 5xHw== X-Gm-Message-State: AN3rC/6COFdXlNnG2M6z1tmjW9EGSmXa7IyqDDyLRPO0kD8JAyDaJbuR 2IkpcqrpUuXXaLU3 X-Received: by 10.98.110.195 with SMTP id j186mr23907411pfc.25.1493594110240; Sun, 30 Apr 2017 16:15:10 -0700 (PDT) Received: from localhost (z209.124-44-183.ppp.wakwak.ne.jp. [124.44.183.209]) by smtp.gmail.com with ESMTPSA id m4sm26341523pgm.25.2017.04.30.16.15.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 30 Apr 2017 16:15:09 -0700 (PDT) From: Stafford Horne To: peter.maydell@linaro.org Date: Mon, 1 May 2017 08:14:22 +0900 Message-Id: <565b9678ec7335762a290afce68f7062bdaf0ce9.1493593744.git.shorne@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::244 Subject: [Qemu-devel] [PULL 08/11] 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 , QEMU Development 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)