Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1439350
| Path | csiph.com!news.mixmin.net!aioe.org!gothmog.csi.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Joerg Roedel <joro@8bytes.org> |
| Newsgroups | linux.kernel |
| Subject | [PATCH 19/20] iommu/amd: Flush iova queue before releasing dma_ops_domain |
| Date | Fri, 08 Jul 2016 13:50:02 +0200 |
| Message-ID | <rSCsa-4e3-51@gated-at.bofh.it> (permalink) |
| References | <rSCs9-4e3-3@gated-at.bofh.it> |
| X-Original-To | iommu@lists.linux-foundation.org |
| Dkim-Signature | v=1; a=rsa-sha256; c=simple/simple; d=8bytes.org; s=mail-1; t=1467978329; bh=w6YPAhRHWeF4HdrgFlMkpkaZr7d+2Z3PxgtwGkhOsCM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DgFwlpiaHhy6IaJ7MyvJjrSjx1iWCBfJZidsUdRMtU3W2X77XcBs43j2HkQzFg2uW 9itA+SXQHMOArem0vw85i4DGx0dDWWbkvCW0SM3/YNI8iAUmS/yvi/fajzQfIExzX/ 2FHNcYhYvwnwJmR4blnZmmpfWHTUmECJIdF8twhX3/nFXD+vjoI29aqsPMyxm21uQR RGgqZgGiDTns9TmaGGzwpUnLAgY2PWCcZwLaTq1oX1KIGAO8Iish+e06pnEdwoOaDY fOy5LBH9+AEexm3yTKN///ajHeUZeIsL0ZpGPVi7ryCPnxMxq0mllNZvSlchLlsvDi PE+qw81yRASGA== |
| X-Mailer | git-send-email 1.9.1 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 58 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | linux-kernel@vger.kernel.org, Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>, Vincent.Wan@amd.com, Joerg Roedel <jroedel@suse.de> |
| X-Original-Date | Fri, 8 Jul 2016 13:45:10 +0200 |
| X-Original-Message-ID | <1467978311-28322-20-git-send-email-joro@8bytes.org> |
| X-Original-References | <1467978311-28322-1-git-send-email-joro@8bytes.org> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1439350 |
Show key headers only | View raw
From: Joerg Roedel <jroedel@suse.de>
Before a dma_ops_domain can be freed, we need to make sure
it is not longer referenced by the flush queue. So empty the
queue before a dma_ops_domain can be freed.
Signed-off-by: Joerg Roedel <jroedel@suse.de>
---
drivers/iommu/amd_iommu.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index dc3dbb4..4052997 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -2162,12 +2162,10 @@ static void __queue_flush(struct flush_queue *queue)
queue->next = 0;
}
-void queue_flush_timeout(unsigned long unsused)
+static void queue_flush_all(void)
{
int cpu;
- atomic_set(&queue_timer_on, 0);
-
for_each_possible_cpu(cpu) {
struct flush_queue *queue;
unsigned long flags;
@@ -2180,6 +2178,12 @@ void queue_flush_timeout(unsigned long unsused)
}
}
+static void queue_flush_timeout(unsigned long unsused)
+{
+ atomic_set(&queue_timer_on, 0);
+ queue_flush_all();
+}
+
static void queue_add(struct dma_ops_domain *dma_dom,
unsigned long address, unsigned long pages)
{
@@ -2850,6 +2854,13 @@ static void amd_iommu_domain_free(struct iommu_domain *dom)
switch (dom->type) {
case IOMMU_DOMAIN_DMA:
+ /*
+ * First make sure the domain is no longer referenced from the
+ * flush queue
+ */
+ queue_flush_all();
+
+ /* Now release the domain */
dma_dom = domain->priv;
dma_ops_domain_free(dma_dom);
break;
--
1.9.1
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH 19/20] iommu/amd: Flush iova queue before releasing dma_ops_domain Joerg Roedel <joro@8bytes.org> - 2016-07-08 13:50 +0200
csiph-web