aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kvm
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2010-02-19 05:00:41 -0500
committerAvi Kivity <avi@redhat.com>2010-04-25 05:35:18 -0400
commitdba2e123e7502870c965e4b445554bc8e56f78b2 (patch)
treea6a82c6906d4804d8c88f6e903469bbd6faaa16d /arch/powerpc/kvm
parent963cf3dc6342fe60bb78c615884537621abca0bc (diff)
KVM: PPC: Fix error in BAT assignment
BATs didn't work. Well, they did, but only up to BAT3. As soon as we came to BAT4 the offset calculation was screwed up and we ended up overwriting BAT0-3. Fortunately, Linux hasn't been using BAT4+. It's still a good idea to write correct code though. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/powerpc/kvm')
-rw-r--r--arch/powerpc/kvm/book3s_64_emulate.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/powerpc/kvm/book3s_64_emulate.c b/arch/powerpc/kvm/book3s_64_emulate.c
index a93aa4719178..1d1b9524f0e4 100644
--- a/arch/powerpc/kvm/book3s_64_emulate.c
+++ b/arch/powerpc/kvm/book3s_64_emulate.c
@@ -233,13 +233,13 @@ static void kvmppc_write_bat(struct kvm_vcpu *vcpu, int sprn, u32 val)
233 bat = &vcpu_book3s->ibat[(sprn - SPRN_IBAT0U) / 2]; 233 bat = &vcpu_book3s->ibat[(sprn - SPRN_IBAT0U) / 2];
234 break; 234 break;
235 case SPRN_IBAT4U ... SPRN_IBAT7L: 235 case SPRN_IBAT4U ... SPRN_IBAT7L:
236 bat = &vcpu_book3s->ibat[(sprn - SPRN_IBAT4U) / 2]; 236 bat = &vcpu_book3s->ibat[4 + ((sprn - SPRN_IBAT4U) / 2)];
237 break; 237 break;
238 case SPRN_DBAT0U ... SPRN_DBAT3L: 238 case SPRN_DBAT0U ... SPRN_DBAT3L:
239 bat = &vcpu_book3s->dbat[(sprn - SPRN_DBAT0U) / 2]; 239 bat = &vcpu_book3s->dbat[(sprn - SPRN_DBAT0U) / 2];
240 break; 240 break;
241 case SPRN_DBAT4U ... SPRN_DBAT7L: 241 case SPRN_DBAT4U ... SPRN_DBAT7L:
242 bat = &vcpu_book3s->dbat[(sprn - SPRN_DBAT4U) / 2]; 242 bat = &vcpu_book3s->dbat[4 + ((sprn - SPRN_DBAT4U) / 2)];
243 break; 243 break;
244 default: 244 default:
245 BUG(); 245 BUG();