Re: [PATCH v8 1/4] KVM: s390: Add new reset vcpu API

Christian Borntraeger
2020-01-30T09:59:05Z

On 29.01.20 21:03, Janosch Frank wrote:
[...]> +static void kvm_arch_vcpu_ioctl_initial_reset(struct kvm_vcpu *vcpu)
> +{
> + /* Initial reset is a superset of the normal reset */
> + kvm_arch_vcpu_ioctl_normal_reset(vcpu);
> +
> + /* this equals initial cpu reset in pop, but we don't switch to ESA */
> + vcpu->arch.sie_block->gpsw.mask = 0;
> + vcpu->arch.sie_block->gpsw.addr = 0;
> + kvm_s390_set_prefix(vcpu, 0);
> + kvm_s390_set_cpu_timer(vcpu, 0);
> + vcpu->arch.sie_block->ckc = 0;
> + vcpu->arch.sie_block->todpr = 0;
> + memset(vcpu->arch.sie_block->gcr, 0, sizeof(vcpu->arch.sie_block->gcr));
> + vcpu->arch.sie_block->gcr[0] = CR0_INITIAL_MASK;
> + vcpu->arch.sie_block->gcr[14] = CR14_INITIAL_MASK;
> + /* make sure the new fpc will be lazily loaded */
> + save_fpu_regs();

see my other patch. We should rebase this series and fix it here as well

> + current->thread.fpu.fpc = 0;
> + vcpu->arch.sie_block->gbea = 1;
> + vcpu->arch.sie_block->pp = 0;
> + vcpu->arch.sie_block->fpf &= ~FPF_BPBC;
> +}
> +
> +static void kvm_arch_vcpu_ioctl_clear_reset(struct kvm_vcpu *vcpu)
> +{
> + struct kvm_sync_regs *regs = &vcpu->run->s.regs;
> +
> + /* Clear reset is a superset of the initial reset */
> + kvm_arch_vcpu_ioctl_initial_reset(vcpu);
> +
> + memset(&regs->gprs, 0, sizeof(regs->gprs));
> + memset(&regs->vrs, 0, sizeof(regs->vrs));
> + memset(&regs->acrs, 0, sizeof(regs->acrs));
> +
> + regs->etoken = 0;
> + regs->etoken_extension = 0;
> +
> + memset(&regs->gscb, 0, sizeof(regs->gscb));

> + if (MACHINE_HAS_GS) {
> + preempt_disable();
> + __ctl_set_bit(2, 4);
> + if (current->thread.gs_cb) {
> + vcpu->arch.host_gscb = current->thread.gs_cb;
> + save_gs_cb(vcpu->arch.host_gscb);
> + }
> + if (vcpu->arch.gs_enabled) {
> + current->thread.gs_cb = (struct gs_cb *)
> + &vcpu->run->s.regs.gscb;
> + restore_gs_cb(current->thread.gs_cb);
> + }
> + preempt_enable();
> + }

I think this hunk can go? (same reason as for floating point)

Other than that this looks good.