[PATCH 15/27] KVM: PPC: Expose magic page support to guest

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Alexander Graf
Date: Thursday, July 1, 2010 - 3:42 am

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>
---
 arch/powerpc/include/asm/kvm_para.h |    2 ++
 arch/powerpc/kvm/powerpc.c          |   11 +++++++++++
 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 82131fc..3cae15d 100644
--- a/arch/powerpc/include/asm/kvm_para.h
+++ b/arch/powerpc/include/asm/kvm_para.h
@@ -43,6 +43,8 @@ struct kvm_vcpu_arch_shared {
 #define KVM_SC_MAGIC_R0		0x4b564d52 /* "KVMR" */
 #define KVM_SC_MAGIC_R3		0x554c455a /* "ULEZ" */
 
+#define KVM_FEATURE_MAGIC_PAGE	1
+
 #ifdef __KERNEL__
 
 static inline int kvm_para_available(void)
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 1ebb29e..0be119a 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -60,8 +60,19 @@ int kvmppc_kvm_pv(struct kvm_vcpu *vcpu)
 	}
 
 	switch (nr) {
+	case KVM_HC_PPC_MAP_MAGIC_PAGE:
+	{
+		vcpu->arch.magic_page_pa = param1;
+		vcpu->arch.magic_page_ea = param2;
+
+		r = 0;
+		break;
+	}
 	case KVM_HC_FEATURES:
 		r = 0;
+#if !defined(CONFIG_KVM_440) /* XXX missing bits on 440 */
+		r |= (1 << KVM_FEATURE_MAGIC_PAGE);
+#endif
 		break;
 	default:
 		r = -KVM_ENOSYS;
-- 
1.6.0.2

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 00/27] KVM PPC PV framework, Alexander Graf, (Thu Jul 1, 3:42 am)
[PATCH 01/27] KVM: PPC: Introduce shared page, Alexander Graf, (Thu Jul 1, 3:42 am)
[PATCH 02/27] KVM: PPC: Convert MSR to shared page, Alexander Graf, (Thu Jul 1, 3:42 am)
[PATCH 03/27] KVM: PPC: Convert DSISR to shared page, Alexander Graf, (Thu Jul 1, 3:42 am)
[PATCH 04/27] KVM: PPC: Convert DAR to shared page., Alexander Graf, (Thu Jul 1, 3:42 am)
[PATCH 07/27] KVM: PPC: Implement hypervisor interface, Alexander Graf, (Thu Jul 1, 3:42 am)
[PATCH 08/27] KVM: PPC: Add PV guest critical sections, Alexander Graf, (Thu Jul 1, 3:42 am)
[PATCH 09/27] KVM: PPC: Add PV guest scratch registers, Alexander Graf, (Thu Jul 1, 3:42 am)
[PATCH 11/27] KVM: PPC: Make RMO a define, Alexander Graf, (Thu Jul 1, 3:42 am)
[PATCH 13/27] KVM: PPC: Magic Page Book3s support, Alexander Graf, (Thu Jul 1, 3:42 am)
[PATCH 14/27] KVM: PPC: Magic Page BookE support, Alexander Graf, (Thu Jul 1, 3:42 am)
[PATCH 15/27] KVM: PPC: Expose magic page support to guest, Alexander Graf, (Thu Jul 1, 3:42 am)
[PATCH 17/27] KVM: PPC: Generic KVM PV guest support, Alexander Graf, (Thu Jul 1, 3:42 am)
[PATCH 18/27] KVM: PPC: KVM PV guest stubs, Alexander Graf, (Thu Jul 1, 3:42 am)
[PATCH 20/27] KVM: PPC: PV tlbsync to nop, Alexander Graf, (Thu Jul 1, 3:42 am)
[PATCH 21/27] KVM: PPC: Introduce kvm_tmp framework, Alexander Graf, (Thu Jul 1, 3:42 am)
[PATCH 22/27] KVM: PPC: Introduce branch patching helper, Alexander Graf, (Thu Jul 1, 3:42 am)
[PATCH 23/27] KVM: PPC: PV assembler helpers, Alexander Graf, (Thu Jul 1, 3:42 am)
[PATCH 24/27] KVM: PPC: PV mtmsrd L=1, Alexander Graf, (Thu Jul 1, 3:42 am)
[PATCH 25/27] KVM: PPC: PV mtmsrd L=0 and mtmsr, Alexander Graf, (Thu Jul 1, 3:43 am)
[PATCH 26/27] KVM: PPC: PV wrteei, Alexander Graf, (Thu Jul 1, 3:43 am)
Re: [PATCH 14/27] KVM: PPC: Magic Page BookE support, Alexander Graf, (Thu Jul 1, 5:25 am)
Re: [PATCH 16/27] KVM: Move kvm_guest_init out of generic code, Geert Uytterhoeven, (Fri Jul 2, 12:41 am)
Re: [PATCH 13/27] KVM: PPC: Magic Page Book3s support, Alexander Graf, (Fri Jul 2, 8:37 am)
Re: [PATCH 00/27] KVM PPC PV framework, Segher Boessenkool, (Fri Jul 2, 9:22 am)
Re: [PATCH 11/27] KVM: PPC: Make RMO a define, Segher Boessenkool, (Fri Jul 2, 9:23 am)
Re: [PATCH 27/27] KVM: PPC: Add Documentation about PV int ..., Segher Boessenkool, (Fri Jul 2, 9:27 am)
Re: [PATCH 00/27] KVM PPC PV framework, Alexander Graf, (Fri Jul 2, 9:59 am)
Re: [PATCH 27/27] KVM: PPC: Add Documentation about PV int ..., Benjamin Herrenschmidt, (Sat Jul 3, 3:41 pm)
Re: [PATCH 27/27] KVM: PPC: Add Documentation about PV int ..., Benjamin Herrenschmidt, (Sat Jul 3, 3:42 pm)
Re: [PATCH 00/27] KVM PPC PV framework, MJ embd, (Thu Jul 8, 9:57 pm)
Re: [PATCH 00/27] KVM PPC PV framework, Alexander Graf, (Thu Jul 8, 11:33 pm)
RE: [PATCH 14/27] KVM: PPC: Magic Page BookE support, Liu Yu-B13201, (Mon Jul 12, 4:24 am)