KVM: pci-assign: do not map smm memory slot pages in vt-d page tables
authorHerongguang (Stephen) <herongguang.he@huawei.com>
Mon, 27 Mar 2017 07:21:17 +0000 (15:21 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 28 Mar 2017 08:08:54 +0000 (10:08 +0200)
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>
virt/kvm/kvm_main.c

index ef1aa7f1ed7a569c85a2c3e1a2495cbd98a7da35..88257b311cb579b5b720330456f99fbec97a58ac 100644 (file)
@@ -1065,7 +1065,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
         * changes) is disallowed above, so any other attribute changes getting
         * 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);
                return r;
        }