From patchwork Wed Aug 6 20:39:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 377637 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 060401400D6 for ; Thu, 7 Aug 2014 07:40:21 +1000 (EST) Received: from localhost ([::1]:41584 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XF8wV-0007T9-5M for incoming@patchwork.ozlabs.org; Wed, 06 Aug 2014 17:40:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39975) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XF84u-0003Fe-RS for qemu-devel@nongnu.org; Wed, 06 Aug 2014 16:45:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XF84W-00060H-7b for qemu-devel@nongnu.org; Wed, 06 Aug 2014 16:44:56 -0400 Received: from e8.ny.us.ibm.com ([32.97.182.138]:45630) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XF84W-000603-2R for qemu-devel@nongnu.org; Wed, 06 Aug 2014 16:44:32 -0400 Received: from /spool/local by e8.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 6 Aug 2014 16:44:31 -0400 Received: from d01dlp03.pok.ibm.com (9.56.250.168) by e8.ny.us.ibm.com (192.168.1.108) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 6 Aug 2014 16:44:30 -0400 Received: from b01cxnp22035.gho.pok.ibm.com (b01cxnp22035.gho.pok.ibm.com [9.57.198.25]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id 4F0CCC90026; Wed, 6 Aug 2014 16:44:22 -0400 (EDT) Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by b01cxnp22035.gho.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s76KiTnh63897642; Wed, 6 Aug 2014 20:44:29 GMT Received: from d01av02.pok.ibm.com (localhost [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s76KiTRX007358; Wed, 6 Aug 2014 16:44:29 -0400 Received: from localhost ([9.80.101.111]) by d01av02.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s76KiSlL007324; Wed, 6 Aug 2014 16:44:29 -0400 From: Michael Roth To: qemu-devel@nongnu.org Date: Wed, 6 Aug 2014 15:39:53 -0500 Message-Id: <1407357598-21541-104-git-send-email-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1407357598-21541-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1407357598-21541-1-git-send-email-mdroth@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14080620-0320-0000-0000-0000002B4E42 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 32.97.182.138 Cc: qemu-stable@nongnu.org Subject: [Qemu-devel] [PATCH 103/108] 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 Reviewed-by: Alexander Graf Signed-off-by: Cornelia Huck (cherry picked from commit 85ad6230b3af048109b3e949ca95ade4dd9a0bfa) Signed-off-by: Michael Roth --- target-s390x/kvm.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c index daaabbd..7406b06 100644 --- a/target-s390x/kvm.c +++ b/target-s390x/kvm.c @@ -164,6 +164,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; @@ -186,6 +187,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; @@ -251,6 +263,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 */ @@ -291,6 +304,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;