aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kvm/44x.c
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2010-07-29 08:47:42 -0400
committerAvi Kivity <avi@redhat.com>2010-10-24 04:50:42 -0400
commit96bc451a153297bf1f99ef2d633d512ea349ae7a (patch)
tree75ab4d40387ea1295a23b180e4c8719ce7053d00 /arch/powerpc/kvm/44x.c
parent34698d8c61bd3fc86b2e99c3d1ad9ef140b3eb0d (diff)
KVM: PPC: Introduce shared page
For transparent variable sharing between the hypervisor and guest, I introduce a shared page. This shared page will contain all the registers the guest can read and write safely without exiting guest context. This patch only implements the stubs required for the basic structure of the shared page. The actual register moving follows. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/powerpc/kvm/44x.c')
-rw-r--r--arch/powerpc/kvm/44x.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/powerpc/kvm/44x.c b/arch/powerpc/kvm/44x.c
index 73c0a3f64ed1..e7b1f3fca5dc 100644
--- a/arch/powerpc/kvm/44x.c
+++ b/arch/powerpc/kvm/44x.c
@@ -123,8 +123,14 @@ struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id)
123 if (err) 123 if (err)
124 goto free_vcpu; 124 goto free_vcpu;
125 125
126 vcpu->arch.shared = (void*)__get_free_page(GFP_KERNEL|__GFP_ZERO);
127 if (!vcpu->arch.shared)
128 goto uninit_vcpu;
129
126 return vcpu; 130 return vcpu;
127 131
132uninit_vcpu:
133 kvm_vcpu_uninit(vcpu);
128free_vcpu: 134free_vcpu:
129 kmem_cache_free(kvm_vcpu_cache, vcpu_44x); 135 kmem_cache_free(kvm_vcpu_cache, vcpu_44x);
130out: 136out:
@@ -135,6 +141,7 @@ void kvmppc_core_vcpu_free(struct kvm_vcpu *vcpu)
135{ 141{
136 struct kvmppc_vcpu_44x *vcpu_44x = to_44x(vcpu); 142 struct kvmppc_vcpu_44x *vcpu_44x = to_44x(vcpu);
137 143
144 free_page((unsigned long)vcpu->arch.shared);
138 kvm_vcpu_uninit(vcpu); 145 kvm_vcpu_uninit(vcpu);
139 kmem_cache_free(kvm_vcpu_cache, vcpu_44x); 146 kmem_cache_free(kvm_vcpu_cache, vcpu_44x);
140} 147}