aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kvm/booke.c
diff options
context:
space:
mode:
authorHollis Blanchard <hollisb@us.ibm.com>2008-12-02 16:51:53 -0500
committerAvi Kivity <avi@redhat.com>2008-12-31 09:55:07 -0500
commit891686188f69d330f7eeeec8e6642ccfb7453106 (patch)
tree39349d7383b3cf1fe0fda983d8c4f0d86a6dc2bc /arch/powerpc/kvm/booke.c
parent4a643be8c9b8d3c1ae8f5ccd377daaa85bd57e0c (diff)
KVM: ppc: support large host pages
KVM on 440 has always been able to handle large guest mappings with 4K host pages -- we must, since the guest kernel uses 256MB mappings. This patch makes KVM work when the host has large pages too (tested with 64K). Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/powerpc/kvm/booke.c')
-rw-r--r--arch/powerpc/kvm/booke.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index ec59a6768ec3..924c7b4b1107 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -308,8 +308,8 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
308 * b) the guest used a large mapping which we're faking 308 * b) the guest used a large mapping which we're faking
309 * Either way, we need to satisfy the fault without 309 * Either way, we need to satisfy the fault without
310 * invoking the guest. */ 310 * invoking the guest. */
311 kvmppc_mmu_map(vcpu, eaddr, gfn, gtlbe->tid, 311 kvmppc_mmu_map(vcpu, eaddr, vcpu->arch.paddr_accessed, gtlbe->tid,
312 gtlbe->word2); 312 gtlbe->word2, get_tlb_bytes(gtlbe));
313 vcpu->stat.dtlb_virt_miss_exits++; 313 vcpu->stat.dtlb_virt_miss_exits++;
314 r = RESUME_GUEST; 314 r = RESUME_GUEST;
315 } else { 315 } else {
@@ -325,6 +325,7 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
325 case BOOKE_INTERRUPT_ITLB_MISS: { 325 case BOOKE_INTERRUPT_ITLB_MISS: {
326 struct kvmppc_44x_tlbe *gtlbe; 326 struct kvmppc_44x_tlbe *gtlbe;
327 unsigned long eaddr = vcpu->arch.pc; 327 unsigned long eaddr = vcpu->arch.pc;
328 gpa_t gpaddr;
328 gfn_t gfn; 329 gfn_t gfn;
329 330
330 r = RESUME_GUEST; 331 r = RESUME_GUEST;
@@ -340,7 +341,8 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
340 341
341 vcpu->stat.itlb_virt_miss_exits++; 342 vcpu->stat.itlb_virt_miss_exits++;
342 343
343 gfn = tlb_xlate(gtlbe, eaddr) >> PAGE_SHIFT; 344 gpaddr = tlb_xlate(gtlbe, eaddr);
345 gfn = gpaddr >> PAGE_SHIFT;
344 346
345 if (kvm_is_visible_gfn(vcpu->kvm, gfn)) { 347 if (kvm_is_visible_gfn(vcpu->kvm, gfn)) {
346 /* The guest TLB had a mapping, but the shadow TLB 348 /* The guest TLB had a mapping, but the shadow TLB
@@ -349,8 +351,8 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
349 * b) the guest used a large mapping which we're faking 351 * b) the guest used a large mapping which we're faking
350 * Either way, we need to satisfy the fault without 352 * Either way, we need to satisfy the fault without
351 * invoking the guest. */ 353 * invoking the guest. */
352 kvmppc_mmu_map(vcpu, eaddr, gfn, gtlbe->tid, 354 kvmppc_mmu_map(vcpu, eaddr, gpaddr, gtlbe->tid,
353 gtlbe->word2); 355 gtlbe->word2, get_tlb_bytes(gtlbe));
354 } else { 356 } else {
355 /* Guest mapped and leaped at non-RAM! */ 357 /* Guest mapped and leaped at non-RAM! */
356 kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_MACHINE_CHECK); 358 kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_MACHINE_CHECK);