aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/paging_tmpl.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/kvm/paging_tmpl.h')
-rw-r--r--drivers/kvm/paging_tmpl.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/kvm/paging_tmpl.h b/drivers/kvm/paging_tmpl.h
index 8c48528a6e89..3a35c8067dec 100644
--- a/drivers/kvm/paging_tmpl.h
+++ b/drivers/kvm/paging_tmpl.h
@@ -52,6 +52,7 @@
52 */ 52 */
53struct guest_walker { 53struct guest_walker {
54 int level; 54 int level;
55 gfn_t table_gfn;
55 pt_element_t *table; 56 pt_element_t *table;
56 pt_element_t inherited_ar; 57 pt_element_t inherited_ar;
57}; 58};
@@ -63,8 +64,8 @@ static void FNAME(init_walker)(struct guest_walker *walker,
63 struct kvm_memory_slot *slot; 64 struct kvm_memory_slot *slot;
64 65
65 walker->level = vcpu->mmu.root_level; 66 walker->level = vcpu->mmu.root_level;
66 slot = gfn_to_memslot(vcpu->kvm, 67 walker->table_gfn = (vcpu->cr3 & PT64_BASE_ADDR_MASK) >> PAGE_SHIFT;
67 (vcpu->cr3 & PT64_BASE_ADDR_MASK) >> PAGE_SHIFT); 68 slot = gfn_to_memslot(vcpu->kvm, walker->table_gfn);
68 hpa = safe_gpa_to_hpa(vcpu, vcpu->cr3 & PT64_BASE_ADDR_MASK); 69 hpa = safe_gpa_to_hpa(vcpu, vcpu->cr3 & PT64_BASE_ADDR_MASK);
69 walker->table = kmap_atomic(pfn_to_page(hpa >> PAGE_SHIFT), KM_USER0); 70 walker->table = kmap_atomic(pfn_to_page(hpa >> PAGE_SHIFT), KM_USER0);
70 71
@@ -133,6 +134,8 @@ static pt_element_t *FNAME(fetch_guest)(struct kvm_vcpu *vcpu,
133 return &walker->table[index]; 134 return &walker->table[index];
134 if (walker->level != 3 || is_long_mode(vcpu)) 135 if (walker->level != 3 || is_long_mode(vcpu))
135 walker->inherited_ar &= walker->table[index]; 136 walker->inherited_ar &= walker->table[index];
137 walker->table_gfn = (walker->table[index] & PT_BASE_ADDR_MASK)
138 >> PAGE_SHIFT;
136 paddr = safe_gpa_to_hpa(vcpu, walker->table[index] & PT_BASE_ADDR_MASK); 139 paddr = safe_gpa_to_hpa(vcpu, walker->table[index] & PT_BASE_ADDR_MASK);
137 kunmap_atomic(walker->table, KM_USER0); 140 kunmap_atomic(walker->table, KM_USER0);
138 walker->table = kmap_atomic(pfn_to_page(paddr >> PAGE_SHIFT), 141 walker->table = kmap_atomic(pfn_to_page(paddr >> PAGE_SHIFT),