KVM: PPC: Expose magic page support to guest
authorAlexander Graf <agraf@suse.de>
Thu, 29 Jul 2010 12:47:55 +0000 (14:47 +0200)
committerAvi Kivity <avi@redhat.com>
Sun, 24 Oct 2010 08:50:49 +0000 (10:50 +0200)
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>
arch/powerpc/include/asm/kvm_para.h
arch/powerpc/kvm/powerpc.c

index 0653b0d238b4b146b3c633fe6a934e3c8abc9ef2..7438ab360120e14345733a6dba2b7526d59006bd 100644 (file)
@@ -45,6 +45,8 @@ struct kvm_vcpu_arch_shared {
 #define HC_EV_SUCCESS          0
 #define HC_EV_UNIMPLEMENTED    12
 
+#define KVM_FEATURE_MAGIC_PAGE 1
+
 #ifdef __KERNEL__
 
 #ifdef CONFIG_KVM_GUEST
index a4cf4b47e2323f1f7cb8810539f0e660fbc5a15c..fecfe043458d145330f42435562030791e682add 100644 (file)
@@ -61,8 +61,19 @@ int kvmppc_kvm_pv(struct kvm_vcpu *vcpu)
        }
 
        switch (nr) {
+       case HC_VENDOR_KVM | KVM_HC_PPC_MAP_MAGIC_PAGE:
+       {
+               vcpu->arch.magic_page_pa = param1;
+               vcpu->arch.magic_page_ea = param2;
+
+               r = HC_EV_SUCCESS;
+               break;
+       }
        case HC_VENDOR_KVM | KVM_HC_FEATURES:
                r = HC_EV_SUCCESS;
+#if defined(CONFIG_PPC_BOOK3S) /* XXX Missing magic page on BookE */
+               r2 |= (1 << KVM_FEATURE_MAGIC_PAGE);
+#endif
 
                /* Second return value is in r4 */
                kvmppc_set_gpr(vcpu, 4, r2);