Commit 6a49f85c authored by Xiao Guangrong's avatar Xiao Guangrong Committed by Paolo Bonzini

KVM: MMU: introduce kvm_zap_rmapp

Split kvm_unmap_rmapp and introduce kvm_zap_rmapp which will be used in the
later patch
Signed-off-by: default avatarXiao Guangrong <guangrong.xiao@linux.intel.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent d77aa73c
...@@ -1349,24 +1349,28 @@ static bool rmap_write_protect(struct kvm *kvm, u64 gfn) ...@@ -1349,24 +1349,28 @@ static bool rmap_write_protect(struct kvm *kvm, u64 gfn)
return write_protected; return write_protected;
} }
static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp, static bool kvm_zap_rmapp(struct kvm *kvm, unsigned long *rmapp)
struct kvm_memory_slot *slot, gfn_t gfn, int level,
unsigned long data)
{ {
u64 *sptep; u64 *sptep;
struct rmap_iterator iter; struct rmap_iterator iter;
int need_tlb_flush = 0; bool flush = false;
while ((sptep = rmap_get_first(*rmapp, &iter))) { while ((sptep = rmap_get_first(*rmapp, &iter))) {
BUG_ON(!(*sptep & PT_PRESENT_MASK)); BUG_ON(!(*sptep & PT_PRESENT_MASK));
rmap_printk("kvm_rmap_unmap_hva: spte %p %llx gfn %llx (%d)\n", rmap_printk("%s: spte %p %llx.\n", __func__, sptep, *sptep);
sptep, *sptep, gfn, level);
drop_spte(kvm, sptep); drop_spte(kvm, sptep);
need_tlb_flush = 1; flush = true;
} }
return need_tlb_flush; return flush;
}
static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp,
struct kvm_memory_slot *slot, gfn_t gfn, int level,
unsigned long data)
{
return kvm_zap_rmapp(kvm, rmapp);
} }
static int kvm_set_pte_rmapp(struct kvm *kvm, unsigned long *rmapp, static int kvm_set_pte_rmapp(struct kvm *kvm, unsigned long *rmapp,
......
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