Commit e3f95504 authored by Avi Kivity's avatar Avi Kivity

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: default avatarAvi Kivity <avi@qumranet.com>
parent b4ab019c
...@@ -235,14 +235,12 @@ static int FNAME(walk_addr)(struct guest_walker *walker, ...@@ -235,14 +235,12 @@ static int FNAME(walk_addr)(struct guest_walker *walker,
return 0; return 0;
} }
static void FNAME(set_pte)(struct kvm_vcpu *vcpu, pt_element_t gpte, static void FNAME(set_pte)(struct kvm_vcpu *vcpu, u64 *shadow_pte,
u64 *shadow_pte, unsigned pt_access, unsigned pt_access, unsigned pte_access,
unsigned pte_access, int user_fault, int write_fault, int dirty,
int user_fault, int write_fault,
int *ptwrite, struct guest_walker *walker, int *ptwrite, struct guest_walker *walker,
gfn_t gfn) gfn_t gfn)
{ {
int dirty = gpte & PT_DIRTY_MASK;
u64 spte; u64 spte;
int was_rmapped = is_rmap_pte(*shadow_pte); int was_rmapped = is_rmap_pte(*shadow_pte);
struct page *page; struct page *page;
...@@ -338,8 +336,8 @@ static void FNAME(update_pte)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *page, ...@@ -338,8 +336,8 @@ static void FNAME(update_pte)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *page,
return; return;
pgprintk("%s: gpte %llx spte %p\n", __FUNCTION__, (u64)gpte, spte); pgprintk("%s: gpte %llx spte %p\n", __FUNCTION__, (u64)gpte, spte);
pte_access = page->role.access & FNAME(gpte_access)(vcpu, gpte); pte_access = page->role.access & FNAME(gpte_access)(vcpu, gpte);
FNAME(set_pte)(vcpu, gpte, spte, page->role.access, pte_access, FNAME(set_pte)(vcpu, spte, page->role.access, pte_access, 0, 0,
0, 0, NULL, NULL, gpte_to_gfn(gpte)); gpte & PT_DIRTY_MASK, NULL, NULL, gpte_to_gfn(gpte));
} }
/* /*
...@@ -402,9 +400,8 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr, ...@@ -402,9 +400,8 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr,
*shadow_ent = shadow_pte; *shadow_ent = shadow_pte;
} }
FNAME(set_pte)(vcpu, walker->pte, shadow_ent, FNAME(set_pte)(vcpu, shadow_ent, access, walker->pte_access & access,
access, walker->pte_access & access, user_fault, write_fault, walker->pte & PT_DIRTY_MASK,
user_fault, write_fault,
ptwrite, walker, walker->gfn); ptwrite, walker, walker->gfn);
return shadow_ent; return shadow_ent;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment