diff options
-rw-r--r-- | arch/powerpc/include/asm/kvm_para.h | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/kvm.c | 21 | ||||
-rw-r--r-- | arch/powerpc/kvm/powerpc.c | 5 |
3 files changed, 21 insertions, 7 deletions
diff --git a/arch/powerpc/include/asm/kvm_para.h b/arch/powerpc/include/asm/kvm_para.h index 7438ab360120..43c1b2260af8 100644 --- a/arch/powerpc/include/asm/kvm_para.h +++ b/arch/powerpc/include/asm/kvm_para.h | |||
@@ -47,6 +47,8 @@ struct kvm_vcpu_arch_shared { | |||
47 | 47 | ||
48 | #define KVM_FEATURE_MAGIC_PAGE 1 | 48 | #define KVM_FEATURE_MAGIC_PAGE 1 |
49 | 49 | ||
50 | #define KVM_MAGIC_FEAT_SR (1 << 0) | ||
51 | |||
50 | #ifdef __KERNEL__ | 52 | #ifdef __KERNEL__ |
51 | 53 | ||
52 | #ifdef CONFIG_KVM_GUEST | 54 | #ifdef CONFIG_KVM_GUEST |
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 | ||
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"); |
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index 6a53a3f86dae..496d7a5200dc 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c | |||
@@ -66,6 +66,8 @@ int kvmppc_kvm_pv(struct kvm_vcpu *vcpu) | |||
66 | vcpu->arch.magic_page_pa = param1; | 66 | vcpu->arch.magic_page_pa = param1; |
67 | vcpu->arch.magic_page_ea = param2; | 67 | vcpu->arch.magic_page_ea = param2; |
68 | 68 | ||
69 | r2 = 0; | ||
70 | |||
69 | r = HC_EV_SUCCESS; | 71 | r = HC_EV_SUCCESS; |
70 | break; | 72 | break; |
71 | } | 73 | } |
@@ -76,13 +78,14 @@ int kvmppc_kvm_pv(struct kvm_vcpu *vcpu) | |||
76 | #endif | 78 | #endif |
77 | 79 | ||
78 | /* Second return value is in r4 */ | 80 | /* Second return value is in r4 */ |
79 | kvmppc_set_gpr(vcpu, 4, r2); | ||
80 | break; | 81 | break; |
81 | default: | 82 | default: |
82 | r = HC_EV_UNIMPLEMENTED; | 83 | r = HC_EV_UNIMPLEMENTED; |
83 | break; | 84 | break; |
84 | } | 85 | } |
85 | 86 | ||
87 | kvmppc_set_gpr(vcpu, 4, r2); | ||
88 | |||
86 | return r; | 89 | return r; |
87 | } | 90 | } |
88 | 91 | ||