summaryrefslogtreecommitdiff
path: root/drivers/iommu/amd_iommu.c
diff options
context:
space:
mode:
authorJoerg Roedel <jroedel@suse.de>2017-06-07 15:38:15 +0300
committerJoerg Roedel <jroedel@suse.de>2017-06-08 15:39:57 +0300
commitac3b708ad49f77b44faa104057783f161491e9e4 (patch)
tree0787703259e0200bfb6a265fdc30baced2e344fa /drivers/iommu/amd_iommu.c
parentfca6af6a5976dfa00182232f666b4f789c98bd0c (diff)
downloadlinux-ac3b708ad49f77b44faa104057783f161491e9e4.tar.xz
iommu/amd: Remove queue_release() function
We can use queue_ring_free_flushed() instead, so remove this redundancy. Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu/amd_iommu.c')
-rw-r--r--drivers/iommu/amd_iommu.c28
1 files changed, 8 insertions, 20 deletions
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index 00c1796e07bf..6498f5baa7ea 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -1859,21 +1859,6 @@ static inline bool queue_ring_full(struct flush_queue *queue)
#define queue_ring_for_each(i, q) \
for (i = (q)->head; i != (q)->tail; i = (i + 1) % FLUSH_QUEUE_SIZE)
-static void queue_release(struct dma_ops_domain *dom,
- struct flush_queue *queue)
-{
- unsigned i;
-
- assert_spin_locked(&queue->lock);
-
- queue_ring_for_each(i, queue)
- free_iova_fast(&dom->iovad,
- queue->entries[i].iova_pfn,
- queue->entries[i].pages);
-
- queue->head = queue->tail = 0;
-}
-
static inline unsigned queue_ring_add(struct flush_queue *queue)
{
unsigned idx = queue->tail;
@@ -1925,12 +1910,15 @@ static void queue_add(struct dma_ops_domain *dom,
queue = get_cpu_ptr(dom->flush_queue);
spin_lock_irqsave(&queue->lock, flags);
- queue_ring_free_flushed(dom, queue);
-
- if (queue_ring_full(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))
dma_ops_domain_flush_tlb(dom);
- queue_release(dom, queue);
- }
+
+ queue_ring_free_flushed(dom, queue);
idx = queue_ring_add(queue);