lkml.org 
[lkml]   [2017]   [Jun]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 7/7] iommu/amd: Remove queue_release() function
Date
From: Joerg Roedel <jroedel@suse.de>

We can use queue_ring_free_flushed() instead, so remove this
redundancy.

Signed-off-by: Joerg Roedel <jroedel@suse.de>
---
drivers/iommu/amd_iommu.c | 28 ++++++++--------------------
1 file changed, 8 insertions(+), 20 deletions(-)

diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index 2bdfabf..80efa72 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -1831,21 +1831,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;
@@ -1897,12 +1882,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);

--
2.7.4
\
 
 \ /
  Last update: 2017-06-12 01:07    [W:0.141 / U:0.292 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site