summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJoerg Roedel <jroedel@suse.de>2017-06-22 12:16:33 +0200
committerJoerg Roedel <jroedel@suse.de>2017-06-22 12:54:22 +0200
commit9ce3a72cd7f7e0b9ba1c5952e4461b363824bca9 (patch)
treee294c651d3fc64d471c70ef75a9629a6907adebb /drivers
parentffa080ebb5405b27b0b84a3a75c9cdf4ed3d28da (diff)
downloadlinux-9ce3a72cd7f7e0b9ba1c5952e4461b363824bca9.tar.bz2
iommu/amd: Free already flushed ring-buffer entries before full-check
To benefit from IOTLB flushes on other CPUs we have to free the already flushed IOVAs from the ring-buffer before we do the queue_ring_full() check. Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/iommu/amd_iommu.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index 95ee360a5199..c618c26a3b33 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -1911,14 +1911,20 @@ static void queue_add(struct dma_ops_domain *dom,
spin_lock_irqsave(&queue->lock, flags);
/*
+ * First remove the enries from the ring-buffer that are already
+ * flushed to make the below queue_ring_full() check less likely
+ */
+ queue_ring_free_flushed(dom, queue);
+
+ /*
* When ring-queue is full, flush the entries from the IOTLB so
* that we can free all entries with queue_ring_free_flushed()
* below.
*/
- if (queue_ring_full(queue))
+ if (queue_ring_full(queue)) {
dma_ops_domain_flush_tlb(dom);
-
- queue_ring_free_flushed(dom, queue);
+ queue_ring_free_flushed(dom, queue);
+ }
idx = queue_ring_add(queue);