diff options
author | Paul Mackerras <paulus@samba.org> | 2013-06-22 03:13:32 -0400 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2013-06-29 21:33:21 -0400 |
commit | 8ed7b7e9d2a4e208d3c94af3ddbc628317b30409 (patch) | |
tree | ce910db4d2626eb1757b40c242133b2d3ce53564 /arch | |
parent | 5f17ce8b954a2ff93f0460a2ae35d56285697d0f (diff) |
KVM: PPC: Book3S PR: Fix proto-VSID calculations
This makes sure the calculation of the proto-VSIDs used by PR KVM
is done with 64-bit arithmetic. Since vcpu3s->context_id[] is int,
when we do vcpu3s->context_id[0] << ESID_BITS the shift will be done
with 32-bit instructions, possibly leading to significant bits
getting lost, as the context id can be up to 524283 and ESID_BITS is
18. To fix this we cast the context id to u64 before shifting.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/kvm/book3s_64_mmu_host.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/powerpc/kvm/book3s_64_mmu_host.c b/arch/powerpc/kvm/book3s_64_mmu_host.c index 3a9a1aceb14f..2c6e7ee8be34 100644 --- a/arch/powerpc/kvm/book3s_64_mmu_host.c +++ b/arch/powerpc/kvm/book3s_64_mmu_host.c | |||
@@ -325,9 +325,9 @@ int kvmppc_mmu_init(struct kvm_vcpu *vcpu) | |||
325 | return -1; | 325 | return -1; |
326 | vcpu3s->context_id[0] = err; | 326 | vcpu3s->context_id[0] = err; |
327 | 327 | ||
328 | vcpu3s->proto_vsid_max = ((vcpu3s->context_id[0] + 1) | 328 | vcpu3s->proto_vsid_max = ((u64)(vcpu3s->context_id[0] + 1) |
329 | << ESID_BITS) - 1; | 329 | << ESID_BITS) - 1; |
330 | vcpu3s->proto_vsid_first = vcpu3s->context_id[0] << ESID_BITS; | 330 | vcpu3s->proto_vsid_first = (u64)vcpu3s->context_id[0] << ESID_BITS; |
331 | vcpu3s->proto_vsid_next = vcpu3s->proto_vsid_first; | 331 | vcpu3s->proto_vsid_next = vcpu3s->proto_vsid_first; |
332 | 332 | ||
333 | kvmppc_mmu_hpte_init(vcpu); | 333 | kvmppc_mmu_hpte_init(vcpu); |