Skip to content

Commit 15bc8d8

Browse files
borntraegerGleb Natapov
authored andcommitted
s390/kvm: Fix store status for ACRS/FPRS
On store status we need to copy the current state of registers into a save area. Currently we might save stale versions: The sie state descriptor doesnt have fields for guest ACRS,FPRS, those registers are simply stored in the host registers. The host program must copy these away if needed. We do that in vcpu_put/load. If we now do a store status in KVM code between vcpu_put/load, the saved values are not up-to-date. Lets collect the ACRS/FPRS before saving them. This also fixes some strange problems with hotplug and virtio-ccw, since the low level machine check handler (on hotplug a machine check will happen) will revalidate all registers with the content of the save area. Signed-off-by: Christian Borntraeger <[email protected]> CC: [email protected] Signed-off-by: Gleb Natapov <[email protected]>
1 parent c45c528 commit 15bc8d8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

arch/s390/kvm/kvm-s390.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,14 @@ int kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, unsigned long addr)
770770
} else
771771
prefix = 0;
772772

773+
/*
774+
* The guest FPRS and ACRS are in the host FPRS/ACRS due to the lazy
775+
* copying in vcpu load/put. Lets update our copies before we save
776+
* it into the save area
777+
*/
778+
save_fp_regs(&vcpu->arch.guest_fpregs);
779+
save_access_regs(vcpu->run->s.regs.acrs);
780+
773781
if (__guestcopy(vcpu, addr + offsetof(struct save_area, fp_regs),
774782
vcpu->arch.guest_fpregs.fprs, 128, prefix))
775783
return -EFAULT;

0 commit comments

Comments
 (0)