On 06/02/2020 15.39, David Hildenbrand wrote: > On 03.02.20 14:19, Christian Borntraeger 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. >> >> 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); >> + } >> 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: { >> > > Any reason why to not put that into the actual kvm_arch_vcpu_ioctl_* > functions? Because they are chained and you must not chain the UV calls. Thomas