Skip to content

Commit

Permalink
KVM: move postcommit flush to x86, as mmio sptes are x86 specific
Browse files Browse the repository at this point in the history
Other arches do not need this.

Signed-off-by: Marcelo Tosatti <[email protected]>

v2: fix incorrect deletion of mmio sptes on gpa move (noticed by Takuya)
Signed-off-by: Avi Kivity <[email protected]>
  • Loading branch information
matosatti authored and avikivity committed Sep 6, 2012
1 parent 12d6e75 commit 3b4dc3a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
8 changes: 8 additions & 0 deletions arch/x86/kvm/x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -6445,6 +6445,14 @@ void kvm_arch_commit_memory_region(struct kvm *kvm,
kvm_mmu_change_mmu_pages(kvm, nr_mmu_pages);
kvm_mmu_slot_remove_write_access(kvm, mem->slot);
spin_unlock(&kvm->mmu_lock);
/*
* If memory slot is created, or moved, we need to clear all
* mmio sptes.
*/
if (npages && old.base_gfn != mem->guest_phys_addr >> PAGE_SHIFT) {
kvm_mmu_zap_all(kvm);
kvm_reload_remote_mmus(kvm);
}
}

void kvm_arch_flush_shadow_all(struct kvm *kvm)
Expand Down
7 changes: 0 additions & 7 deletions virt/kvm/kvm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -849,13 +849,6 @@ int __kvm_set_memory_region(struct kvm *kvm,

kvm_arch_commit_memory_region(kvm, mem, old, user_alloc);

/*
* If the new memory slot is created, we need to clear all
* mmio sptes.
*/
if (npages && old.base_gfn != mem->guest_phys_addr >> PAGE_SHIFT)
kvm_arch_flush_shadow_all(kvm);

kvm_free_physmem_slot(&old, &new);
kfree(old_memslots);

Expand Down

0 comments on commit 3b4dc3a

Please sign in to comment.