浏览代码

KVM: pci-assign: do not map smm memory slot pages in vt-d page tables

or VM memory are not put thus leaked in kvm_iommu_unmap_memslots() when
destroy VM.

This is consistent with current vfio implementation.

Signed-off-by: herongguang <herongguang.he@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Herongguang (Stephen) 8 年之前
父节点
当前提交
0292e169b2
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      virt/kvm/kvm_main.c

+ 1 - 1
virt/kvm/kvm_main.c

@@ -1065,7 +1065,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
 	 * changes) is disallowed above, so any other attribute changes getting
 	 * changes) is disallowed above, so any other attribute changes getting
 	 * here can be skipped.
 	 * here can be skipped.
 	 */
 	 */
-	if ((change == KVM_MR_CREATE) || (change == KVM_MR_MOVE)) {
+	if (as_id == 0 && (change == KVM_MR_CREATE || change == KVM_MR_MOVE)) {
 		r = kvm_iommu_map_pages(kvm, &new);
 		r = kvm_iommu_map_pages(kvm, &new);
 		return r;
 		return r;
 	}
 	}