aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/paging_tmpl.h
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2007-12-09 10:32:30 -0500
committerAvi Kivity <avi@qumranet.com>2008-01-30 10:53:20 -0500
commite3f955042219a595b1c3208e12c20860f23f72fb (patch)
treef6ff71fa2026625bc0223ecb04ffaff67cb91008 /drivers/kvm/paging_tmpl.h
parentb4ab019ce71efe30790b5aaa396549a16bb20608 (diff)
KVM: MMU: Pass pte dirty flag to set_pte() instead of calculating it on-site
This allows us to remove its dependency on pt_element_t. Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/paging_tmpl.h')
-rw-r--r--drivers/kvm/paging_tmpl.h17
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/kvm/paging_tmpl.h b/drivers/kvm/paging_tmpl.h
index 179ce9e8145e..ca8d51574118 100644
--- a/drivers/kvm/paging_tmpl.h
+++ b/drivers/kvm/paging_tmpl.h
@@ -235,14 +235,12 @@ err:
235 return 0; 235 return 0;
236} 236}
237 237
238static void FNAME(set_pte)(struct kvm_vcpu *vcpu, pt_element_t gpte, 238static void FNAME(set_pte)(struct kvm_vcpu *vcpu, u64 *shadow_pte,
239 u64 *shadow_pte, unsigned pt_access, 239 unsigned pt_access, unsigned pte_access,
240 unsigned pte_access, 240 int user_fault, int write_fault, int dirty,
241 int user_fault, int write_fault,
242 int *ptwrite, struct guest_walker *walker, 241 int *ptwrite, struct guest_walker *walker,
243 gfn_t gfn) 242 gfn_t gfn)
244{ 243{
245 int dirty = gpte & PT_DIRTY_MASK;
246 u64 spte; 244 u64 spte;
247 int was_rmapped = is_rmap_pte(*shadow_pte); 245 int was_rmapped = is_rmap_pte(*shadow_pte);
248 struct page *page; 246 struct page *page;
@@ -338,8 +336,8 @@ static void FNAME(update_pte)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *page,
338 return; 336 return;
339 pgprintk("%s: gpte %llx spte %p\n", __FUNCTION__, (u64)gpte, spte); 337 pgprintk("%s: gpte %llx spte %p\n", __FUNCTION__, (u64)gpte, spte);
340 pte_access = page->role.access & FNAME(gpte_access)(vcpu, gpte); 338 pte_access = page->role.access & FNAME(gpte_access)(vcpu, gpte);
341 FNAME(set_pte)(vcpu, gpte, spte, page->role.access, pte_access, 339 FNAME(set_pte)(vcpu, spte, page->role.access, pte_access, 0, 0,
342 0, 0, NULL, NULL, gpte_to_gfn(gpte)); 340 gpte & PT_DIRTY_MASK, NULL, NULL, gpte_to_gfn(gpte));
343} 341}
344 342
345/* 343/*
@@ -402,9 +400,8 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr,
402 *shadow_ent = shadow_pte; 400 *shadow_ent = shadow_pte;
403 } 401 }
404 402
405 FNAME(set_pte)(vcpu, walker->pte, shadow_ent, 403 FNAME(set_pte)(vcpu, shadow_ent, access, walker->pte_access & access,
406 access, walker->pte_access & access, 404 user_fault, write_fault, walker->pte & PT_DIRTY_MASK,
407 user_fault, write_fault,
408 ptwrite, walker, walker->gfn); 405 ptwrite, walker, walker->gfn);
409 406
410 return shadow_ent; 407 return shadow_ent;