aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kvm/booke.c
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2010-01-07 20:58:01 -0500
committerMarcelo Tosatti <mtosatti@redhat.com>2010-03-01 10:35:47 -0500
commit8e5b26b55a8b6aee2c789b1d20ec715f9e4bea5c (patch)
tree4e2d003852ce327a47153b6c100239c6d8e1418f /arch/powerpc/kvm/booke.c
parent0d178975d0a5afe5e0fd3211bd1397905b225be5 (diff)
KVM: PPC: Use accessor functions for GPR access
All code in PPC KVM currently accesses gprs in the vcpu struct directly. While there's nothing wrong with that wrt the current way gprs are stored and loaded, it doesn't suffice for the PACA acceleration that will follow in this patchset. So let's just create little wrapper inline functions that we call whenever a GPR needs to be read from or written to. The compiled code shouldn't really change at all for now. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/powerpc/kvm/booke.c')
-rw-r--r--arch/powerpc/kvm/booke.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index d8b63420acf8..49af80e4a6e1 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -69,10 +69,10 @@ void kvmppc_dump_vcpu(struct kvm_vcpu *vcpu)
69 69
70 for (i = 0; i < 32; i += 4) { 70 for (i = 0; i < 32; i += 4) {
71 printk("gpr%02d: %08lx %08lx %08lx %08lx\n", i, 71 printk("gpr%02d: %08lx %08lx %08lx %08lx\n", i,
72 vcpu->arch.gpr[i], 72 kvmppc_get_gpr(vcpu, i),
73 vcpu->arch.gpr[i+1], 73 kvmppc_get_gpr(vcpu, i+1),
74 vcpu->arch.gpr[i+2], 74 kvmppc_get_gpr(vcpu, i+2),
75 vcpu->arch.gpr[i+3]); 75 kvmppc_get_gpr(vcpu, i+3));
76 } 76 }
77} 77}
78 78
@@ -431,7 +431,7 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
431{ 431{
432 vcpu->arch.pc = 0; 432 vcpu->arch.pc = 0;
433 vcpu->arch.msr = 0; 433 vcpu->arch.msr = 0;
434 vcpu->arch.gpr[1] = (16<<20) - 8; /* -8 for the callee-save LR slot */ 434 kvmppc_set_gpr(vcpu, 1, (16<<20) - 8); /* -8 for the callee-save LR slot */
435 435
436 vcpu->arch.shadow_pid = 1; 436 vcpu->arch.shadow_pid = 1;
437 437
@@ -466,7 +466,7 @@ int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
466 regs->sprg7 = vcpu->arch.sprg6; 466 regs->sprg7 = vcpu->arch.sprg6;
467 467
468 for (i = 0; i < ARRAY_SIZE(regs->gpr); i++) 468 for (i = 0; i < ARRAY_SIZE(regs->gpr); i++)
469 regs->gpr[i] = vcpu->arch.gpr[i]; 469 regs->gpr[i] = kvmppc_get_gpr(vcpu, i);
470 470
471 return 0; 471 return 0;
472} 472}
@@ -491,8 +491,8 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
491 vcpu->arch.sprg6 = regs->sprg5; 491 vcpu->arch.sprg6 = regs->sprg5;
492 vcpu->arch.sprg7 = regs->sprg6; 492 vcpu->arch.sprg7 = regs->sprg6;
493 493
494 for (i = 0; i < ARRAY_SIZE(vcpu->arch.gpr); i++) 494 for (i = 0; i < ARRAY_SIZE(regs->gpr); i++)
495 vcpu->arch.gpr[i] = regs->gpr[i]; 495 kvmppc_set_gpr(vcpu, i, regs->gpr[i]);
496 496
497 return 0; 497 return 0;
498} 498}