vfio: Unregister IOMMU notifiers when container is destroyed
commitf8d8a944009b7e836c718a05590ea6b36146978f
authorAlexey Kardashevskiy <aik@ozlabs.ru>
Mon, 6 Jul 2015 18:15:15 +0000 (6 12:15 -0600)
committerAlex Williamson <alex.williamson@redhat.com>
Mon, 6 Jul 2015 18:15:15 +0000 (6 12:15 -0600)
tree0f96e6b473fff7b25766628a3ecc8f4f824edda5
parentfb5f816499a5184a1336d72db030b8419b523082
vfio: Unregister IOMMU notifiers when container is destroyed

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 <aik@ozlabs.ru>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
hw/vfio/common.c