From patchwork Fri Jul 11 10:38:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 369115 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 23C62140080 for ; Fri, 11 Jul 2014 20:42:02 +1000 (EST) Received: from localhost ([::1]:43913 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X5YHA-0001cW-FW for incoming@patchwork.ozlabs.org; Fri, 11 Jul 2014 06:42:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55436) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X5YEQ-0006HF-Su for qemu-devel@nongnu.org; Fri, 11 Jul 2014 06:39:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X5YEI-0001eb-F1 for qemu-devel@nongnu.org; Fri, 11 Jul 2014 06:39:10 -0400 Received: from e06smtp13.uk.ibm.com ([195.75.94.109]:55992) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X5YEI-0001e9-2v for qemu-devel@nongnu.org; Fri, 11 Jul 2014 06:39:02 -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 11:39:00 +0100 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) 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 11:38:57 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 74F8417D8062; Fri, 11 Jul 2014 11:40:31 +0100 (BST) Received: from d06av05.portsmouth.uk.ibm.com (d06av05.portsmouth.uk.ibm.com [9.149.37.229]) by b06cxnps3075.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s6BActHG28967014; Fri, 11 Jul 2014 10:38:55 GMT Received: from d06av05.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s6BActFf012425; Fri, 11 Jul 2014 04:38:55 -0600 Received: from gondolin.boeblingen.de.ibm.com (dyn-9-152-224-107.boeblingen.de.ibm.com [9.152.224.107]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s6BAcrUB012363; Fri, 11 Jul 2014 04:38:54 -0600 From: Cornelia Huck To: qemu-devel@nongnu.org Date: Fri, 11 Jul 2014 12:38:51 +0200 Message-Id: <1405075131-2721-2-git-send-email-cornelia.huck@de.ibm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1405075131-2721-1-git-send-email-cornelia.huck@de.ibm.com> References: <1405075131-2721-1-git-send-email-cornelia.huck@de.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14071110-2966-0000-0000-0000007EE339 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 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 --- target-s390x/kvm.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c index a6e587b..144189b 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;