aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2010-07-29 08:47:55 -0400
committerAvi Kivity <avi@redhat.com>2010-10-24 04:50:49 -0400
commit5fc87407b55f5799418f4dc5931232c2bc06d077 (patch)
treea4551597970f86783b53a02016387c89d1a5c703
parente8508940a88691ad3d1c46608cd968eb4be9cbc5 (diff)
KVM: PPC: Expose magic page support to guest
Now that we have the shared page in place and the MMU code knows about the magic page, we can expose that capability to the guest! Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r--arch/powerpc/include/asm/kvm_para.h2
-rw-r--r--arch/powerpc/kvm/powerpc.c11
2 files changed, 13 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/kvm_para.h b/arch/powerpc/include/asm/kvm_para.h
index 0653b0d238b4..7438ab360120 100644
--- a/arch/powerpc/include/asm/kvm_para.h
+++ b/arch/powerpc/include/asm/kvm_para.h
@@ -45,6 +45,8 @@ struct kvm_vcpu_arch_shared {
45#define HC_EV_SUCCESS 0 45#define HC_EV_SUCCESS 0
46#define HC_EV_UNIMPLEMENTED 12 46#define HC_EV_UNIMPLEMENTED 12
47 47
48#define KVM_FEATURE_MAGIC_PAGE 1
49
48#ifdef __KERNEL__ 50#ifdef __KERNEL__
49 51
50#ifdef CONFIG_KVM_GUEST 52#ifdef CONFIG_KVM_GUEST
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index a4cf4b47e232..fecfe043458d 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -61,8 +61,19 @@ int kvmppc_kvm_pv(struct kvm_vcpu *vcpu)
61 } 61 }
62 62
63 switch (nr) { 63 switch (nr) {
64 case HC_VENDOR_KVM | KVM_HC_PPC_MAP_MAGIC_PAGE:
65 {
66 vcpu->arch.magic_page_pa = param1;
67 vcpu->arch.magic_page_ea = param2;
68
69 r = HC_EV_SUCCESS;
70 break;
71 }
64 case HC_VENDOR_KVM | KVM_HC_FEATURES: 72 case HC_VENDOR_KVM | KVM_HC_FEATURES:
65 r = HC_EV_SUCCESS; 73 r = HC_EV_SUCCESS;
74#if defined(CONFIG_PPC_BOOK3S) /* XXX Missing magic page on BookE */
75 r2 |= (1 << KVM_FEATURE_MAGIC_PAGE);
76#endif
66 77
67 /* Second return value is in r4 */ 78 /* Second return value is in r4 */
68 kvmppc_set_gpr(vcpu, 4, r2); 79 kvmppc_set_gpr(vcpu, 4, r2);