diff options
author | Izik Eidus <izike@qumranet.com> | 2007-11-20 05:02:12 -0500 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-01-30 10:53:10 -0500 |
commit | b238f7bc2dd5e0e8ecbd28863d6d03e490c652ce (patch) | |
tree | 3023d72504412f6e82243af736ccbed695e8a2fb /drivers | |
parent | d835dfecd00fd770288dcd9a46c0e0966d526fdf (diff) |
KVM: MMU: Code cleanup
Signed-off-by: Izik Eidus <izike@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/kvm/paging_tmpl.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/kvm/paging_tmpl.h b/drivers/kvm/paging_tmpl.h index 92b93134a2a6..6e013015f0a8 100644 --- a/drivers/kvm/paging_tmpl.h +++ b/drivers/kvm/paging_tmpl.h | |||
@@ -187,6 +187,7 @@ static void FNAME(set_pte_common)(struct kvm_vcpu *vcpu, | |||
187 | int dirty = gpte & PT_DIRTY_MASK; | 187 | int dirty = gpte & PT_DIRTY_MASK; |
188 | u64 spte; | 188 | u64 spte; |
189 | int was_rmapped = is_rmap_pte(*shadow_pte); | 189 | int was_rmapped = is_rmap_pte(*shadow_pte); |
190 | struct page *page; | ||
190 | 191 | ||
191 | pgprintk("%s: spte %llx gpte %llx access %llx write_fault %d" | 192 | pgprintk("%s: spte %llx gpte %llx access %llx write_fault %d" |
192 | " user_fault %d gfn %lx\n", | 193 | " user_fault %d gfn %lx\n", |
@@ -205,6 +206,12 @@ static void FNAME(set_pte_common)(struct kvm_vcpu *vcpu, | |||
205 | 206 | ||
206 | paddr = gpa_to_hpa(vcpu->kvm, gaddr & PT64_BASE_ADDR_MASK); | 207 | paddr = gpa_to_hpa(vcpu->kvm, gaddr & PT64_BASE_ADDR_MASK); |
207 | 208 | ||
209 | /* | ||
210 | * the reason paddr get mask even that it isnt pte is beacuse the | ||
211 | * HPA_ERR_MASK bit might be used to signal error | ||
212 | */ | ||
213 | page = pfn_to_page((paddr & PT64_BASE_ADDR_MASK) >> PAGE_SHIFT); | ||
214 | |||
208 | spte |= PT_PRESENT_MASK; | 215 | spte |= PT_PRESENT_MASK; |
209 | if (access_bits & PT_USER_MASK) | 216 | if (access_bits & PT_USER_MASK) |
210 | spte |= PT_USER_MASK; | 217 | spte |= PT_USER_MASK; |
@@ -212,8 +219,7 @@ static void FNAME(set_pte_common)(struct kvm_vcpu *vcpu, | |||
212 | if (is_error_hpa(paddr)) { | 219 | if (is_error_hpa(paddr)) { |
213 | set_shadow_pte(shadow_pte, | 220 | set_shadow_pte(shadow_pte, |
214 | shadow_trap_nonpresent_pte | PT_SHADOW_IO_MARK); | 221 | shadow_trap_nonpresent_pte | PT_SHADOW_IO_MARK); |
215 | kvm_release_page_clean(pfn_to_page((paddr & PT64_BASE_ADDR_MASK) | 222 | kvm_release_page_clean(page); |
216 | >> PAGE_SHIFT)); | ||
217 | return; | 223 | return; |
218 | } | 224 | } |
219 | 225 | ||
@@ -254,17 +260,11 @@ unshadowed: | |||
254 | if (!was_rmapped) { | 260 | if (!was_rmapped) { |
255 | rmap_add(vcpu, shadow_pte, (gaddr & PT64_BASE_ADDR_MASK) | 261 | rmap_add(vcpu, shadow_pte, (gaddr & PT64_BASE_ADDR_MASK) |
256 | >> PAGE_SHIFT); | 262 | >> PAGE_SHIFT); |
257 | if (!is_rmap_pte(*shadow_pte)) { | 263 | if (!is_rmap_pte(*shadow_pte)) |
258 | struct page *page; | ||
259 | |||
260 | page = pfn_to_page((paddr & PT64_BASE_ADDR_MASK) | ||
261 | >> PAGE_SHIFT); | ||
262 | kvm_release_page_clean(page); | 264 | kvm_release_page_clean(page); |
263 | } | ||
264 | } | 265 | } |
265 | else | 266 | else |
266 | kvm_release_page_clean(pfn_to_page((paddr & PT64_BASE_ADDR_MASK) | 267 | kvm_release_page_clean(page); |
267 | >> PAGE_SHIFT)); | ||
268 | if (!ptwrite || !*ptwrite) | 268 | if (!ptwrite || !*ptwrite) |
269 | vcpu->last_pte_updated = shadow_pte; | 269 | vcpu->last_pte_updated = shadow_pte; |
270 | } | 270 | } |