diff options
| -rw-r--r-- | arch/x86/kvm/x86.c | 8 | ||||
| -rw-r--r-- | virt/kvm/kvm_main.c | 7 |
2 files changed, 8 insertions, 7 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 37797a090a8f..6f6812ec8419 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
| @@ -6445,6 +6445,14 @@ void kvm_arch_commit_memory_region(struct kvm *kvm, | |||
| 6445 | kvm_mmu_change_mmu_pages(kvm, nr_mmu_pages); | 6445 | kvm_mmu_change_mmu_pages(kvm, nr_mmu_pages); |
| 6446 | kvm_mmu_slot_remove_write_access(kvm, mem->slot); | 6446 | kvm_mmu_slot_remove_write_access(kvm, mem->slot); |
| 6447 | spin_unlock(&kvm->mmu_lock); | 6447 | spin_unlock(&kvm->mmu_lock); |
| 6448 | /* | ||
| 6449 | * If memory slot is created, or moved, we need to clear all | ||
| 6450 | * mmio sptes. | ||
| 6451 | */ | ||
| 6452 | if (npages && old.base_gfn != mem->guest_phys_addr >> PAGE_SHIFT) { | ||
| 6453 | kvm_mmu_zap_all(kvm); | ||
| 6454 | kvm_reload_remote_mmus(kvm); | ||
| 6455 | } | ||
| 6448 | } | 6456 | } |
| 6449 | 6457 | ||
| 6450 | void kvm_arch_flush_shadow_all(struct kvm *kvm) | 6458 | void kvm_arch_flush_shadow_all(struct kvm *kvm) |
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index f41ea1262d51..4fe02d900810 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
| @@ -849,13 +849,6 @@ int __kvm_set_memory_region(struct kvm *kvm, | |||
| 849 | 849 | ||
| 850 | kvm_arch_commit_memory_region(kvm, mem, old, user_alloc); | 850 | kvm_arch_commit_memory_region(kvm, mem, old, user_alloc); |
| 851 | 851 | ||
| 852 | /* | ||
| 853 | * If the new memory slot is created, we need to clear all | ||
| 854 | * mmio sptes. | ||
| 855 | */ | ||
| 856 | if (npages && old.base_gfn != mem->guest_phys_addr >> PAGE_SHIFT) | ||
| 857 | kvm_arch_flush_shadow_all(kvm); | ||
| 858 | |||
| 859 | kvm_free_physmem_slot(&old, &new); | 852 | kvm_free_physmem_slot(&old, &new); |
| 860 | kfree(old_memslots); | 853 | kfree(old_memslots); |
| 861 | 854 | ||
