KVM: PPC: Add return value in prepare_to_enter
Our prepare_to_enter helper wants to be able to return in more circumstances
to the host than only when an interrupt is pending. Broaden the interface a
bit and move even more generic code to the generic helper.
Signed-off-by: Alexander Graf <agraf@suse.de>
diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
index 1ff0d6c..71fa0f1 100644
--- a/arch/powerpc/kvm/book3s_pr.c
+++ b/arch/powerpc/kvm/book3s_pr.c
@@ -589,6 +589,7 @@
unsigned int exit_nr)
{
int r = RESUME_HOST;
+ int s;
vcpu->stat.sum_exits++;
@@ -862,10 +863,10 @@
* again due to a host external interrupt.
*/
local_irq_disable();
- if (kvmppc_prepare_to_enter(vcpu)) {
+ s = kvmppc_prepare_to_enter(vcpu);
+ if (s <= 0) {
local_irq_enable();
- run->exit_reason = KVM_EXIT_INTR;
- r = -EINTR;
+ r = s;
} else {
kvmppc_lazy_ee_enable();
}
@@ -1074,10 +1075,9 @@
* a host external interrupt.
*/
local_irq_disable();
- if (kvmppc_prepare_to_enter(vcpu)) {
+ ret = kvmppc_prepare_to_enter(vcpu);
+ if (ret <= 0) {
local_irq_enable();
- kvm_run->exit_reason = KVM_EXIT_INTR;
- ret = -EINTR;
goto out;
}