[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH v2 for-2.1 1/1] s390x/kvm: synchronize guest floati
From: |
Cornelia Huck |
Subject: |
[Qemu-stable] [PATCH v2 for-2.1 1/1] s390x/kvm: synchronize guest floating point registers |
Date: |
Fri, 11 Jul 2014 13:21:25 +0200 |
From: "Jason J. Herne" <address@hidden>
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 <address@hidden>
Signed-off-by: Christian Borntraeger <address@hidden>
[Update patch to latest upstream]
Cc: address@hidden
Signed-off-by: Cornelia Huck <address@hidden>
---
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
- [Qemu-stable] [PATCH v2 for-2.1 1/1] s390x/kvm: synchronize guest floating point registers,
Cornelia Huck <=