aboutsummaryrefslogtreecommitdiff
path: root/target-ppc
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2012-10-05 04:34:40 +0200
committerAlexander Graf <agraf@suse.de>2012-10-05 04:38:46 +0200
commitef8beb0e94c75984e016e855164361c36e15396c (patch)
treecc877c26df4ae9f7d79d4c3dfb7d639d3e2d95f8 /target-ppc
parentfb37c3029c5a695e367baaacc6baf17640cc63cc (diff)
PPC: KVM: Fix BAT put
In the sregs API, upper and lower 32bit segments of the BAT registers are swapped when doing a set. Since we need to support old kernels out there, don't bother to fix it in the kernel, but instead work around the problem in QEMU by swapping on put. Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'target-ppc')
-rw-r--r--target-ppc/kvm.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index 1975323eb7..93c5bb75e7 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -493,10 +493,11 @@ int kvm_arch_put_registers(CPUPPCState *env, int level)
/* Sync BATs */
for (i = 0; i < 8; i++) {
- sregs.u.s.ppc32.dbat[i] = ((uint64_t)env->DBAT[1][i] << 32)
- | env->DBAT[0][i];
- sregs.u.s.ppc32.ibat[i] = ((uint64_t)env->IBAT[1][i] << 32)
- | env->IBAT[0][i];
+ /* Beware. We have to swap upper and lower bits here */
+ sregs.u.s.ppc32.dbat[i] = ((uint64_t)env->DBAT[0][i] << 32)
+ | env->DBAT[1][i];
+ sregs.u.s.ppc32.ibat[i] = ((uint64_t)env->IBAT[0][i] << 32)
+ | env->IBAT[1][i];
}
ret = kvm_vcpu_ioctl(env, KVM_SET_SREGS, &sregs);