Message ID | 20200207113958.7320-35-borntraeger@de.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | KVM: s390: Add support for protected VMs | expand |
On Fri, 7 Feb 2020 06:39:57 -0500 Christian Borntraeger <borntraeger@de.ibm.com> wrote: > From: Janosch Frank <frankja@linux.ibm.com> > > 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. Last time, I suggested replacing this with "Note that the ultravisor will only accept a call for the exact reset that has been requested." I still suggest that :) > > Signed-off-by: Janosch Frank <frankja@linux.ibm.com> > Reviewed-by: Thomas Huth <thuth@redhat.com> > Reviewed-by: David Hildenbrand <david@redhat.com> > [borntraeger@de.ibm.com: patch merging, splitting, fixing] > Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> > --- > arch/s390/kvm/kvm-s390.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) Reviewed-by: Cornelia Huck <cohuck@redhat.com>
On 10.02.20 14:17, Cornelia Huck wrote: > On Fri, 7 Feb 2020 06:39:57 -0500 > Christian Borntraeger <borntraeger@de.ibm.com> wrote: > >> From: Janosch Frank <frankja@linux.ibm.com> >> >> 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. > > Last time, I suggested replacing this with > > "Note that the ultravisor will only accept a call for the exact reset > that has been requested." > > I still suggest that :) Will do. > >> >> Signed-off-by: Janosch Frank <frankja@linux.ibm.com> >> Reviewed-by: Thomas Huth <thuth@redhat.com> >> Reviewed-by: David Hildenbrand <david@redhat.com> >> [borntraeger@de.ibm.com: patch merging, splitting, fixing] >> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> >> --- >> arch/s390/kvm/kvm-s390.c | 20 ++++++++++++++++++++ >> 1 file changed, 20 insertions(+) > > Reviewed-by: Cornelia Huck <cohuck@redhat.com> >
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 27365fea5f95..a56660607fd5 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -4706,6 +4706,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp, void __user *argp = (void __user *)arg; int idx; long r; + u32 uvret; vcpu_load(vcpu); @@ -4727,14 +4728,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, &uvret); + VCPU_EVENT(vcpu, 3, "PROTVIRT RESET CLEAR VCPU: rc %x rrc %x", + uvret >> 16, uvret & 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, + &uvret); + VCPU_EVENT(vcpu, 3, "PROTVIRT RESET INITIAL VCPU: rc %x rrc %x", + uvret >> 16, uvret & 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, &uvret); + VCPU_EVENT(vcpu, 3, "PROTVIRT RESET NORMAL VCPU: rc %x rrc %x", + uvret >> 16, uvret & 0x0000ffff); + } break; case KVM_SET_ONE_REG: case KVM_GET_ONE_REG: {