aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64/kernel/iommu_common.h
diff options
context:
space:
mode:
authorDavid S. Miller <davem@huronp11.davemloft.net>2008-02-06 06:50:26 -0500
committerDavid S. Miller <davem@davemloft.net>2008-02-06 07:12:25 -0500
commit38192d52f159bc06b7f523800c10b583cdd661d5 (patch)
tree4cf695d583c0a657133642c0299cbfa536e25663 /arch/sparc64/kernel/iommu_common.h
parentb3ff81dd8ae29ec431f6cc91aff601a51ef6fb8c (diff)
[SPARC64]: Temporarily remove IOMMU merging code.
Changeset fde6a3c82d67f592eb587be4d12222b0ae6d4321 ("iommu sg merging: sparc64: make iommu respect the segment size limits") broke sparc64 because whilst it added the segment limiting code to the first pass of SG mapping (in prepare_sg()) it did not add matching code to the second pass handling (in fill_sg()) As a result the two passes disagree where the segment boundaries should be, resulting in OOPSes, DMA corruption, and corrupted superblocks. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/kernel/iommu_common.h')
-rw-r--r--arch/sparc64/kernel/iommu_common.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/arch/sparc64/kernel/iommu_common.h b/arch/sparc64/kernel/iommu_common.h
index a90d046e8024..4b5cafa2877a 100644
--- a/arch/sparc64/kernel/iommu_common.h
+++ b/arch/sparc64/kernel/iommu_common.h
@@ -30,6 +30,32 @@
30 */ 30 */
31#define IOMMU_PAGE_SHIFT 13 31#define IOMMU_PAGE_SHIFT 13
32 32
33#define SG_ENT_PHYS_ADDRESS(SG) (__pa(sg_virt((SG))))
34
35static inline unsigned long iommu_num_pages(unsigned long vaddr,
36 unsigned long slen)
37{
38 unsigned long npages;
39
40 npages = IO_PAGE_ALIGN(vaddr + slen) - (vaddr & IO_PAGE_MASK);
41 npages >>= IO_PAGE_SHIFT;
42
43 return npages;
44}
45
46static inline unsigned long calc_npages(struct scatterlist *sglist, int nelems)
47{
48 unsigned long i, npages = 0;
49 struct scatterlist *sg;
50
51 for_each_sg(sglist, sg, nelems, i) {
52 unsigned long paddr = SG_ENT_PHYS_ADDRESS(sg);
53 npages += iommu_num_pages(paddr, sg->length);
54 }
55
56 return npages;
57}
58
33/* You are _strongly_ advised to enable the following debugging code 59/* You are _strongly_ advised to enable the following debugging code
34 * any time you make changes to the sg code below, run it for a while 60 * any time you make changes to the sg code below, run it for a while
35 * with filesystems mounted read-only before buying the farm... -DaveM 61 * with filesystems mounted read-only before buying the farm... -DaveM