summaryrefslogtreecommitdiffstats
path: root/arch/arm/include/asm/kvm_host.h
diff options
context:
space:
mode:
authorMarc Zyngier <marc.zyngier@arm.com>2012-10-05 15:10:44 +0100
committerChristoffer Dall <cdall@cs.columbia.edu>2013-03-06 15:48:44 -0800
commite7858c58d52237a4519e2fdb1ce8f2d9805ce0ce (patch)
tree551887bf4a54ce5d91de84da75a79a3baac8522b /arch/arm/include/asm/kvm_host.h
parent629dc446a49a1c3b4f31a3fdc2c814a7db6c6199 (diff)
downloadblackbird-op-linux-e7858c58d52237a4519e2fdb1ce8f2d9805ce0ce.tar.gz
blackbird-op-linux-e7858c58d52237a4519e2fdb1ce8f2d9805ce0ce.zip
ARM: KVM: move hyp init to kvm_host.h
Make the split of the pgd_ptr an implementation specific thing by moving the init call to an inline function. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'arch/arm/include/asm/kvm_host.h')
-rw-r--r--arch/arm/include/asm/kvm_host.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h
index 24f457aeba4d..f00a557c107a 100644
--- a/arch/arm/include/asm/kvm_host.h
+++ b/arch/arm/include/asm/kvm_host.h
@@ -186,4 +186,23 @@ int kvm_arm_coproc_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *);
int handle_exit(struct kvm_vcpu *vcpu, struct kvm_run *run,
int exception_index);
+static inline void __cpu_init_hyp_mode(unsigned long long pgd_ptr,
+ unsigned long hyp_stack_ptr,
+ unsigned long vector_ptr)
+{
+ unsigned long pgd_low, pgd_high;
+
+ pgd_low = (pgd_ptr & ((1ULL << 32) - 1));
+ pgd_high = (pgd_ptr >> 32ULL);
+
+ /*
+ * Call initialization code, and switch to the full blown
+ * HYP code. The init code doesn't need to preserve these registers as
+ * r1-r3 and r12 are already callee save according to the AAPCS.
+ * Note that we slightly misuse the prototype by casing the pgd_low to
+ * a void *.
+ */
+ kvm_call_hyp((void *)pgd_low, pgd_high, hyp_stack_ptr, vector_ptr);
+}
+
#endif /* __ARM_KVM_HOST_H__ */
OpenPOWER on IntegriCloud