diff options
Diffstat (limited to 'arch/x86/kvm/paging_tmpl.h')
-rw-r--r-- | arch/x86/kvm/paging_tmpl.h | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h index 3058a22a658d..6c9fed957cce 100644 --- a/arch/x86/kvm/paging_tmpl.h +++ b/arch/x86/kvm/paging_tmpl.h | |||
@@ -456,7 +456,7 @@ FNAME(prefetch_gpte)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp, | |||
456 | { | 456 | { |
457 | unsigned pte_access; | 457 | unsigned pte_access; |
458 | gfn_t gfn; | 458 | gfn_t gfn; |
459 | pfn_t pfn; | 459 | kvm_pfn_t pfn; |
460 | 460 | ||
461 | if (FNAME(prefetch_invalid_gpte)(vcpu, sp, spte, gpte)) | 461 | if (FNAME(prefetch_invalid_gpte)(vcpu, sp, spte, gpte)) |
462 | return false; | 462 | return false; |
@@ -475,8 +475,8 @@ FNAME(prefetch_gpte)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp, | |||
475 | * we call mmu_set_spte() with host_writable = true because | 475 | * we call mmu_set_spte() with host_writable = true because |
476 | * pte_prefetch_gfn_to_pfn always gets a writable pfn. | 476 | * pte_prefetch_gfn_to_pfn always gets a writable pfn. |
477 | */ | 477 | */ |
478 | mmu_set_spte(vcpu, spte, pte_access, 0, NULL, PT_PAGE_TABLE_LEVEL, | 478 | mmu_set_spte(vcpu, spte, pte_access, 0, PT_PAGE_TABLE_LEVEL, gfn, pfn, |
479 | gfn, pfn, true, true); | 479 | true, true); |
480 | 480 | ||
481 | return true; | 481 | return true; |
482 | } | 482 | } |
@@ -551,12 +551,12 @@ static void FNAME(pte_prefetch)(struct kvm_vcpu *vcpu, struct guest_walker *gw, | |||
551 | static int FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr, | 551 | static int FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr, |
552 | struct guest_walker *gw, | 552 | struct guest_walker *gw, |
553 | int write_fault, int hlevel, | 553 | int write_fault, int hlevel, |
554 | pfn_t pfn, bool map_writable, bool prefault) | 554 | kvm_pfn_t pfn, bool map_writable, bool prefault) |
555 | { | 555 | { |
556 | struct kvm_mmu_page *sp = NULL; | 556 | struct kvm_mmu_page *sp = NULL; |
557 | struct kvm_shadow_walk_iterator it; | 557 | struct kvm_shadow_walk_iterator it; |
558 | unsigned direct_access, access = gw->pt_access; | 558 | unsigned direct_access, access = gw->pt_access; |
559 | int top_level, emulate = 0; | 559 | int top_level, emulate; |
560 | 560 | ||
561 | direct_access = gw->pte_access; | 561 | direct_access = gw->pte_access; |
562 | 562 | ||
@@ -587,7 +587,7 @@ static int FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr, | |||
587 | if (!is_shadow_present_pte(*it.sptep)) { | 587 | if (!is_shadow_present_pte(*it.sptep)) { |
588 | table_gfn = gw->table_gfn[it.level - 2]; | 588 | table_gfn = gw->table_gfn[it.level - 2]; |
589 | sp = kvm_mmu_get_page(vcpu, table_gfn, addr, it.level-1, | 589 | sp = kvm_mmu_get_page(vcpu, table_gfn, addr, it.level-1, |
590 | false, access, it.sptep); | 590 | false, access); |
591 | } | 591 | } |
592 | 592 | ||
593 | /* | 593 | /* |
@@ -598,7 +598,7 @@ static int FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr, | |||
598 | goto out_gpte_changed; | 598 | goto out_gpte_changed; |
599 | 599 | ||
600 | if (sp) | 600 | if (sp) |
601 | link_shadow_page(it.sptep, sp, PT_GUEST_ACCESSED_MASK); | 601 | link_shadow_page(vcpu, it.sptep, sp); |
602 | } | 602 | } |
603 | 603 | ||
604 | for (; | 604 | for (; |
@@ -617,20 +617,18 @@ static int FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr, | |||
617 | direct_gfn = gw->gfn & ~(KVM_PAGES_PER_HPAGE(it.level) - 1); | 617 | direct_gfn = gw->gfn & ~(KVM_PAGES_PER_HPAGE(it.level) - 1); |
618 | 618 | ||
619 | sp = kvm_mmu_get_page(vcpu, direct_gfn, addr, it.level-1, | 619 | sp = kvm_mmu_get_page(vcpu, direct_gfn, addr, it.level-1, |
620 | true, direct_access, it.sptep); | 620 | true, direct_access); |
621 | link_shadow_page(it.sptep, sp, PT_GUEST_ACCESSED_MASK); | 621 | link_shadow_page(vcpu, it.sptep, sp); |
622 | } | 622 | } |
623 | 623 | ||
624 | clear_sp_write_flooding_count(it.sptep); | 624 | clear_sp_write_flooding_count(it.sptep); |
625 | mmu_set_spte(vcpu, it.sptep, gw->pte_access, write_fault, &emulate, | 625 | emulate = mmu_set_spte(vcpu, it.sptep, gw->pte_access, write_fault, |
626 | it.level, gw->gfn, pfn, prefault, map_writable); | 626 | it.level, gw->gfn, pfn, prefault, map_writable); |
627 | FNAME(pte_prefetch)(vcpu, gw, it.sptep); | 627 | FNAME(pte_prefetch)(vcpu, gw, it.sptep); |
628 | 628 | ||
629 | return emulate; | 629 | return emulate; |
630 | 630 | ||
631 | out_gpte_changed: | 631 | out_gpte_changed: |
632 | if (sp) | ||
633 | kvm_mmu_put_page(sp, it.sptep); | ||
634 | kvm_release_pfn_clean(pfn); | 632 | kvm_release_pfn_clean(pfn); |
635 | return 0; | 633 | return 0; |
636 | } | 634 | } |
@@ -696,7 +694,7 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr, u32 error_code, | |||
696 | int user_fault = error_code & PFERR_USER_MASK; | 694 | int user_fault = error_code & PFERR_USER_MASK; |
697 | struct guest_walker walker; | 695 | struct guest_walker walker; |
698 | int r; | 696 | int r; |
699 | pfn_t pfn; | 697 | kvm_pfn_t pfn; |
700 | int level = PT_PAGE_TABLE_LEVEL; | 698 | int level = PT_PAGE_TABLE_LEVEL; |
701 | bool force_pt_level = false; | 699 | bool force_pt_level = false; |
702 | unsigned long mmu_seq; | 700 | unsigned long mmu_seq; |