Hi Will,

On Thu, Jul 11, 2019 at 06:19:12PM +0100, Will Deacon wrote:
>  static void __iommu_dma_unmap(struct iommu_domain *domain, dma_addr_t 
> dma_addr,
>               size_t size)
>  {
> +     struct iommu_iotlb_gather iotlb_gather;
>       struct iommu_dma_cookie *cookie = domain->iova_cookie;
>       struct iova_domain *iovad = &cookie->iovad;
>       size_t iova_off = iova_offset(iovad, dma_addr);
> +     size_t unmapped;
>  
>       dma_addr -= iova_off;
>       size = iova_align(iovad, size + iova_off);
> +     iommu_iotlb_gather_init(&iotlb_gather);
> +
> +     unmapped = iommu_unmap_fast(domain, dma_addr, size, &iotlb_gather);
> +     WARN_ON(unmapped != size);
>  
> -     WARN_ON(iommu_unmap_fast(domain, dma_addr, size) != size);
>       if (!cookie->fq_domain)
> -             iommu_tlb_sync(domain);
> +             iommu_tlb_sync(domain, &iotlb_gather);
>       iommu_dma_free_iova(cookie, dma_addr, size);

I looked through your patches and was wondering if we can't make the
'struct iotlb_gather' a member of 'struct iommu_domain' and update it
transparently for the user? That would make things easier for users of
the iommu-api.

Regards,

        Joerg
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to