aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2014-07-14 11:04:11 +0100
committerPeter Maydell <peter.maydell@linaro.org>2014-07-14 11:04:11 +0100
commitc15a34eda0f270888a0e4676997317e1bd7894b8 (patch)
tree75e8fcadedc0b2b36423ea5cc0390b1b75137bb5
parentab6d3749c4915cd5692633e321f7745dce06fe77 (diff)
parent85ad6230b3af048109b3e949ca95ade4dd9a0bfa (diff)
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20140714' into staging
A s390x/kvm bugfix for missing floating point register synchronization. # gpg: Signature made Mon 14 Jul 2014 08:21:54 BST using RSA key ID C6F02FAF # gpg: Can't check signature: public key not found * remotes/cohuck/tags/s390x-20140714: s390x/kvm: synchronize guest floating point registers Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--target-s390x/kvm.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c
index a6e587b589..a32d91aa01 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;