From patchwork Mon Apr 21 14:40:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 340990 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 ozlabs.org (Postfix) with ESMTPS id 7783B1400E0 for ; Tue, 22 Apr 2014 13:11:51 +1000 (EST) Received: from localhost ([::1]:49313 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WcFcI-00050c-NP for incoming@patchwork.ozlabs.org; Mon, 21 Apr 2014 10:54:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58739) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WcFQm-0004Kq-TM for qemu-devel@nongnu.org; Mon, 21 Apr 2014 10:42:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WcFQg-000441-M9 for qemu-devel@nongnu.org; Mon, 21 Apr 2014 10:42:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:3153) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WcFQg-00043q-De for qemu-devel@nongnu.org; Mon, 21 Apr 2014 10:42:42 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s3LEgfUK031632 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 21 Apr 2014 10:42:41 -0400 Received: from trasno.mitica (ovpn-116-41.ams2.redhat.com [10.36.116.41]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s3LEfi6k019220; Mon, 21 Apr 2014 10:42:40 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 21 Apr 2014 16:40:20 +0200 Message-Id: <1398091304-10677-41-git-send-email-quintela@redhat.com> In-Reply-To: <1398091304-10677-1-git-send-email-quintela@redhat.com> References: <1398091304-10677-1-git-send-email-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 040/124] vmstate: Test for VMSTATE_UINT64_ARRAY{_TEST} 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org CHange users of _V to _TEST. Signed-off-by: Juan Quintela --- include/migration/vmstate.h | 12 ++++++------ target-i386/machine.c | 5 +++-- tests/test-vmstate.c | 24 ++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index 8f4a1a3..7c8bc54 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -618,6 +618,12 @@ extern const VMStateInfo vmstate_info_bitmap; #define VMSTATE_UINT32_ARRAY(_f, _s, _n) \ VMSTATE_UINT32_ARRAY_TEST(_f, _s, _n, NULL) +#define VMSTATE_UINT64_ARRAY_TEST(_f, _s, _n, _t) \ + VMSTATE_ARRAY_TEST(_f, _s, _n, _t, vmstate_info_uint64, uint64_t) + +#define VMSTATE_UINT64_ARRAY(_f, _s, _n) \ + VMSTATE_UINT64_ARRAY_TEST(_f, _s, _n, NULL) + #define VMSTATE_UINT16_2DARRAY_V(_f, _s, _n1, _n2, _v) \ VMSTATE_2DARRAY(_f, _s, _n1, _n2, _v, vmstate_info_uint16, uint16_t) @@ -639,12 +645,6 @@ extern const VMStateInfo vmstate_info_bitmap; #define VMSTATE_UINT32_2DARRAY(_f, _s, _n1, _n2) \ VMSTATE_UINT32_2DARRAY_V(_f, _s, _n1, _n2, 0) -#define VMSTATE_UINT64_ARRAY_V(_f, _s, _n, _v) \ - VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_uint64, uint64_t) - -#define VMSTATE_UINT64_ARRAY(_f, _s, _n) \ - VMSTATE_UINT64_ARRAY_V(_f, _s, _n, 0) - #define VMSTATE_INT16_ARRAY_V(_f, _s, _n, _v) \ VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_int16, int16_t) diff --git a/target-i386/machine.c b/target-i386/machine.c index d4ffe8e..1b8e3c4 100644 --- a/target-i386/machine.c +++ b/target-i386/machine.c @@ -667,7 +667,7 @@ const VMStateDescription vmstate_x86_cpu = { VMSTATE_UINT32_TEST(env.intercept_exceptions, X86CPU, vmstate_5_plus), VMSTATE_UINT8_TEST(env.v_tpr, X86CPU, vmstate_5_plus), /* MTRRs */ - VMSTATE_UINT64_ARRAY_V(env.mtrr_fixed, X86CPU, 11, 8), + VMSTATE_UINT64_ARRAY_TEST(env.mtrr_fixed, X86CPU, 11, vmstate_8_plus), VMSTATE_UINT64_TEST(env.mtrr_deftype, X86CPU, vmstate_8_plus), VMSTATE_MTRR_VARS(env.mtrr_var, X86CPU, 8, 8), /* KVM-related states */ @@ -684,7 +684,8 @@ const VMStateDescription vmstate_x86_cpu = { VMSTATE_UINT64_TEST(env.mcg_cap, X86CPU, vmstate_10_plus), VMSTATE_UINT64_TEST(env.mcg_status, X86CPU, vmstate_10_plus), VMSTATE_UINT64_TEST(env.mcg_ctl, X86CPU, vmstate_10_plus), - VMSTATE_UINT64_ARRAY_V(env.mce_banks, X86CPU, MCE_BANKS_DEF * 4, 10), + VMSTATE_UINT64_ARRAY_TEST(env.mce_banks, X86CPU, MCE_BANKS_DEF * 4, + vmstate_10_plus), /* rdtscp */ VMSTATE_UINT64_TEST(env.tsc_aux, X86CPU, vmstate_11_plus), /* KVM pvclock msr */ diff --git a/tests/test-vmstate.c b/tests/test-vmstate.c index f81d470..d4c15a2 100644 --- a/tests/test-vmstate.c +++ b/tests/test-vmstate.c @@ -517,6 +517,8 @@ typedef struct TestArray { uint16_t u16_1[VMSTATE_ARRAY_SIZE]; uint32_t u32_1[VMSTATE_ARRAY_SIZE]; uint32_t u32_2[VMSTATE_ARRAY_SIZE]; + uint64_t u64_1[VMSTATE_ARRAY_SIZE]; + uint64_t u64_2[VMSTATE_ARRAY_SIZE]; } TestArray; TestArray obj_array = { @@ -528,6 +530,8 @@ TestArray obj_array = { .u16_1 = {11, 12, 13, 14, 15}, .u32_1 = {21, 22, 23, 24, 25}, .u32_2 = {25, 24, 23, 22, 21}, + .u64_1 = {31, 32, 33, 34, 35}, + .u64_2 = {35, 34, 33, 32, 31}, }; static const VMStateDescription vmstate_array_primitive = { @@ -541,6 +545,7 @@ static const VMStateDescription vmstate_array_primitive = { VMSTATE_UINT8_ARRAY(u8_1, TestArray, VMSTATE_ARRAY_SIZE), VMSTATE_UINT16_ARRAY(u16_1, TestArray, VMSTATE_ARRAY_SIZE), VMSTATE_UINT32_ARRAY(u32_1, TestArray, VMSTATE_ARRAY_SIZE), + VMSTATE_UINT64_ARRAY(u64_1, TestArray, VMSTATE_ARRAY_SIZE), VMSTATE_END_OF_LIST() } }; @@ -553,6 +558,11 @@ uint8_t wire_array_primitive[] = { /* u32_1 */ 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x19, + /* u64_1 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */ }; @@ -572,6 +582,8 @@ static void obj_array_copy(void *arg1, void *arg2) target->u16_1[i] = source->u16_1[i]; target->u32_1[i] = source->u32_1[i]; target->u32_2[i] = source->u32_2[i]; + target->u64_1[i] = source->u64_1[i]; + target->u64_2[i] = source->u64_2[i]; } } @@ -604,6 +616,7 @@ static void test_array_primitive(void) ELEM_NOT_EQUAL(u8_2, i); ELEM_EQUAL(u16_1, i); ELEM_EQUAL(u32_1, i); + ELEM_EQUAL(u64_1, i); } } @@ -620,6 +633,10 @@ static const VMStateDescription vmstate_array_test = { test_true), VMSTATE_UINT32_ARRAY_TEST(u32_2, TestArray, VMSTATE_ARRAY_SIZE, test_false), + VMSTATE_UINT64_ARRAY_TEST(u64_1, TestArray, VMSTATE_ARRAY_SIZE, + test_true), + VMSTATE_UINT64_ARRAY_TEST(u64_2, TestArray, VMSTATE_ARRAY_SIZE, + test_false), VMSTATE_END_OF_LIST() } }; @@ -630,6 +647,11 @@ uint8_t wire_array_test[] = { /* u32_1 */ 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x19, + /* u64_1 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */ }; @@ -654,6 +676,8 @@ static void test_array_test(void) ELEM_EQUAL(b_1, i); ELEM_EQUAL(u32_1, i); ELEM_NOT_EQUAL(u32_2, i); + ELEM_EQUAL(u64_1, i); + ELEM_NOT_EQUAL(u64_2, i); } } #undef FIELD_EQUAL