diff options
author | Scott Wood <scottwood@freescale.com> | 2011-11-28 10:20:02 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2012-03-05 07:52:32 -0500 |
commit | 7b11dc993841f1643c0932cf0faf010406502572 (patch) | |
tree | 503aaa4c06825fd61c20e62c8cad33afb0d5759e /arch/powerpc | |
parent | e371f713db6523d99d8ffae8f9da564055e6de17 (diff) |
KVM: PPC: e500: Fix TLBnCFG in KVM_CONFIG_TLB
The associativity, not just total size, can differ from the host
hardware.
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/kvm/e500_tlb.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/arch/powerpc/kvm/e500_tlb.c b/arch/powerpc/kvm/e500_tlb.c index 9cd124a11acd..507376890cf8 100644 --- a/arch/powerpc/kvm/e500_tlb.c +++ b/arch/powerpc/kvm/e500_tlb.c | |||
@@ -1227,12 +1227,14 @@ int kvm_vcpu_ioctl_config_tlb(struct kvm_vcpu *vcpu, | |||
1227 | vcpu_e500->gtlb_offset[0] = 0; | 1227 | vcpu_e500->gtlb_offset[0] = 0; |
1228 | vcpu_e500->gtlb_offset[1] = params.tlb_sizes[0]; | 1228 | vcpu_e500->gtlb_offset[1] = params.tlb_sizes[0]; |
1229 | 1229 | ||
1230 | vcpu_e500->tlb0cfg = mfspr(SPRN_TLB0CFG) & ~0xfffUL; | 1230 | vcpu_e500->tlb0cfg &= ~(TLBnCFG_N_ENTRY | TLBnCFG_ASSOC); |
1231 | if (params.tlb_sizes[0] <= 2048) | 1231 | if (params.tlb_sizes[0] <= 2048) |
1232 | vcpu_e500->tlb0cfg |= params.tlb_sizes[0]; | 1232 | vcpu_e500->tlb0cfg |= params.tlb_sizes[0]; |
1233 | vcpu_e500->tlb0cfg |= params.tlb_ways[0] << TLBnCFG_ASSOC_SHIFT; | ||
1233 | 1234 | ||
1234 | vcpu_e500->tlb1cfg = mfspr(SPRN_TLB1CFG) & ~0xfffUL; | 1235 | vcpu_e500->tlb1cfg &= ~(TLBnCFG_N_ENTRY | TLBnCFG_ASSOC); |
1235 | vcpu_e500->tlb1cfg |= params.tlb_sizes[1]; | 1236 | vcpu_e500->tlb1cfg |= params.tlb_sizes[1]; |
1237 | vcpu_e500->tlb1cfg |= params.tlb_ways[1] << TLBnCFG_ASSOC_SHIFT; | ||
1236 | 1238 | ||
1237 | vcpu_e500->shared_tlb_pages = pages; | 1239 | vcpu_e500->shared_tlb_pages = pages; |
1238 | vcpu_e500->num_shared_tlb_pages = num_pages; | 1240 | vcpu_e500->num_shared_tlb_pages = num_pages; |
@@ -1348,10 +1350,17 @@ int kvmppc_e500_tlb_init(struct kvmppc_vcpu_e500 *vcpu_e500) | |||
1348 | goto err; | 1350 | goto err; |
1349 | 1351 | ||
1350 | /* Init TLB configuration register */ | 1352 | /* Init TLB configuration register */ |
1351 | vcpu_e500->tlb0cfg = mfspr(SPRN_TLB0CFG) & ~0xfffUL; | 1353 | vcpu_e500->tlb0cfg = mfspr(SPRN_TLB0CFG) & |
1354 | ~(TLBnCFG_N_ENTRY | TLBnCFG_ASSOC); | ||
1352 | vcpu_e500->tlb0cfg |= vcpu_e500->gtlb_params[0].entries; | 1355 | vcpu_e500->tlb0cfg |= vcpu_e500->gtlb_params[0].entries; |
1353 | vcpu_e500->tlb1cfg = mfspr(SPRN_TLB1CFG) & ~0xfffUL; | 1356 | vcpu_e500->tlb0cfg |= |
1354 | vcpu_e500->tlb1cfg |= vcpu_e500->gtlb_params[1].entries; | 1357 | vcpu_e500->gtlb_params[0].ways << TLBnCFG_ASSOC_SHIFT; |
1358 | |||
1359 | vcpu_e500->tlb1cfg = mfspr(SPRN_TLB1CFG) & | ||
1360 | ~(TLBnCFG_N_ENTRY | TLBnCFG_ASSOC); | ||
1361 | vcpu_e500->tlb0cfg |= vcpu_e500->gtlb_params[1].entries; | ||
1362 | vcpu_e500->tlb0cfg |= | ||
1363 | vcpu_e500->gtlb_params[1].ways << TLBnCFG_ASSOC_SHIFT; | ||
1355 | 1364 | ||
1356 | return 0; | 1365 | return 0; |
1357 | 1366 | ||