[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [PATCH qemu v10 12/14] vfio: Unregister IOMMU notifiers w
From: |
David Gibson |
Subject: |
Re: [Qemu-ppc] [PATCH qemu v10 12/14] vfio: Unregister IOMMU notifiers when container is destroyed |
Date: |
Mon, 6 Jul 2015 20:33:06 +1000 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Mon, Jul 06, 2015 at 12:11:08PM +1000, Alexey Kardashevskiy wrote:
> 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 by 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>
Alex,
I think this is correct, but you've probably got a better
understanding of it. Will you take this through your tree?
> ---
> Changes:
> v10:
> * new to the patchset
> ---
> hw/vfio/common.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/hw/vfio/common.c b/hw/vfio/common.c
> index 89ef37b..8eacfd7 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);
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
pgpYoWQ516YxR.pgp
Description: PGP signature
- Re: [Qemu-ppc] [PATCH qemu v10 01/14] linux-headers: Update to 4.2-rc1, (continued)
- [Qemu-ppc] [PATCH qemu v10 07/14] spapr_iommu: Add root memory region, Alexey Kardashevskiy, 2015/07/05
- [Qemu-ppc] [PATCH qemu v10 11/14] spapr_pci_vfio: Enable multiple groups per container, Alexey Kardashevskiy, 2015/07/05
- [Qemu-ppc] [PATCH qemu v10 08/14] spapr_pci: Do complete reset of DMA config when resetting PHB, Alexey Kardashevskiy, 2015/07/05
- [Qemu-ppc] [PATCH qemu v10 06/14] spapr_iommu: Remove vfio_accel flag from sPAPRTCETable, Alexey Kardashevskiy, 2015/07/05
- [Qemu-ppc] [PATCH qemu v10 12/14] vfio: Unregister IOMMU notifiers when container is destroyed, Alexey Kardashevskiy, 2015/07/05
- Re: [Qemu-ppc] [PATCH qemu v10 12/14] vfio: Unregister IOMMU notifiers when container is destroyed,
David Gibson <=
[Qemu-ppc] [PATCH qemu v10 13/14] vfio: spapr: Add SPAPR IOMMU v2 support (DMA memory preregistering), Alexey Kardashevskiy, 2015/07/05