From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45465) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X6agC-0002Dj-J3 for qemu-devel@nongnu.org; Mon, 14 Jul 2014 03:28:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X6ag4-0001Kk-5z for qemu-devel@nongnu.org; Mon, 14 Jul 2014 03:28:08 -0400 Received: from e06smtp14.uk.ibm.com ([195.75.94.110]:50322) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X6ag3-0001JE-Sy for qemu-devel@nongnu.org; Mon, 14 Jul 2014 03:28:00 -0400 Received: from /spool/local by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 14 Jul 2014 08:27:57 +0100 From: Cornelia Huck Date: Mon, 14 Jul 2014 09:27:49 +0200 Message-Id: <1405322869-29823-2-git-send-email-cornelia.huck@de.ibm.com> In-Reply-To: <1405322869-29823-1-git-send-email-cornelia.huck@de.ibm.com> References: <1405322869-29823-1-git-send-email-cornelia.huck@de.ibm.com> Subject: [Qemu-devel] [PULL for-2.1 1/1] s390x/kvm: synchronize guest floating point registers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, qemu-stable@nongnu.org, "Jason J. Herne" , agraf@suse.de, borntraeger@de.ibm.com, jfrei@linux.vnet.ibm.com, aliguori@amazon.com, Cornelia Huck 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 --- 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; -- 1.7.9.5