From: Joerg Roedel Date: Mon, 21 Dec 2015 12:23:59 +0000 (+0100) Subject: iommu/amd: Flush the IOMMU TLB before the addresses are freed X-Git-Tag: v4.14-rc1~3980^2^7~19 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=84b3a0bc88534d9e49d1642957f64db61a3aa5c4;p=platform%2Fkernel%2Flinux-rpi.git iommu/amd: Flush the IOMMU TLB before the addresses are freed This allows to keep the bitmap_lock only for a very short period of time. Signed-off-by: Joerg Roedel --- diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 42c0a81ba..69021ec 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c @@ -2527,14 +2527,14 @@ static void __unmap_single(struct dma_ops_domain *dma_dom, start += PAGE_SIZE; } - SUB_STATS_COUNTER(alloced_io_mem, size); - - dma_ops_free_addresses(dma_dom, dma_addr, pages); - if (amd_iommu_unmap_flush || dma_dom->need_flush) { domain_flush_pages(&dma_dom->domain, flush_addr, size); dma_dom->need_flush = false; } + + SUB_STATS_COUNTER(alloced_io_mem, size); + + dma_ops_free_addresses(dma_dom, dma_addr, pages); } /*