summaryrefslogtreecommitdiffstats
path: root/drivers/kvm/mmu.c
diff options
context:
space:
mode:
authorDor Laor <dor.laor@qumranet.com>2007-03-30 13:06:33 +0300
committerAvi Kivity <avi@qumranet.com>2007-05-03 10:52:28 +0300
commite0fa826f969c262c23908953bf85add487cc2e6c (patch)
treeb9fdaaffea660aadd1120267e6966da3f5d10afe /drivers/kvm/mmu.c
parentdf513e2cdd099822ed32cbc20aaf4ff310372202 (diff)
downloadop-kernel-dev-e0fa826f969c262c23908953bf85add487cc2e6c.zip
op-kernel-dev-e0fa826f969c262c23908953bf85add487cc2e6c.tar.gz
KVM: Add mmu cache clear function
Functions that play around with the physical memory map need a way to clear mappings to possibly nonexistent or invalid memory. Both the mmu cache and the processor tlb are cleared. Signed-off-by: Dor Laor <dor.laor@qumranet.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/mmu.c')
-rw-r--r--drivers/kvm/mmu.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/kvm/mmu.c b/drivers/kvm/mmu.c
index d81b9cd..376800a 100644
--- a/drivers/kvm/mmu.c
+++ b/drivers/kvm/mmu.c
@@ -1314,6 +1314,23 @@ void kvm_mmu_slot_remove_write_access(struct kvm_vcpu *vcpu, int slot)
}
}
+void kvm_mmu_zap_all(struct kvm_vcpu *vcpu)
+{
+ destroy_kvm_mmu(vcpu);
+
+ while (!list_empty(&vcpu->kvm->active_mmu_pages)) {
+ struct kvm_mmu_page *page;
+
+ page = container_of(vcpu->kvm->active_mmu_pages.next,
+ struct kvm_mmu_page, link);
+ kvm_mmu_zap_page(vcpu, page);
+ }
+
+ mmu_free_memory_caches(vcpu);
+ kvm_arch_ops->tlb_flush(vcpu);
+ init_kvm_mmu(vcpu);
+}
+
#ifdef AUDIT
static const char *audit_msg;
OpenPOWER on IntegriCloud