[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 10/11] vfio: Unregister IOMMU notifiers when containe
From: |
Alex Williamson |
Subject: |
[Qemu-devel] [PULL 10/11] vfio: Unregister IOMMU notifiers when container is destroyed |
Date: |
Mon, 06 Jul 2015 12:35:35 -0600 |
User-agent: |
StGit/0.17.1-dirty |
From: Alexey Kardashevskiy <address@hidden>
On systems with guest visible IOMMU, adding a new memory region onto
PCI bus calls vfio_listener_region_add() for every DMA window. This
installs a notifier for IOMMU memory regions. The notifier is supposed
to be removed vfio_listener_region_del(), however in the case of mixed
PHB (emulated + VFIO devices) when last VFIO device is unplugged and
container gets destroyed, all existing DMA windows stay alive altogether
with the notifiers which are on the linked list which head was in
the destroyed container.
This unregisters IOMMU memory region notifier when a container is
destroyed.
Signed-off-by: Alexey Kardashevskiy <address@hidden>
Reviewed-by: David Gibson <address@hidden>
Signed-off-by: Alex Williamson <address@hidden>
---
hw/vfio/common.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index b1045da..85ee9b0 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -772,11 +772,19 @@ static void vfio_disconnect_container(VFIOGroup *group)
if (QLIST_EMPTY(&container->group_list)) {
VFIOAddressSpace *space = container->space;
+ VFIOGuestIOMMU *giommu, *tmp;
if (container->iommu_data.release) {
container->iommu_data.release(container);
}
QLIST_REMOVE(container, next);
+
+ QLIST_FOREACH_SAFE(giommu, &container->giommu_list, giommu_next, tmp) {
+ memory_region_unregister_iommu_notifier(&giommu->n);
+ QLIST_REMOVE(giommu, giommu_next);
+ g_free(giommu);
+ }
+
trace_vfio_disconnect_container(container->fd);
close(container->fd);
g_free(container);
- [Qemu-devel] [PULL 00/11] VFIO updates for 2.4-rc0, Alex Williamson, 2015/07/06
- [Qemu-devel] [PULL 02/11] cpu-all: complete "real" host page size API, Alex Williamson, 2015/07/06
- [Qemu-devel] [PULL 06/11] intc: arm_gic_kvm: set the qemu_irq/gsi mapping, Alex Williamson, 2015/07/06
- [Qemu-devel] [PULL 07/11] sysbus: add irq_routing_notifier, Alex Williamson, 2015/07/06
- [Qemu-devel] [PULL 08/11] kvm: some fixes to kvm_resamplefds_allowed, Alex Williamson, 2015/07/06
- [Qemu-devel] [PULL 09/11] hw/vfio/platform: add irqfd support, Alex Williamson, 2015/07/06
- [Qemu-devel] [PULL 10/11] vfio: Unregister IOMMU notifiers when container is destroyed,
Alex Williamson <=
- [Qemu-devel] [PULL 11/11] vfio/pci : Add pba_offset PCI quirk for Chelsio T5 devices, Alex Williamson, 2015/07/06
- [Qemu-devel] [PULL 01/11] vfio: fix return type of pread, Alex Williamson, 2015/07/06
- [Qemu-devel] [PULL 03/11] vfio: cpu: Use "real" page size API, Alex Williamson, 2015/07/06
- [Qemu-devel] [PULL 05/11] kvm-all.c: add qemu_irq/gsi hash table and utility routines, Alex Williamson, 2015/07/06
- [Qemu-devel] [PULL 04/11] kvm: rename kvm_irqchip_[add, remove]_irqfd_notifier with gsi suffix, Alex Williamson, 2015/07/06
- Re: [Qemu-devel] [PULL 00/11] VFIO updates for 2.4-rc0, Peter Maydell, 2015/07/07