Commit a76ccff6 authored by Thomas Huth's avatar Thomas Huth Committed by Paolo Bonzini

KVM: s390: Push run loop into __vcpu_run

Moved the do-while loop from kvm_arch_vcpu_ioctl_run into __vcpu_run
and the calling of kvm_handle_sie_intercept() into vcpu_post_run()
(so we can add the srcu locks in a proper way in the next patch).
Signed-off-by: default avatarThomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 3fb4c40f
...@@ -738,6 +738,13 @@ static int vcpu_post_run(struct kvm_vcpu *vcpu, int exit_reason) ...@@ -738,6 +738,13 @@ static int vcpu_post_run(struct kvm_vcpu *vcpu, int exit_reason)
memcpy(&vcpu->run->s.regs.gprs[14], &vcpu->arch.sie_block->gg14, 16); memcpy(&vcpu->run->s.regs.gprs[14], &vcpu->arch.sie_block->gg14, 16);
if (rc == 0) {
if (kvm_is_ucontrol(vcpu->kvm))
rc = -EOPNOTSUPP;
else
rc = kvm_handle_sie_intercept(vcpu);
}
return rc; return rc;
} }
...@@ -745,21 +752,24 @@ static int __vcpu_run(struct kvm_vcpu *vcpu) ...@@ -745,21 +752,24 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
{ {
int rc, exit_reason; int rc, exit_reason;
do {
rc = vcpu_pre_run(vcpu); rc = vcpu_pre_run(vcpu);
if (rc) if (rc)
return rc; break;
/* /*
* As PF_VCPU will be used in fault handler, between guest_enter * As PF_VCPU will be used in fault handler, between
* and guest_exit should be no uaccess. * guest_enter and guest_exit should be no uaccess.
*/ */
preempt_disable(); preempt_disable();
kvm_guest_enter(); kvm_guest_enter();
preempt_enable(); preempt_enable();
exit_reason = sie64a(vcpu->arch.sie_block, vcpu->run->s.regs.gprs); exit_reason = sie64a(vcpu->arch.sie_block,
vcpu->run->s.regs.gprs);
kvm_guest_exit(); kvm_guest_exit();
rc = vcpu_post_run(vcpu, exit_reason); rc = vcpu_post_run(vcpu, exit_reason);
} while (!signal_pending(current) && !rc);
return rc; return rc;
} }
...@@ -801,16 +811,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) ...@@ -801,16 +811,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
} }
might_fault(); might_fault();
do {
rc = __vcpu_run(vcpu); rc = __vcpu_run(vcpu);
if (rc)
break;
if (kvm_is_ucontrol(vcpu->kvm))
rc = -EOPNOTSUPP;
else
rc = kvm_handle_sie_intercept(vcpu);
} while (!signal_pending(current) && !rc);
if (signal_pending(current) && !rc) { if (signal_pending(current) && !rc) {
kvm_run->exit_reason = KVM_EXIT_INTR; kvm_run->exit_reason = KVM_EXIT_INTR;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment