From: Joerg Roedel <joerg.roedel@amd.com>
To: linux-kernel@vger.kernel.org
Cc: iommu@lists.linux-foundation.org, Joerg Roedel <joerg.roedel@amd.com>
Subject: [PATCH 02/23] AMD IOMMU: move TLB flushing to the map/unmap helper functions
Date: Wed, 17 Sep 2008 18:52:36 +0200 [thread overview]
Message-ID: <1221670377-19295-3-git-send-email-joerg.roedel@amd.com> (raw)
In-Reply-To: <1221670377-19295-1-git-send-email-joerg.roedel@amd.com>
This patch moves the invocation of the flushing functions to the
map/unmap helper functions because its common code in all dma_ops
relevant mapping/unmapping functions.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
arch/x86/kernel/amd_iommu.c | 19 +++++--------------
1 files changed, 5 insertions(+), 14 deletions(-)
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index 695e0fc..691e023 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -795,6 +795,9 @@ static dma_addr_t __map_single(struct device *dev,
}
address += offset;
+ if (unlikely(iommu_has_npcache(iommu)))
+ iommu_flush_pages(iommu, dma_dom->domain.id, address, size);
+
out:
return address;
}
@@ -825,6 +828,8 @@ static void __unmap_single(struct amd_iommu *iommu,
}
dma_ops_free_addresses(dma_dom, dma_addr, pages);
+
+ iommu_flush_pages(iommu, dma_dom->domain.id, dma_addr, size);
}
/*
@@ -853,9 +858,6 @@ static dma_addr_t map_single(struct device *dev, phys_addr_t paddr,
if (addr == bad_dma_address)
goto out;
- if (iommu_has_npcache(iommu))
- iommu_flush_pages(iommu, domain->id, addr, size);
-
if (iommu->need_sync)
iommu_completion_wait(iommu);
@@ -885,8 +887,6 @@ static void unmap_single(struct device *dev, dma_addr_t dma_addr,
__unmap_single(iommu, domain->priv, dma_addr, size, dir);
- iommu_flush_pages(iommu, domain->id, dma_addr, size);
-
if (iommu->need_sync)
iommu_completion_wait(iommu);
@@ -948,9 +948,6 @@ static int map_sg(struct device *dev, struct scatterlist *sglist,
mapped_elems++;
} else
goto unmap;
- if (iommu_has_npcache(iommu))
- iommu_flush_pages(iommu, domain->id, s->dma_address,
- s->dma_length);
}
if (iommu->need_sync)
@@ -996,8 +993,6 @@ static void unmap_sg(struct device *dev, struct scatterlist *sglist,
for_each_sg(sglist, s, nelems, i) {
__unmap_single(iommu, domain->priv, s->dma_address,
s->dma_length, dir);
- iommu_flush_pages(iommu, domain->id, s->dma_address,
- s->dma_length);
s->dma_address = s->dma_length = 0;
}
@@ -1048,9 +1043,6 @@ static void *alloc_coherent(struct device *dev, size_t size,
goto out;
}
- if (iommu_has_npcache(iommu))
- iommu_flush_pages(iommu, domain->id, *dma_addr, size);
-
if (iommu->need_sync)
iommu_completion_wait(iommu);
@@ -1082,7 +1074,6 @@ static void free_coherent(struct device *dev, size_t size,
spin_lock_irqsave(&domain->lock, flags);
__unmap_single(iommu, domain->priv, dma_addr, size, DMA_BIDIRECTIONAL);
- iommu_flush_pages(iommu, domain->id, dma_addr, size);
if (iommu->need_sync)
iommu_completion_wait(iommu);
--
1.5.6.4
next prev parent reply other threads:[~2008-09-17 16:53 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-17 16:52 [PATCH 0/23] AMD IOMMU 2.6.28 updates for review Joerg Roedel
2008-09-17 16:52 ` [PATCH 01/23] AMD IOMMU: check for invalid device pointers Joerg Roedel
2008-09-17 16:52 ` Joerg Roedel [this message]
2008-09-17 16:52 ` [PATCH 03/23] AMD IOMMU: implement lazy IO/TLB flushing Joerg Roedel
2008-09-17 19:20 ` FUJITA Tomonori
2008-09-17 19:28 ` Joerg Roedel
2008-09-18 1:29 ` FUJITA Tomonori
2008-09-18 10:13 ` Joerg Roedel
2008-09-18 14:03 ` Joerg Roedel
2008-09-18 23:10 ` FUJITA Tomonori
2008-09-19 6:29 ` Joerg Roedel
2008-09-19 10:21 ` FUJITA Tomonori
2008-09-19 17:43 ` Joerg Roedel
2008-09-19 18:40 ` FUJITA Tomonori
2008-09-19 19:27 ` Joerg Roedel
2008-09-19 18:47 ` Keshavamurthy, Anil S
2008-09-19 18:47 ` Keshavamurthy, Anil S
2008-09-19 18:48 ` Keshavamurthy, Anil S
2008-09-21 9:05 ` Joerg Roedel
2008-09-22 16:26 ` David Woodhouse
2008-09-21 5:27 ` Muli Ben-Yehuda
2008-09-17 16:52 ` [PATCH 04/23] AMD IOMMU: add branch hints to completion wait checks Joerg Roedel
2008-09-17 16:52 ` [PATCH 05/23] AMD IOMMU: align alloc_coherent addresses properly Joerg Roedel
2008-09-17 16:52 ` [PATCH 06/23] AMD IOMMU: add event buffer allocation Joerg Roedel
2008-09-17 16:52 ` [PATCH 07/23] AMD IOMMU: save pci segment from ACPI tables Joerg Roedel
2008-09-17 16:52 ` [PATCH 08/23] AMD IOMMU: save pci_dev instead of devid Joerg Roedel
2008-09-17 16:52 ` [PATCH 09/23] AMD IOMMU: add MSI interrupt support Joerg Roedel
2008-09-17 16:52 ` [PATCH 10/23] AMD IOMMU: add event handling code Joerg Roedel
2008-09-17 16:52 ` [PATCH 11/23] AMD IOMMU: enable event logging Joerg Roedel
2008-09-17 16:52 ` [PATCH 12/23] AMD IOMMU: allow IO page faults from devices Joerg Roedel
2008-09-17 16:52 ` [PATCH 13/23] AMD IOMMU: add dma_supported callback Joerg Roedel
2008-09-17 16:52 ` [PATCH 14/23] AMD IOMMU: don't assing preallocated protection domains to devices Joerg Roedel
2008-09-17 16:52 ` [PATCH 15/23] AMD IOMMU: some set_device_domain cleanups Joerg Roedel
2008-09-17 16:52 ` [PATCH 16/23] AMD IOMMU: avoid unnecessary low zone allocation in alloc_coherent Joerg Roedel
2008-09-17 16:52 ` [PATCH 17/23] AMD IOMMU: replace memset with __GFP_ZERO " Joerg Roedel
2008-09-17 16:52 ` [PATCH 18/23] AMD IOMMU: simplify dma_mask_to_pages Joerg Roedel
2008-09-17 19:20 ` FUJITA Tomonori
2008-09-18 7:32 ` Joerg Roedel
2008-09-18 15:57 ` FUJITA Tomonori
2008-09-18 16:39 ` Joerg Roedel
2008-09-17 16:52 ` [PATCH 19/23] AMD IOMMU: free domain bitmap with its allocation order Joerg Roedel
2008-09-17 16:52 ` [PATCH 20/23] AMD IOMMU: remove unnecessary cast to u64 in the init code Joerg Roedel
2008-09-17 16:52 ` [PATCH 21/23] AMD IOMMU: calculate IVHD size with a function Joerg Roedel
2008-09-17 16:52 ` [PATCH 22/23] AMD IOMMU: use cmd_buf_size when freeing the command buffer Joerg Roedel
2008-09-17 16:52 ` [PATCH 23/23] add AMD IOMMU tree to MAINTAINERS file Joerg Roedel
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=1221670377-19295-3-git-send-email-joerg.roedel@amd.com \
--to=joerg.roedel@amd.com \
--cc=iommu@lists.linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®