aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2010-08-03 05:32:56 -0400
committerAvi Kivity <avi@redhat.com>2010-10-24 04:52:09 -0400
commit7508e16c9f2a20f7721d7bc47c33a7b34c873a2c (patch)
treedac48c9ea56f69f4d8b9759aa51349bad0f3abdc /arch/powerpc/kernel
parentcb24c50826e0722bffb0674f088954cd4980818b (diff)
KVM: PPC: Add feature bitmap for magic page
We will soon add SR PV support to the shared page, so we need some infrastructure that allows the guest to query for features KVM exports. This patch adds a second return value to the magic mapping that indicated to the guest which features are available. Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r--arch/powerpc/kernel/kvm.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c
index d3a2cc50d611..226882fe85a6 100644
--- a/arch/powerpc/kernel/kvm.c
+++ b/arch/powerpc/kernel/kvm.c
@@ -266,12 +266,20 @@ static void kvm_patch_ins_wrteei(u32 *inst)
266 266
267static void kvm_map_magic_page(void *data) 267static void kvm_map_magic_page(void *data)
268{ 268{
269 kvm_hypercall2(KVM_HC_PPC_MAP_MAGIC_PAGE, 269 u32 *features = data;
270 KVM_MAGIC_PAGE, /* Physical Address */ 270
271 KVM_MAGIC_PAGE); /* Effective Address */ 271 ulong in[8];
272 ulong out[8];
273
274 in[0] = KVM_MAGIC_PAGE;
275 in[1] = KVM_MAGIC_PAGE;
276
277 kvm_hypercall(in, out, HC_VENDOR_KVM | KVM_HC_PPC_MAP_MAGIC_PAGE);
278
279 *features = out[0];
272} 280}
273 281
274static void kvm_check_ins(u32 *inst) 282static void kvm_check_ins(u32 *inst, u32 features)
275{ 283{
276 u32 _inst = *inst; 284 u32 _inst = *inst;
277 u32 inst_no_rt = _inst & ~KVM_MASK_RT; 285 u32 inst_no_rt = _inst & ~KVM_MASK_RT;
@@ -367,9 +375,10 @@ static void kvm_use_magic_page(void)
367 u32 *p; 375 u32 *p;
368 u32 *start, *end; 376 u32 *start, *end;
369 u32 tmp; 377 u32 tmp;
378 u32 features;
370 379
371 /* Tell the host to map the magic page to -4096 on all CPUs */ 380 /* Tell the host to map the magic page to -4096 on all CPUs */
372 on_each_cpu(kvm_map_magic_page, NULL, 1); 381 on_each_cpu(kvm_map_magic_page, &features, 1);
373 382
374 /* Quick self-test to see if the mapping works */ 383 /* Quick self-test to see if the mapping works */
375 if (__get_user(tmp, (u32*)KVM_MAGIC_PAGE)) { 384 if (__get_user(tmp, (u32*)KVM_MAGIC_PAGE)) {
@@ -382,7 +391,7 @@ static void kvm_use_magic_page(void)
382 end = (void*)_etext; 391 end = (void*)_etext;
383 392
384 for (p = start; p < end; p++) 393 for (p = start; p < end; p++)
385 kvm_check_ins(p); 394 kvm_check_ins(p, features);
386 395
387 printk(KERN_INFO "KVM: Live patching for a fast VM %s\n", 396 printk(KERN_INFO "KVM: Live patching for a fast VM %s\n",
388 kvm_patching_worked ? "worked" : "failed"); 397 kvm_patching_worked ? "worked" : "failed");