Skip to contentSkip to conversation

s390x/kvm: bugfix

GIT PULL Applied Cornelia Huck 2 participants 3 messages Jul 14, 2014

lore
Share & tools
lore
#0 lore raw

The following changes since commit ab6d3749c4915cd5692633e321f7745dce06fe77:

Merge remote-tracking branch 'remotes/kraxel/tags/pull-vga-20140711-1' into staging (2014-07-11 17:50:38 +0100)

are available in the git repository at:

git://github.com/cohuck/qemu.git tags/s390x-20140714

for you to fetch changes up to 85ad6230b3af048109b3e949ca95ade4dd9a0bfa:

s390x/kvm: synchronize guest floating point registers (2014-07-14 09:15:38 +0200)

----------------------------------------------------------------
A s390x/kvm bugfix for missing floating point register synchronization.

----------------------------------------------------------------
Jason J. Herne (1):
s390x/kvm: synchronize guest floating point registers

 target-s390x/kvm.c |   23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
Signature · 1 line
1.7.9.5
#1 lore raw

[Qemu-devel] [PULL for-2.1 1/1] s390x/kvm: synchronize guest floating point registers

From: "Jason J. Herne" <[email protected]>

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.

---
 target-s390x/kvm.c |   23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
target-s390x/kvm.c +23 -0
index a6e587b..a32d91a 100644
@@ -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;
Signature · 1 line
1.7.9.5
#2 lore raw
In reply to Cornelia Huck
Quoted 7 lines · Cornelia Huck

The following changes since commit ab6d3749c4915cd5692633e321f7745dce06fe77:

Merge remote-tracking branch 'remotes/kraxel/tags/pull-vga-20140711-1' into staging (2014-07-11 17:50:38 +0100)

are available in the git repository at:

Quoted 8 lines

git://github.com/cohuck/qemu.git tags/s390x-20140714

for you to fetch changes up to 85ad6230b3af048109b3e949ca95ade4dd9a0bfa:

s390x/kvm: synchronize guest floating point registers (2014-07-14 09:15:38 +0200)

----------------------------------------------------------------
A s390x/kvm bugfix for missing floating point register synchronization.

Applied, thanks.

-- PMM