Skip to content

Commit 5568089

Browse files
committed
KVM: s390: do not clobber registers during guest reset/store status
The initial CPU reset clobbers the userspace fpc and the store status ioctl clobbers the guest acrs + fpr. As these calls are only done via ioctl (and not via vcpu_run), no CPU context is loaded, so we can (and must) act directly on the sync regs, not on the thread context. Cc: [email protected] Fixes: e1788bb ("KVM: s390: handle floating point registers in the run ioctl not in vcpu_put/load") Fixes: 31d8b8d ("KVM: s390: handle access registers in the run ioctl not in vcpu_put/load") Signed-off-by: Christian Borntraeger <[email protected]> Reviewed-by: David Hildenbrand <[email protected]> Reviewed-by: Cornelia Huck <[email protected]> Signed-off-by: Janosch Frank <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Christian Borntraeger <[email protected]>
1 parent c611990 commit 5568089

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

arch/s390/kvm/kvm-s390.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2860,9 +2860,7 @@ static void kvm_s390_vcpu_initial_reset(struct kvm_vcpu *vcpu)
28602860
vcpu->arch.sie_block->gcr[14] = CR14_UNUSED_32 |
28612861
CR14_UNUSED_33 |
28622862
CR14_EXTERNAL_DAMAGE_SUBMASK;
2863-
/* make sure the new fpc will be lazily loaded */
2864-
save_fpu_regs();
2865-
current->thread.fpu.fpc = 0;
2863+
vcpu->run->s.regs.fpc = 0;
28662864
vcpu->arch.sie_block->gbea = 1;
28672865
vcpu->arch.sie_block->pp = 0;
28682866
vcpu->arch.sie_block->fpf &= ~FPF_BPBC;
@@ -4351,7 +4349,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
43514349
switch (ioctl) {
43524350
case KVM_S390_STORE_STATUS:
43534351
idx = srcu_read_lock(&vcpu->kvm->srcu);
4354-
r = kvm_s390_vcpu_store_status(vcpu, arg);
4352+
r = kvm_s390_store_status_unloaded(vcpu, arg);
43554353
srcu_read_unlock(&vcpu->kvm->srcu, idx);
43564354
break;
43574355
case KVM_S390_SET_INITIAL_PSW: {

0 commit comments

Comments
 (0)