[1/4] PPC: KVM: introduce helper to check RESUME_GUEST and related

Message ID 20140206163656.3074.12268.stgit@bahia.lab.toulouse-stg.fr.ibm.com
State New, archived
Headers show

Commit Message

Greg Kurz Feb. 6, 2014, 4:36 p.m.
There are some locations where we check if the return value of a service
indicates that we should resume the guest. This patch introduces a helper
to handle the two possible values we currently have:

Since it only affects Book3S HV for now, the helper is added to
the kvm_book3s.h header file.

Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
 arch/powerpc/include/asm/kvm_book3s.h |    5 +++++
 1 file changed, 5 insertions(+)

To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h
index 83851aa..bb1e38a 100644
--- a/arch/powerpc/include/asm/kvm_book3s.h
+++ b/arch/powerpc/include/asm/kvm_book3s.h
@@ -304,6 +304,11 @@  static inline ulong kvmppc_get_fault_dar(struct kvm_vcpu *vcpu)
 	return vcpu->arch.fault_dar;
+static inline bool is_kvmppc_resume_guest(int r)
+	return (r == RESUME_GUEST || r == RESUME_GUEST_NV);
 /* Magic register values loaded into r3 and r4 before the 'sc' assembly
  * instruction for the OSI hypercalls */
 #define OSI_SC_MAGIC_R3			0x113724FA