diff options
author | Avi Kivity <avi@qumranet.com> | 2007-11-21 08:01:44 -0500 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-01-30 10:53:12 -0500 |
commit | 1d28f5f4a4984be4cd7200ed512c94517c13e392 (patch) | |
tree | 1ed90eca9769f1d5e076a538d8d3a5818dc3af8d /drivers/kvm/mmu.c | |
parent | 0d81f2966a61953c4cc7397342f5f907b3a6e257 (diff) |
KVM: Remove gpa_to_hpa()
Converting last uses along the way.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/mmu.c')
-rw-r--r-- | drivers/kvm/mmu.c | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/drivers/kvm/mmu.c b/drivers/kvm/mmu.c index 6aa0319ede4d..9b75b102b8d1 100644 --- a/drivers/kvm/mmu.c +++ b/drivers/kvm/mmu.c | |||
@@ -868,26 +868,13 @@ static void page_header_update_slot(struct kvm *kvm, void *pte, gfn_t gfn) | |||
868 | __set_bit(slot, &page_head->slot_bitmap); | 868 | __set_bit(slot, &page_head->slot_bitmap); |
869 | } | 869 | } |
870 | 870 | ||
871 | hpa_t gpa_to_hpa(struct kvm *kvm, gpa_t gpa) | ||
872 | { | ||
873 | struct page *page; | ||
874 | hpa_t hpa; | ||
875 | |||
876 | ASSERT((gpa & HPA_ERR_MASK) == 0); | ||
877 | page = gfn_to_page(kvm, gpa >> PAGE_SHIFT); | ||
878 | hpa = ((hpa_t)page_to_pfn(page) << PAGE_SHIFT) | (gpa & (PAGE_SIZE-1)); | ||
879 | if (is_error_page(page)) | ||
880 | return hpa | HPA_ERR_MASK; | ||
881 | return hpa; | ||
882 | } | ||
883 | |||
884 | struct page *gva_to_page(struct kvm_vcpu *vcpu, gva_t gva) | 871 | struct page *gva_to_page(struct kvm_vcpu *vcpu, gva_t gva) |
885 | { | 872 | { |
886 | gpa_t gpa = vcpu->mmu.gva_to_gpa(vcpu, gva); | 873 | gpa_t gpa = vcpu->mmu.gva_to_gpa(vcpu, gva); |
887 | 874 | ||
888 | if (gpa == UNMAPPED_GVA) | 875 | if (gpa == UNMAPPED_GVA) |
889 | return NULL; | 876 | return NULL; |
890 | return pfn_to_page(gpa_to_hpa(vcpu->kvm, gpa) >> PAGE_SHIFT); | 877 | return gfn_to_page(vcpu->kvm, gpa >> PAGE_SHIFT); |
891 | } | 878 | } |
892 | 879 | ||
893 | static void nonpaging_new_cr3(struct kvm_vcpu *vcpu) | 880 | static void nonpaging_new_cr3(struct kvm_vcpu *vcpu) |
@@ -1611,8 +1598,8 @@ static void audit_mappings_page(struct kvm_vcpu *vcpu, u64 page_pte, | |||
1611 | audit_mappings_page(vcpu, ent, va, level - 1); | 1598 | audit_mappings_page(vcpu, ent, va, level - 1); |
1612 | } else { | 1599 | } else { |
1613 | gpa_t gpa = vcpu->mmu.gva_to_gpa(vcpu, va); | 1600 | gpa_t gpa = vcpu->mmu.gva_to_gpa(vcpu, va); |
1614 | hpa_t hpa = gpa_to_hpa(vcpu, gpa); | 1601 | struct page *page = gpa_to_page(vcpu, gpa); |
1615 | struct page *page; | 1602 | hpa_t hpa = page_to_phys(page); |
1616 | 1603 | ||
1617 | if (is_shadow_present_pte(ent) | 1604 | if (is_shadow_present_pte(ent) |
1618 | && (ent & PT64_BASE_ADDR_MASK) != hpa) | 1605 | && (ent & PT64_BASE_ADDR_MASK) != hpa) |
@@ -1625,8 +1612,6 @@ static void audit_mappings_page(struct kvm_vcpu *vcpu, u64 page_pte, | |||
1625 | && !is_error_hpa(hpa)) | 1612 | && !is_error_hpa(hpa)) |
1626 | printk(KERN_ERR "audit: (%s) notrap shadow," | 1613 | printk(KERN_ERR "audit: (%s) notrap shadow," |
1627 | " valid guest gva %lx\n", audit_msg, va); | 1614 | " valid guest gva %lx\n", audit_msg, va); |
1628 | page = pfn_to_page((gpa & PT64_BASE_ADDR_MASK) | ||
1629 | >> PAGE_SHIFT); | ||
1630 | kvm_release_page_clean(page); | 1615 | kvm_release_page_clean(page); |
1631 | 1616 | ||
1632 | } | 1617 | } |