From: Joerg Roedel <joro@8bytes.org>
To: iommu@lists.linux-foundation.org
Cc: linux-kernel@vger.kernel.org,
Tom Lendacky <thomas.lendacky@amd.com>,
Arindam Nath <arindam.nath@amd.com>,
Joerg Roedel <jroedel@suse.de>
Subject: [PATCH 7/7] iommu/amd: Remove queue_release() function
Date: Wed, 7 Jun 2017 16:58:20 +0200 [thread overview]
Message-ID: <1496847500-6781-8-git-send-email-joro@8bytes.org> (raw)
In-Reply-To: <1496847500-6781-1-git-send-email-joro@8bytes.org>
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
prev parent reply other threads:[~2017-06-07 15:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-07 14:58 [PATCH 0/7] iommu/amd: Optimize iova queue flushing Joerg Roedel
2017-06-07 14:58 ` [PATCH 1/7] iommu/amd: Rip out old queue flushing code Joerg Roedel
2017-06-07 14:58 ` [PATCH 2/7] iommu/amd: Add per-domain flush-queue data structures Joerg Roedel
2017-06-07 14:58 ` [PATCH 3/7] iommu/amd: Make use of the per-domain flush queue Joerg Roedel
2017-06-07 14:58 ` [PATCH 4/7] iommu/amd: Add locking to per-domain flush-queue Joerg Roedel
2017-06-07 14:58 ` [PATCH 5/7] iommu/amd: Add flush counters to struct dma_ops_domain Joerg Roedel
2017-06-07 14:58 ` [PATCH 6/7] iommu/amd: Add per-domain timer to flush per-cpu queues Joerg Roedel
2017-06-07 14:58 ` Joerg Roedel [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1496847500-6781-8-git-send-email-joro@8bytes.org \
--to=joro@8bytes.org \
--cc=arindam.nath@amd.com \
--cc=iommu@lists.linux-foundation.org \
--cc=jroedel@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=thomas.lendacky@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox