diff options
author | Dor Laor <dor.laor@qumranet.com> | 2007-03-30 06:06:33 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2007-05-03 03:52:28 -0400 |
commit | e0fa826f969c262c23908953bf85add487cc2e6c (patch) | |
tree | b9fdaaffea660aadd1120267e6966da3f5d10afe /drivers | |
parent | df513e2cdd099822ed32cbc20aaf4ff310372202 (diff) |
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')
-rw-r--r-- | drivers/kvm/kvm.h | 1 | ||||
-rw-r--r-- | drivers/kvm/mmu.c | 17 |
2 files changed, 18 insertions, 0 deletions
diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h index 6d0bd7aab92e..59357bea5b61 100644 --- a/drivers/kvm/kvm.h +++ b/drivers/kvm/kvm.h | |||
@@ -430,6 +430,7 @@ int kvm_mmu_setup(struct kvm_vcpu *vcpu); | |||
430 | 430 | ||
431 | int kvm_mmu_reset_context(struct kvm_vcpu *vcpu); | 431 | int kvm_mmu_reset_context(struct kvm_vcpu *vcpu); |
432 | void kvm_mmu_slot_remove_write_access(struct kvm_vcpu *vcpu, int slot); | 432 | void kvm_mmu_slot_remove_write_access(struct kvm_vcpu *vcpu, int slot); |
433 | void kvm_mmu_zap_all(struct kvm_vcpu *vcpu); | ||
433 | 434 | ||
434 | hpa_t gpa_to_hpa(struct kvm_vcpu *vcpu, gpa_t gpa); | 435 | hpa_t gpa_to_hpa(struct kvm_vcpu *vcpu, gpa_t gpa); |
435 | #define HPA_MSB ((sizeof(hpa_t) * 8) - 1) | 436 | #define HPA_MSB ((sizeof(hpa_t) * 8) - 1) |
diff --git a/drivers/kvm/mmu.c b/drivers/kvm/mmu.c index d81b9cd3465f..376800a33968 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) | |||
1314 | } | 1314 | } |
1315 | } | 1315 | } |
1316 | 1316 | ||
1317 | void kvm_mmu_zap_all(struct kvm_vcpu *vcpu) | ||
1318 | { | ||
1319 | destroy_kvm_mmu(vcpu); | ||
1320 | |||
1321 | while (!list_empty(&vcpu->kvm->active_mmu_pages)) { | ||
1322 | struct kvm_mmu_page *page; | ||
1323 | |||
1324 | page = container_of(vcpu->kvm->active_mmu_pages.next, | ||
1325 | struct kvm_mmu_page, link); | ||
1326 | kvm_mmu_zap_page(vcpu, page); | ||
1327 | } | ||
1328 | |||
1329 | mmu_free_memory_caches(vcpu); | ||
1330 | kvm_arch_ops->tlb_flush(vcpu); | ||
1331 | init_kvm_mmu(vcpu); | ||
1332 | } | ||
1333 | |||
1317 | #ifdef AUDIT | 1334 | #ifdef AUDIT |
1318 | 1335 | ||
1319 | static const char *audit_msg; | 1336 | static const char *audit_msg; |