Skip to content

Commit e93fc7b

Browse files
committed
KVM: s390: Also reset registers in sync regs for initial cpu reset
When we do the initial CPU reset we must not only clear the registers in the internal data structures but also in kvm_run sync_regs. For modern userspace sync_regs is the only place that it looks at. Fixes: 7de3f14 ("KVM: s390: Add new reset vcpu API") Acked-by: David Hildenbrand <[email protected]> Signed-off-by: Christian Borntraeger <[email protected]>
1 parent d718fdc commit e93fc7b

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

arch/s390/kvm/kvm-s390.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3268,7 +3268,10 @@ static void kvm_arch_vcpu_ioctl_initial_reset(struct kvm_vcpu *vcpu)
32683268
/* Initial reset is a superset of the normal reset */
32693269
kvm_arch_vcpu_ioctl_normal_reset(vcpu);
32703270

3271-
/* this equals initial cpu reset in pop, but we don't switch to ESA */
3271+
/*
3272+
* This equals initial cpu reset in pop, but we don't switch to ESA.
3273+
* We do not only reset the internal data, but also ...
3274+
*/
32723275
vcpu->arch.sie_block->gpsw.mask = 0;
32733276
vcpu->arch.sie_block->gpsw.addr = 0;
32743277
kvm_s390_set_prefix(vcpu, 0);
@@ -3278,6 +3281,19 @@ static void kvm_arch_vcpu_ioctl_initial_reset(struct kvm_vcpu *vcpu)
32783281
memset(vcpu->arch.sie_block->gcr, 0, sizeof(vcpu->arch.sie_block->gcr));
32793282
vcpu->arch.sie_block->gcr[0] = CR0_INITIAL_MASK;
32803283
vcpu->arch.sie_block->gcr[14] = CR14_INITIAL_MASK;
3284+
3285+
/* ... the data in sync regs */
3286+
memset(vcpu->run->s.regs.crs, 0, sizeof(vcpu->run->s.regs.crs));
3287+
vcpu->run->s.regs.ckc = 0;
3288+
vcpu->run->s.regs.crs[0] = CR0_INITIAL_MASK;
3289+
vcpu->run->s.regs.crs[14] = CR14_INITIAL_MASK;
3290+
vcpu->run->psw_addr = 0;
3291+
vcpu->run->psw_mask = 0;
3292+
vcpu->run->s.regs.todpr = 0;
3293+
vcpu->run->s.regs.cputm = 0;
3294+
vcpu->run->s.regs.ckc = 0;
3295+
vcpu->run->s.regs.pp = 0;
3296+
vcpu->run->s.regs.gbea = 1;
32813297
vcpu->run->s.regs.fpc = 0;
32823298
vcpu->arch.sie_block->gbea = 1;
32833299
vcpu->arch.sie_block->pp = 0;

0 commit comments

Comments
 (0)