aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kvm
diff options
context:
space:
mode:
authorPeter Tyser <ptyser@xes-inc.com>2010-12-29 14:51:25 -0500
committerMarcelo Tosatti <mtosatti@redhat.com>2011-03-17 12:08:25 -0400
commitbc9c1933d9db227d991736382ddca21ed520c0ea (patch)
tree40a1c2be80f165ace5f70e9fbf1d745b9b1978c2 /arch/powerpc/kvm
parent775077a0634a4a2149c85a63ec319b1e426d0564 (diff)
KVM: PPC: Fix SPRG get/set for Book3S and BookE
Previously SPRGs 4-7 were improperly read and written in kvm_arch_vcpu_ioctl_get_regs() and kvm_arch_vcpu_ioctl_set_regs(); Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Peter Tyser <ptyser@xes-inc.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/powerpc/kvm')
-rw-r--r--arch/powerpc/kvm/book3s.c14
-rw-r--r--arch/powerpc/kvm/booke.c14
2 files changed, 16 insertions, 12 deletions
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
index badc983031b3..c961de40c676 100644
--- a/arch/powerpc/kvm/book3s.c
+++ b/arch/powerpc/kvm/book3s.c
@@ -1141,9 +1141,10 @@ int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
1141 regs->sprg1 = vcpu->arch.shared->sprg1; 1141 regs->sprg1 = vcpu->arch.shared->sprg1;
1142 regs->sprg2 = vcpu->arch.shared->sprg2; 1142 regs->sprg2 = vcpu->arch.shared->sprg2;
1143 regs->sprg3 = vcpu->arch.shared->sprg3; 1143 regs->sprg3 = vcpu->arch.shared->sprg3;
1144 regs->sprg5 = vcpu->arch.sprg4; 1144 regs->sprg4 = vcpu->arch.sprg4;
1145 regs->sprg6 = vcpu->arch.sprg5; 1145 regs->sprg5 = vcpu->arch.sprg5;
1146 regs->sprg7 = vcpu->arch.sprg6; 1146 regs->sprg6 = vcpu->arch.sprg6;
1147 regs->sprg7 = vcpu->arch.sprg7;
1147 1148
1148 for (i = 0; i < ARRAY_SIZE(regs->gpr); i++) 1149 for (i = 0; i < ARRAY_SIZE(regs->gpr); i++)
1149 regs->gpr[i] = kvmppc_get_gpr(vcpu, i); 1150 regs->gpr[i] = kvmppc_get_gpr(vcpu, i);
@@ -1167,9 +1168,10 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
1167 vcpu->arch.shared->sprg1 = regs->sprg1; 1168 vcpu->arch.shared->sprg1 = regs->sprg1;
1168 vcpu->arch.shared->sprg2 = regs->sprg2; 1169 vcpu->arch.shared->sprg2 = regs->sprg2;
1169 vcpu->arch.shared->sprg3 = regs->sprg3; 1170 vcpu->arch.shared->sprg3 = regs->sprg3;
1170 vcpu->arch.sprg5 = regs->sprg4; 1171 vcpu->arch.sprg4 = regs->sprg4;
1171 vcpu->arch.sprg6 = regs->sprg5; 1172 vcpu->arch.sprg5 = regs->sprg5;
1172 vcpu->arch.sprg7 = regs->sprg6; 1173 vcpu->arch.sprg6 = regs->sprg6;
1174 vcpu->arch.sprg7 = regs->sprg7;
1173 1175
1174 for (i = 0; i < ARRAY_SIZE(regs->gpr); i++) 1176 for (i = 0; i < ARRAY_SIZE(regs->gpr); i++)
1175 kvmppc_set_gpr(vcpu, i, regs->gpr[i]); 1177 kvmppc_set_gpr(vcpu, i, regs->gpr[i]);
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index 77575d08c818..ef76acb455c3 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -546,9 +546,10 @@ int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
546 regs->sprg1 = vcpu->arch.shared->sprg1; 546 regs->sprg1 = vcpu->arch.shared->sprg1;
547 regs->sprg2 = vcpu->arch.shared->sprg2; 547 regs->sprg2 = vcpu->arch.shared->sprg2;
548 regs->sprg3 = vcpu->arch.shared->sprg3; 548 regs->sprg3 = vcpu->arch.shared->sprg3;
549 regs->sprg5 = vcpu->arch.sprg4; 549 regs->sprg4 = vcpu->arch.sprg4;
550 regs->sprg6 = vcpu->arch.sprg5; 550 regs->sprg5 = vcpu->arch.sprg5;
551 regs->sprg7 = vcpu->arch.sprg6; 551 regs->sprg6 = vcpu->arch.sprg6;
552 regs->sprg7 = vcpu->arch.sprg7;
552 553
553 for (i = 0; i < ARRAY_SIZE(regs->gpr); i++) 554 for (i = 0; i < ARRAY_SIZE(regs->gpr); i++)
554 regs->gpr[i] = kvmppc_get_gpr(vcpu, i); 555 regs->gpr[i] = kvmppc_get_gpr(vcpu, i);
@@ -572,9 +573,10 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
572 vcpu->arch.shared->sprg1 = regs->sprg1; 573 vcpu->arch.shared->sprg1 = regs->sprg1;
573 vcpu->arch.shared->sprg2 = regs->sprg2; 574 vcpu->arch.shared->sprg2 = regs->sprg2;
574 vcpu->arch.shared->sprg3 = regs->sprg3; 575 vcpu->arch.shared->sprg3 = regs->sprg3;
575 vcpu->arch.sprg5 = regs->sprg4; 576 vcpu->arch.sprg4 = regs->sprg4;
576 vcpu->arch.sprg6 = regs->sprg5; 577 vcpu->arch.sprg5 = regs->sprg5;
577 vcpu->arch.sprg7 = regs->sprg6; 578 vcpu->arch.sprg6 = regs->sprg6;
579 vcpu->arch.sprg7 = regs->sprg7;
578 580
579 for (i = 0; i < ARRAY_SIZE(regs->gpr); i++) 581 for (i = 0; i < ARRAY_SIZE(regs->gpr); i++)
580 kvmppc_set_gpr(vcpu, i, regs->gpr[i]); 582 kvmppc_set_gpr(vcpu, i, regs->gpr[i]);