diff options
Diffstat (limited to 'drivers/kvm/paging_tmpl.h')
-rw-r--r-- | drivers/kvm/paging_tmpl.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/kvm/paging_tmpl.h b/drivers/kvm/paging_tmpl.h index 7af49ae80e5a..11cac9ddf26a 100644 --- a/drivers/kvm/paging_tmpl.h +++ b/drivers/kvm/paging_tmpl.h | |||
@@ -179,6 +179,7 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr, | |||
179 | for (; ; level--) { | 179 | for (; ; level--) { |
180 | u32 index = SHADOW_PT_INDEX(addr, level); | 180 | u32 index = SHADOW_PT_INDEX(addr, level); |
181 | u64 *shadow_ent = ((u64 *)__va(shadow_addr)) + index; | 181 | u64 *shadow_ent = ((u64 *)__va(shadow_addr)) + index; |
182 | struct kvm_mmu_page *shadow_page; | ||
182 | u64 shadow_pte; | 183 | u64 shadow_pte; |
183 | 184 | ||
184 | if (is_present_pte(*shadow_ent) || is_io_pte(*shadow_ent)) { | 185 | if (is_present_pte(*shadow_ent) || is_io_pte(*shadow_ent)) { |
@@ -204,9 +205,10 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr, | |||
204 | return shadow_ent; | 205 | return shadow_ent; |
205 | } | 206 | } |
206 | 207 | ||
207 | shadow_addr = kvm_mmu_alloc_page(vcpu, shadow_ent); | 208 | shadow_page = kvm_mmu_alloc_page(vcpu, shadow_ent); |
208 | if (!VALID_PAGE(shadow_addr)) | 209 | if (!shadow_page) |
209 | return ERR_PTR(-ENOMEM); | 210 | return ERR_PTR(-ENOMEM); |
211 | shadow_addr = shadow_page->page_hpa; | ||
210 | shadow_pte = shadow_addr | PT_PRESENT_MASK | PT_ACCESSED_MASK | 212 | shadow_pte = shadow_addr | PT_PRESENT_MASK | PT_ACCESSED_MASK |
211 | | PT_WRITABLE_MASK | PT_USER_MASK; | 213 | | PT_WRITABLE_MASK | PT_USER_MASK; |
212 | *shadow_ent = shadow_pte; | 214 | *shadow_ent = shadow_pte; |