From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60701) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxtPL-0000C1-Kc for qemu-devel@nongnu.org; Thu, 28 May 2015 04:43:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YxtPG-0002VG-Py for qemu-devel@nongnu.org; Thu, 28 May 2015 04:43:19 -0400 Received: from e06smtp11.uk.ibm.com ([195.75.94.107]:56958) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxtPG-0002U9-FI for qemu-devel@nongnu.org; Thu, 28 May 2015 04:43:14 -0400 Received: from /spool/local by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 28 May 2015 09:43:12 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 84FBE2190046 for ; Thu, 28 May 2015 09:42:51 +0100 (BST) Received: from d06av08.portsmouth.uk.ibm.com (d06av08.portsmouth.uk.ibm.com [9.149.37.249]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t4S8hBFY18481398 for ; Thu, 28 May 2015 08:43:11 GMT Received: from d06av08.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t4S8hAOU032162 for ; Thu, 28 May 2015 02:43:11 -0600 From: Cornelia Huck Date: Thu, 28 May 2015 10:43:04 +0200 Message-Id: <1432802585-10765-10-git-send-email-cornelia.huck@de.ibm.com> In-Reply-To: <1432802585-10765-1-git-send-email-cornelia.huck@de.ibm.com> References: <1432802585-10765-1-git-send-email-cornelia.huck@de.ibm.com> Subject: [Qemu-devel] [PULL 09/10] s390x: Migrate vector registers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: peter.maydell@linaro.org Cc: Eric Farman , qemu-devel@nongnu.org, agraf@suse.de, borntraeger@de.ibm.com, jfrei@linux.vnet.ibm.com, Cornelia Huck From: Eric Farman When migrating a guest, be sure to include the vector registers. The vector registers are defined in a subsection, similar to the existing subsection for floating point registers. Since the floating point registers are always present (and thus migrated), we can skip them when performing the migration of the vector registers which may or may not be present. Suggested-by: David Hildenbrand Signed-off-by: Eric Farman Reviewed-by: David Hildenbrand Signed-off-by: Cornelia Huck --- target-s390x/cpu.h | 14 ++++++++++++ target-s390x/machine.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h index 031f94d..a71abae 100644 --- a/target-s390x/cpu.h +++ b/target-s390x/cpu.h @@ -1190,4 +1190,18 @@ static inline int s390_assign_subch_ioeventfd(EventNotifier *notifier, } } +#ifdef CONFIG_KVM +static inline bool vregs_needed(void *opaque) +{ + if (kvm_enabled()) { + return kvm_check_extension(kvm_state, KVM_CAP_S390_VECTOR_REGISTERS); + } + return 0; +} +#else +static inline bool vregs_needed(void *opaque) +{ + return 0; +} +#endif #endif diff --git a/target-s390x/machine.c b/target-s390x/machine.c index 1a9390b..e52d760 100644 --- a/target-s390x/machine.c +++ b/target-s390x/machine.c @@ -73,6 +73,64 @@ static inline bool fpu_needed(void *opaque) return true; } +const VMStateDescription vmstate_vregs = { + .name = "cpu/vregs", + .version_id = 1, + .minimum_version_id = 1, + .fields = (VMStateField[]) { + /* vregs[0][0] -> vregs[15][0] and fregs are overlays */ + VMSTATE_UINT64(env.vregs[16][0].ll, S390CPU), + VMSTATE_UINT64(env.vregs[17][0].ll, S390CPU), + VMSTATE_UINT64(env.vregs[18][0].ll, S390CPU), + VMSTATE_UINT64(env.vregs[19][0].ll, S390CPU), + VMSTATE_UINT64(env.vregs[20][0].ll, S390CPU), + VMSTATE_UINT64(env.vregs[21][0].ll, S390CPU), + VMSTATE_UINT64(env.vregs[22][0].ll, S390CPU), + VMSTATE_UINT64(env.vregs[23][0].ll, S390CPU), + VMSTATE_UINT64(env.vregs[24][0].ll, S390CPU), + VMSTATE_UINT64(env.vregs[25][0].ll, S390CPU), + VMSTATE_UINT64(env.vregs[26][0].ll, S390CPU), + VMSTATE_UINT64(env.vregs[27][0].ll, S390CPU), + VMSTATE_UINT64(env.vregs[28][0].ll, S390CPU), + VMSTATE_UINT64(env.vregs[29][0].ll, S390CPU), + VMSTATE_UINT64(env.vregs[30][0].ll, S390CPU), + VMSTATE_UINT64(env.vregs[31][0].ll, S390CPU), + VMSTATE_UINT64(env.vregs[0][1].ll, S390CPU), + VMSTATE_UINT64(env.vregs[1][1].ll, S390CPU), + VMSTATE_UINT64(env.vregs[2][1].ll, S390CPU), + VMSTATE_UINT64(env.vregs[3][1].ll, S390CPU), + VMSTATE_UINT64(env.vregs[4][1].ll, S390CPU), + VMSTATE_UINT64(env.vregs[5][1].ll, S390CPU), + VMSTATE_UINT64(env.vregs[6][1].ll, S390CPU), + VMSTATE_UINT64(env.vregs[7][1].ll, S390CPU), + VMSTATE_UINT64(env.vregs[8][1].ll, S390CPU), + VMSTATE_UINT64(env.vregs[9][1].ll, S390CPU), + VMSTATE_UINT64(env.vregs[10][1].ll, S390CPU), + VMSTATE_UINT64(env.vregs[11][1].ll, S390CPU), + VMSTATE_UINT64(env.vregs[12][1].ll, S390CPU), + VMSTATE_UINT64(env.vregs[13][1].ll, S390CPU), + VMSTATE_UINT64(env.vregs[14][1].ll, S390CPU), + VMSTATE_UINT64(env.vregs[15][1].ll, S390CPU), + VMSTATE_UINT64(env.vregs[16][1].ll, S390CPU), + VMSTATE_UINT64(env.vregs[17][1].ll, S390CPU), + VMSTATE_UINT64(env.vregs[18][1].ll, S390CPU), + VMSTATE_UINT64(env.vregs[19][1].ll, S390CPU), + VMSTATE_UINT64(env.vregs[20][1].ll, S390CPU), + VMSTATE_UINT64(env.vregs[21][1].ll, S390CPU), + VMSTATE_UINT64(env.vregs[22][1].ll, S390CPU), + VMSTATE_UINT64(env.vregs[23][1].ll, S390CPU), + VMSTATE_UINT64(env.vregs[24][1].ll, S390CPU), + VMSTATE_UINT64(env.vregs[25][1].ll, S390CPU), + VMSTATE_UINT64(env.vregs[26][1].ll, S390CPU), + VMSTATE_UINT64(env.vregs[27][1].ll, S390CPU), + VMSTATE_UINT64(env.vregs[28][1].ll, S390CPU), + VMSTATE_UINT64(env.vregs[29][1].ll, S390CPU), + VMSTATE_UINT64(env.vregs[30][1].ll, S390CPU), + VMSTATE_UINT64(env.vregs[31][1].ll, S390CPU), + VMSTATE_END_OF_LIST() + } +}; + const VMStateDescription vmstate_s390_cpu = { .name = "cpu", .post_load = cpu_post_load, @@ -106,6 +164,9 @@ const VMStateDescription vmstate_s390_cpu = { .vmsd = &vmstate_fpu, .needed = fpu_needed, } , { + .vmsd = &vmstate_vregs, + .needed = vregs_needed, + } , { /* empty */ } }, -- 2.4.2