On Mon, 3 Feb 2020 08:19:57 -0500 Christian Borntraeger <borntraeger@xxxxxxxxxx> wrote: > From: Janosch Frank <frankja@xxxxxxxxxxxxx> > > For protected VMs, the VCPU resets are done by the Ultravisor, as KVM > has no access to the VCPU registers. > > As the Ultravisor will only accept a call for the reset that is > needed, we need to fence the UV calls when chaining resets. Stale note, chaining resets is gone? "Note that the ultravisor will only accept a call for the exact reset that has been requested." ? > > Signed-off-by: Janosch Frank <frankja@xxxxxxxxxxxxx> > --- > arch/s390/kvm/kvm-s390.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c > index 3e4716b3fc02..f7a3f84be064 100644 > --- a/arch/s390/kvm/kvm-s390.c > +++ b/arch/s390/kvm/kvm-s390.c > @@ -4699,6 +4699,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp, > void __user *argp = (void __user *)arg; > int idx; > long r; > + u32 ret; > > vcpu_load(vcpu); > > @@ -4720,14 +4721,33 @@ long kvm_arch_vcpu_ioctl(struct file *filp, > case KVM_S390_CLEAR_RESET: > r = 0; > kvm_arch_vcpu_ioctl_clear_reset(vcpu); > + if (kvm_s390_pv_handle_cpu(vcpu)) { > + r = uv_cmd_nodata(kvm_s390_pv_handle_cpu(vcpu), > + UVC_CMD_CPU_RESET_CLEAR, &ret); > + VCPU_EVENT(vcpu, 3, "PROTVIRT RESET CLEAR VCPU: cpu %d rc %x rrc %x", > + vcpu->vcpu_id, ret >> 16, ret & 0x0000ffff); I think VCPU_EVENT() already traces the vcpu_id, doesn't it? > + } > break; > case KVM_S390_INITIAL_RESET: > r = 0; > kvm_arch_vcpu_ioctl_initial_reset(vcpu); > + if (kvm_s390_pv_handle_cpu(vcpu)) { > + r = uv_cmd_nodata(kvm_s390_pv_handle_cpu(vcpu), > + UVC_CMD_CPU_RESET_INITIAL, > + &ret); > + VCPU_EVENT(vcpu, 3, "PROTVIRT RESET INITIAL VCPU: cpu %d rc %x rrc %x", > + vcpu->vcpu_id, ret >> 16, ret & 0x0000ffff); > + } > break; > case KVM_S390_NORMAL_RESET: > r = 0; > kvm_arch_vcpu_ioctl_normal_reset(vcpu); > + if (kvm_s390_pv_handle_cpu(vcpu)) { > + r = uv_cmd_nodata(kvm_s390_pv_handle_cpu(vcpu), > + UVC_CMD_CPU_RESET, &ret); > + VCPU_EVENT(vcpu, 3, "PROTVIRT RESET NORMAL VCPU: cpu %d rc %x rrc %x", > + vcpu->vcpu_id, ret >> 16, ret & 0x0000ffff); > + } > break; > case KVM_SET_ONE_REG: > case KVM_GET_ONE_REG: { Otherwise, looks good.