diff options
-rw-r--r-- | drivers/kvm/kvm.h | 4 | ||||
-rw-r--r-- | drivers/kvm/paging_tmpl.h | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h index 048849d97b35..eda82cded88e 100644 --- a/drivers/kvm/kvm.h +++ b/drivers/kvm/kvm.h | |||
@@ -499,6 +499,10 @@ static inline int memslot_id(struct kvm *kvm, struct kvm_memory_slot *slot) | |||
499 | return slot - kvm->memslots; | 499 | return slot - kvm->memslots; |
500 | } | 500 | } |
501 | 501 | ||
502 | static inline gpa_t gfn_to_gpa(gfn_t gfn) | ||
503 | { | ||
504 | return (gpa_t)gfn << PAGE_SHIFT; | ||
505 | } | ||
502 | 506 | ||
503 | enum kvm_stat_kind { | 507 | enum kvm_stat_kind { |
504 | KVM_STAT_VM, | 508 | KVM_STAT_VM, |
diff --git a/drivers/kvm/paging_tmpl.h b/drivers/kvm/paging_tmpl.h index a3da98bfd6a6..b24bc7c86078 100644 --- a/drivers/kvm/paging_tmpl.h +++ b/drivers/kvm/paging_tmpl.h | |||
@@ -110,7 +110,7 @@ static int FNAME(walk_addr)(struct guest_walker *walker, | |||
110 | index = PT_INDEX(addr, walker->level); | 110 | index = PT_INDEX(addr, walker->level); |
111 | 111 | ||
112 | table_gfn = gpte_to_gfn(pte); | 112 | table_gfn = gpte_to_gfn(pte); |
113 | pte_gpa = table_gfn << PAGE_SHIFT; | 113 | pte_gpa = gfn_to_gpa(table_gfn); |
114 | pte_gpa += index * sizeof(pt_element_t); | 114 | pte_gpa += index * sizeof(pt_element_t); |
115 | walker->table_gfn[walker->level - 1] = table_gfn; | 115 | walker->table_gfn[walker->level - 1] = table_gfn; |
116 | pgprintk("%s: table_gfn[%d] %lx\n", __FUNCTION__, | 116 | pgprintk("%s: table_gfn[%d] %lx\n", __FUNCTION__, |
@@ -442,7 +442,7 @@ static gpa_t FNAME(gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t vaddr) | |||
442 | r = FNAME(walk_addr)(&walker, vcpu, vaddr, 0, 0, 0); | 442 | r = FNAME(walk_addr)(&walker, vcpu, vaddr, 0, 0, 0); |
443 | 443 | ||
444 | if (r) { | 444 | if (r) { |
445 | gpa = (gpa_t)walker.gfn << PAGE_SHIFT; | 445 | gpa = gfn_to_gpa(walker.gfn); |
446 | gpa |= vaddr & ~PAGE_MASK; | 446 | gpa |= vaddr & ~PAGE_MASK; |
447 | } | 447 | } |
448 | 448 | ||