diff options
Diffstat (limited to 'arch/powerpc/kernel/kvm.c')
-rw-r--r-- | arch/powerpc/kernel/kvm.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c index d3a2cc50d61..226882fe85a 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 | ||
267 | static void kvm_map_magic_page(void *data) | 267 | static 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 | ||
274 | static void kvm_check_ins(u32 *inst) | 282 | static 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"); |