From patchwork Fri Jul 11 11:21:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 369129 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id C91461400E6 for ; Fri, 11 Jul 2014 21:23:12 +1000 (EST) Received: from localhost ([::1]:44183 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X5Yv0-0002Me-W5 for incoming@patchwork.ozlabs.org; Fri, 11 Jul 2014 07:23:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57388) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X5Ytb-0008RE-OE for qemu-devel@nongnu.org; Fri, 11 Jul 2014 07:21:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X5YtT-0000Nh-4a for qemu-devel@nongnu.org; Fri, 11 Jul 2014 07:21:43 -0400 Received: from e06smtp13.uk.ibm.com ([195.75.94.109]:41415) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X5YtS-0000ND-Rr for qemu-devel@nongnu.org; Fri, 11 Jul 2014 07:21:35 -0400 Received: from /spool/local by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 11 Jul 2014 12:21:33 +0100 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 11 Jul 2014 12:21:30 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id AB3281B0804B; Fri, 11 Jul 2014 12:22:08 +0100 (BST) Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by b06cxnps3074.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s6BBLU4834144392; Fri, 11 Jul 2014 11:21:30 GMT Received: from d06av02.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s6BBLTcV027757; Fri, 11 Jul 2014 05:21:29 -0600 Received: from gondolin.boeblingen.de.ibm.com (dyn-9-152-224-107.boeblingen.de.ibm.com [9.152.224.107]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s6BBLQxo027646; Fri, 11 Jul 2014 05:21:28 -0600 From: Cornelia Huck To: qemu-devel@nongnu.org Date: Fri, 11 Jul 2014 13:21:25 +0200 Message-Id: <1405077685-8469-2-git-send-email-cornelia.huck@de.ibm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1405077685-8469-1-git-send-email-cornelia.huck@de.ibm.com> References: <1405077685-8469-1-git-send-email-cornelia.huck@de.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14071111-2966-0000-0000-0000007F0B7E X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.75.94.109 Cc: qemu-stable@nongnu.org, agraf@suse.de, borntraeger@de.ibm.com, jfrei@linux.vnet.ibm.com, Cornelia Huck , "Jason J. Herne" Subject: [Qemu-devel] [PATCH v2 for-2.1 1/1] s390x/kvm: synchronize guest floating point registers 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 From: "Jason J. Herne" Add code to kvm_arch_get_registers and kvm_arch_put_registers to save/restore floating point registers. This missing sync was unnoticed until migration of userspace that uses fprs. Signed-off-by: Jason J. Herne Signed-off-by: Christian Borntraeger [Update patch to latest upstream] Cc: qemu-stable@nongnu.org Signed-off-by: Cornelia Huck Reviewed-by: Alexander Graf --- target-s390x/kvm.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c index a6e587b..a32d91a 100644 --- a/target-s390x/kvm.c +++ b/target-s390x/kvm.c @@ -207,6 +207,7 @@ int kvm_arch_put_registers(CPUState *cs, int level) CPUS390XState *env = &cpu->env; struct kvm_sregs sregs; struct kvm_regs regs; + struct kvm_fpu fpu; int r; int i; @@ -229,6 +230,17 @@ int kvm_arch_put_registers(CPUState *cs, int level) } } + /* Floating point */ + for (i = 0; i < 16; i++) { + fpu.fprs[i] = env->fregs[i].ll; + } + fpu.fpc = env->fpc; + + r = kvm_vcpu_ioctl(cs, KVM_SET_FPU, &fpu); + if (r < 0) { + return r; + } + /* Do we need to save more than that? */ if (level == KVM_PUT_RUNTIME_STATE) { return 0; @@ -296,6 +308,7 @@ int kvm_arch_get_registers(CPUState *cs) CPUS390XState *env = &cpu->env; struct kvm_sregs sregs; struct kvm_regs regs; + struct kvm_fpu fpu; int i, r; /* get the PSW */ @@ -336,6 +349,16 @@ int kvm_arch_get_registers(CPUState *cs) } } + /* Floating point */ + r = kvm_vcpu_ioctl(cs, KVM_GET_FPU, &fpu); + if (r < 0) { + return r; + } + for (i = 0; i < 16; i++) { + env->fregs[i].ll = fpu.fprs[i]; + } + env->fpc = fpu.fpc; + /* The prefix */ if (cap_sync_regs && cs->kvm_run->kvm_valid_regs & KVM_SYNC_PREFIX) { env->psa = cs->kvm_run->s.regs.prefix;