aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kvm/book3s.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/kvm/book3s.c')
-rw-r--r--arch/powerpc/kvm/book3s.c41
1 files changed, 25 insertions, 16 deletions
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
index 55c38e598280..a9f45197a036 100644
--- a/arch/powerpc/kvm/book3s.c
+++ b/arch/powerpc/kvm/book3s.c
@@ -440,55 +440,64 @@ err:
440 return kvmppc_bad_hva(); 440 return kvmppc_bad_hva();
441} 441}
442 442
443int kvmppc_st(struct kvm_vcpu *vcpu, ulong eaddr, int size, void *ptr) 443int kvmppc_st(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr,
444 bool data)
444{ 445{
445 struct kvmppc_pte pte; 446 struct kvmppc_pte pte;
446 hva_t hva = eaddr; 447 hva_t hva = *eaddr;
447 448
448 vcpu->stat.st++; 449 vcpu->stat.st++;
449 450
450 if (kvmppc_xlate(vcpu, eaddr, false, &pte)) 451 if (kvmppc_xlate(vcpu, *eaddr, data, &pte))
451 goto err; 452 goto nopte;
453
454 *eaddr = pte.raddr;
452 455
453 hva = kvmppc_pte_to_hva(vcpu, &pte, false); 456 hva = kvmppc_pte_to_hva(vcpu, &pte, false);
454 if (kvm_is_error_hva(hva)) 457 if (kvm_is_error_hva(hva))
455 goto err; 458 goto mmio;
456 459
457 if (copy_to_user((void __user *)hva, ptr, size)) { 460 if (copy_to_user((void __user *)hva, ptr, size)) {
458 printk(KERN_INFO "kvmppc_st at 0x%lx failed\n", hva); 461 printk(KERN_INFO "kvmppc_st at 0x%lx failed\n", hva);
459 goto err; 462 goto mmio;
460 } 463 }
461 464
462 return 0; 465 return EMULATE_DONE;
463 466
464err: 467nopte:
465 return -ENOENT; 468 return -ENOENT;
469mmio:
470 return EMULATE_DO_MMIO;
466} 471}
467 472
468int kvmppc_ld(struct kvm_vcpu *vcpu, ulong eaddr, int size, void *ptr, 473int kvmppc_ld(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr,
469 bool data) 474 bool data)
470{ 475{
471 struct kvmppc_pte pte; 476 struct kvmppc_pte pte;
472 hva_t hva = eaddr; 477 hva_t hva = *eaddr;
473 478
474 vcpu->stat.ld++; 479 vcpu->stat.ld++;
475 480
476 if (kvmppc_xlate(vcpu, eaddr, data, &pte)) 481 if (kvmppc_xlate(vcpu, *eaddr, data, &pte))
477 goto err; 482 goto nopte;
483
484 *eaddr = pte.raddr;
478 485
479 hva = kvmppc_pte_to_hva(vcpu, &pte, true); 486 hva = kvmppc_pte_to_hva(vcpu, &pte, true);
480 if (kvm_is_error_hva(hva)) 487 if (kvm_is_error_hva(hva))
481 goto err; 488 goto mmio;
482 489
483 if (copy_from_user(ptr, (void __user *)hva, size)) { 490 if (copy_from_user(ptr, (void __user *)hva, size)) {
484 printk(KERN_INFO "kvmppc_ld at 0x%lx failed\n", hva); 491 printk(KERN_INFO "kvmppc_ld at 0x%lx failed\n", hva);
485 goto err; 492 goto mmio;
486 } 493 }
487 494
488 return 0; 495 return EMULATE_DONE;
489 496
490err: 497nopte:
491 return -ENOENT; 498 return -ENOENT;
499mmio:
500 return EMULATE_DO_MMIO;
492} 501}
493 502
494static int kvmppc_visible_gfn(struct kvm_vcpu *vcpu, gfn_t gfn) 503static int kvmppc_visible_gfn(struct kvm_vcpu *vcpu, gfn_t gfn)