Skip to content

Commit 997224f

Browse files
committed
Merge tag 'kvm-s390-master-5.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux into kvm-master
KVM: s390: Fully do the CPU resets as intended With 7de3f14 ("KVM: s390: Add new reset vcpu API") we clarified the meaning of the reset ioctl to fully reset the CPU and not only the parts that can not be handled by userspace. Turns out that we missed some parts.
2 parents 0c22056 + e93fc7b commit 997224f

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)