lkml.org 
[lkml]   [2012]   [Apr]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 2/2] kvm: unpin guest and free iommu domain after deassign last device
Date
Unpin the guest and free the iommu domain if there are no longer
any devices attached.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---
virt/kvm/assigned-dev.c | 3 +++
virt/kvm/iommu.c | 1 +
2 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c
index 01f572c..01e7c37 100644
--- a/virt/kvm/assigned-dev.c
+++ b/virt/kvm/assigned-dev.c
@@ -765,6 +765,9 @@ static int kvm_vm_ioctl_deassign_device(struct kvm *kvm,

kvm_free_assigned_device(kvm, match);

+ if (list_empty(&kvm->arch.assigned_dev_head))
+ kvm_iommu_unmap_guest(kvm);
+
out:
mutex_unlock(&kvm->lock);
return r;
diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c
index fec1723..ee4c236 100644
--- a/virt/kvm/iommu.c
+++ b/virt/kvm/iommu.c
@@ -342,5 +342,6 @@ int kvm_iommu_unmap_guest(struct kvm *kvm)

kvm_iommu_unmap_memslots(kvm);
iommu_domain_free(domain);
+ kvm->arch.iommu_domain = NULL;
return 0;
}


\
 
 \ /
  Last update: 2012-04-11 17:55    [from the cache]
©2003-2011 Jasper Spaans