aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/paging_tmpl.h
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2007-11-20 14:39:54 -0500
committerAvi Kivity <avi@qumranet.com>2008-01-30 10:53:09 -0500
commite5a4c8cad952d6e060991841f3632578ab3ae133 (patch)
tree85f98599534c78cf95f090471ceaaacd29ab2a34 /drivers/kvm/paging_tmpl.h
parent26e5215fdc6cf7b5a8b1269134095abbb7338b3c (diff)
KVM: MMU: Implement guest page fault bypass for nonpae
I spent an hour worrying why I see so many guest page faults on FC6 i386. Turns out bypass wasn't implemented for nonpae. Implement it so it doesn't happen again. Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/paging_tmpl.h')
-rw-r--r--drivers/kvm/paging_tmpl.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/kvm/paging_tmpl.h b/drivers/kvm/paging_tmpl.h
index bf15d127a48f..92b93134a2a6 100644
--- a/drivers/kvm/paging_tmpl.h
+++ b/drivers/kvm/paging_tmpl.h
@@ -486,19 +486,22 @@ static gpa_t FNAME(gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t vaddr)
486static void FNAME(prefetch_page)(struct kvm_vcpu *vcpu, 486static void FNAME(prefetch_page)(struct kvm_vcpu *vcpu,
487 struct kvm_mmu_page *sp) 487 struct kvm_mmu_page *sp)
488{ 488{
489 int i; 489 int i, offset = 0;
490 pt_element_t *gpt; 490 pt_element_t *gpt;
491 struct page *page; 491 struct page *page;
492 492
493 if (sp->role.metaphysical || PTTYPE == 32) { 493 if (sp->role.metaphysical
494 || (PTTYPE == 32 && sp->role.level > PT_PAGE_TABLE_LEVEL)) {
494 nonpaging_prefetch_page(vcpu, sp); 495 nonpaging_prefetch_page(vcpu, sp);
495 return; 496 return;
496 } 497 }
497 498
499 if (PTTYPE == 32)
500 offset = sp->role.quadrant << PT64_LEVEL_BITS;
498 page = gfn_to_page(vcpu->kvm, sp->gfn); 501 page = gfn_to_page(vcpu->kvm, sp->gfn);
499 gpt = kmap_atomic(page, KM_USER0); 502 gpt = kmap_atomic(page, KM_USER0);
500 for (i = 0; i < PT64_ENT_PER_PAGE; ++i) 503 for (i = 0; i < PT64_ENT_PER_PAGE; ++i)
501 if (is_present_pte(gpt[i])) 504 if (is_present_pte(gpt[offset + i]))
502 sp->spt[i] = shadow_trap_nonpresent_pte; 505 sp->spt[i] = shadow_trap_nonpresent_pte;
503 else 506 else
504 sp->spt[i] = shadow_notrap_nonpresent_pte; 507 sp->spt[i] = shadow_notrap_nonpresent_pte;