aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMark Nelson <markn@au1.ibm.com>2008-07-15 15:51:47 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2008-07-21 20:39:32 -0400
commit4f3dd8a06239c0a19d772a27c2f618dc2faadf4a (patch)
treef7185cd89a1ec2c4bdb356a52a39407e432e7f7d /arch
parent4795b7801b07e1b7286edb0d9321433fc0eac6cc (diff)
powerpc/dma: Use the struct dma_attrs in iommu code
Update iommu_alloc() to take the struct dma_attrs and pass them on to tce_build(). This change propagates down to the tce_build functions of all the platforms. Signed-off-by: Mark Nelson <markn@au1.ibm.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/kernel/iommu.c13
-rw-r--r--arch/powerpc/platforms/cell/iommu.c5
-rw-r--r--arch/powerpc/platforms/iseries/iommu.c3
-rw-r--r--arch/powerpc/platforms/pasemi/iommu.c3
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c14
-rw-r--r--arch/powerpc/sysdev/dart_iommu.c3
6 files changed, 26 insertions, 15 deletions
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index 8c68ee9e5d1c..2385f68c1751 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -186,7 +186,8 @@ static unsigned long iommu_range_alloc(struct device *dev,
186static dma_addr_t iommu_alloc(struct device *dev, struct iommu_table *tbl, 186static dma_addr_t iommu_alloc(struct device *dev, struct iommu_table *tbl,
187 void *page, unsigned int npages, 187 void *page, unsigned int npages,
188 enum dma_data_direction direction, 188 enum dma_data_direction direction,
189 unsigned long mask, unsigned int align_order) 189 unsigned long mask, unsigned int align_order,
190 struct dma_attrs *attrs)
190{ 191{
191 unsigned long entry, flags; 192 unsigned long entry, flags;
192 dma_addr_t ret = DMA_ERROR_CODE; 193 dma_addr_t ret = DMA_ERROR_CODE;
@@ -205,7 +206,7 @@ static dma_addr_t iommu_alloc(struct device *dev, struct iommu_table *tbl,
205 206
206 /* Put the TCEs in the HW table */ 207 /* Put the TCEs in the HW table */
207 ppc_md.tce_build(tbl, entry, npages, (unsigned long)page & IOMMU_PAGE_MASK, 208 ppc_md.tce_build(tbl, entry, npages, (unsigned long)page & IOMMU_PAGE_MASK,
208 direction); 209 direction, attrs);
209 210
210 211
211 /* Flush/invalidate TLB caches if necessary */ 212 /* Flush/invalidate TLB caches if necessary */
@@ -336,7 +337,8 @@ int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
336 npages, entry, dma_addr); 337 npages, entry, dma_addr);
337 338
338 /* Insert into HW table */ 339 /* Insert into HW table */
339 ppc_md.tce_build(tbl, entry, npages, vaddr & IOMMU_PAGE_MASK, direction); 340 ppc_md.tce_build(tbl, entry, npages, vaddr & IOMMU_PAGE_MASK,
341 direction, attrs);
340 342
341 /* If we are in an open segment, try merging */ 343 /* If we are in an open segment, try merging */
342 if (segstart != s) { 344 if (segstart != s) {
@@ -573,7 +575,8 @@ dma_addr_t iommu_map_single(struct device *dev, struct iommu_table *tbl,
573 align = PAGE_SHIFT - IOMMU_PAGE_SHIFT; 575 align = PAGE_SHIFT - IOMMU_PAGE_SHIFT;
574 576
575 dma_handle = iommu_alloc(dev, tbl, vaddr, npages, direction, 577 dma_handle = iommu_alloc(dev, tbl, vaddr, npages, direction,
576 mask >> IOMMU_PAGE_SHIFT, align); 578 mask >> IOMMU_PAGE_SHIFT, align,
579 attrs);
577 if (dma_handle == DMA_ERROR_CODE) { 580 if (dma_handle == DMA_ERROR_CODE) {
578 if (printk_ratelimit()) { 581 if (printk_ratelimit()) {
579 printk(KERN_INFO "iommu_alloc failed, " 582 printk(KERN_INFO "iommu_alloc failed, "
@@ -642,7 +645,7 @@ void *iommu_alloc_coherent(struct device *dev, struct iommu_table *tbl,
642 nio_pages = size >> IOMMU_PAGE_SHIFT; 645 nio_pages = size >> IOMMU_PAGE_SHIFT;
643 io_order = get_iommu_order(size); 646 io_order = get_iommu_order(size);
644 mapping = iommu_alloc(dev, tbl, ret, nio_pages, DMA_BIDIRECTIONAL, 647 mapping = iommu_alloc(dev, tbl, ret, nio_pages, DMA_BIDIRECTIONAL,
645 mask >> IOMMU_PAGE_SHIFT, io_order); 648 mask >> IOMMU_PAGE_SHIFT, io_order, NULL);
646 if (mapping == DMA_ERROR_CODE) { 649 if (mapping == DMA_ERROR_CODE) {
647 free_pages((unsigned long)ret, order); 650 free_pages((unsigned long)ret, order);
648 return NULL; 651 return NULL;
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
index eeacb3a52ca1..3b7078453e7f 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -173,7 +173,8 @@ static void invalidate_tce_cache(struct cbe_iommu *iommu, unsigned long *pte,
173} 173}
174 174
175static void tce_build_cell(struct iommu_table *tbl, long index, long npages, 175static void tce_build_cell(struct iommu_table *tbl, long index, long npages,
176 unsigned long uaddr, enum dma_data_direction direction) 176 unsigned long uaddr, enum dma_data_direction direction,
177 struct dma_attrs *attrs)
177{ 178{
178 int i; 179 int i;
179 unsigned long *io_pte, base_pte; 180 unsigned long *io_pte, base_pte;
@@ -519,7 +520,7 @@ cell_iommu_setup_window(struct cbe_iommu *iommu, struct device_node *np,
519 520
520 __set_bit(0, window->table.it_map); 521 __set_bit(0, window->table.it_map);
521 tce_build_cell(&window->table, window->table.it_offset, 1, 522 tce_build_cell(&window->table, window->table.it_offset, 1,
522 (unsigned long)iommu->pad_page, DMA_TO_DEVICE); 523 (unsigned long)iommu->pad_page, DMA_TO_DEVICE, NULL);
523 window->table.it_hint = window->table.it_blocksize; 524 window->table.it_hint = window->table.it_blocksize;
524 525
525 return window; 526 return window;
diff --git a/arch/powerpc/platforms/iseries/iommu.c b/arch/powerpc/platforms/iseries/iommu.c
index ab5d8687c3cf..bc818e4e2033 100644
--- a/arch/powerpc/platforms/iseries/iommu.c
+++ b/arch/powerpc/platforms/iseries/iommu.c
@@ -42,7 +42,8 @@
42#include <asm/iseries/iommu.h> 42#include <asm/iseries/iommu.h>
43 43
44static void tce_build_iSeries(struct iommu_table *tbl, long index, long npages, 44static void tce_build_iSeries(struct iommu_table *tbl, long index, long npages,
45 unsigned long uaddr, enum dma_data_direction direction) 45 unsigned long uaddr, enum dma_data_direction direction,
46 struct dma_attrs *attrs)
46{ 47{
47 u64 rc; 48 u64 rc;
48 u64 tce, rpn; 49 u64 tce, rpn;
diff --git a/arch/powerpc/platforms/pasemi/iommu.c b/arch/powerpc/platforms/pasemi/iommu.c
index 86967bdd8774..70541b7a5013 100644
--- a/arch/powerpc/platforms/pasemi/iommu.c
+++ b/arch/powerpc/platforms/pasemi/iommu.c
@@ -85,7 +85,8 @@ static int iommu_table_iobmap_inited;
85 85
86static void iobmap_build(struct iommu_table *tbl, long index, 86static void iobmap_build(struct iommu_table *tbl, long index,
87 long npages, unsigned long uaddr, 87 long npages, unsigned long uaddr,
88 enum dma_data_direction direction) 88 enum dma_data_direction direction,
89 struct dma_attrs *attrs)
89{ 90{
90 u32 *ip; 91 u32 *ip;
91 u32 rpn; 92 u32 rpn;
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index 9a12908510fb..5377dd4b849a 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -50,7 +50,8 @@
50 50
51static void tce_build_pSeries(struct iommu_table *tbl, long index, 51static void tce_build_pSeries(struct iommu_table *tbl, long index,
52 long npages, unsigned long uaddr, 52 long npages, unsigned long uaddr,
53 enum dma_data_direction direction) 53 enum dma_data_direction direction,
54 struct dma_attrs *attrs)
54{ 55{
55 u64 proto_tce; 56 u64 proto_tce;
56 u64 *tcep; 57 u64 *tcep;
@@ -95,7 +96,8 @@ static unsigned long tce_get_pseries(struct iommu_table *tbl, long index)
95 96
96static void tce_build_pSeriesLP(struct iommu_table *tbl, long tcenum, 97static void tce_build_pSeriesLP(struct iommu_table *tbl, long tcenum,
97 long npages, unsigned long uaddr, 98 long npages, unsigned long uaddr,
98 enum dma_data_direction direction) 99 enum dma_data_direction direction,
100 struct dma_attrs *attrs)
99{ 101{
100 u64 rc; 102 u64 rc;
101 u64 proto_tce, tce; 103 u64 proto_tce, tce;
@@ -127,7 +129,8 @@ static DEFINE_PER_CPU(u64 *, tce_page) = NULL;
127 129
128static void tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum, 130static void tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
129 long npages, unsigned long uaddr, 131 long npages, unsigned long uaddr,
130 enum dma_data_direction direction) 132 enum dma_data_direction direction,
133 struct dma_attrs *attrs)
131{ 134{
132 u64 rc; 135 u64 rc;
133 u64 proto_tce; 136 u64 proto_tce;
@@ -136,7 +139,8 @@ static void tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
136 long l, limit; 139 long l, limit;
137 140
138 if (npages == 1) { 141 if (npages == 1) {
139 tce_build_pSeriesLP(tbl, tcenum, npages, uaddr, direction); 142 tce_build_pSeriesLP(tbl, tcenum, npages, uaddr,
143 direction, attrs);
140 return; 144 return;
141 } 145 }
142 146
@@ -150,7 +154,7 @@ static void tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
150 /* If allocation fails, fall back to the loop implementation */ 154 /* If allocation fails, fall back to the loop implementation */
151 if (!tcep) { 155 if (!tcep) {
152 tce_build_pSeriesLP(tbl, tcenum, npages, uaddr, 156 tce_build_pSeriesLP(tbl, tcenum, npages, uaddr,
153 direction); 157 direction, attrs);
154 return; 158 return;
155 } 159 }
156 __get_cpu_var(tce_page) = tcep; 160 __get_cpu_var(tce_page) = tcep;
diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c
index 005c2ecf976f..de8c8b542cfa 100644
--- a/arch/powerpc/sysdev/dart_iommu.c
+++ b/arch/powerpc/sysdev/dart_iommu.c
@@ -149,7 +149,8 @@ static void dart_flush(struct iommu_table *tbl)
149 149
150static void dart_build(struct iommu_table *tbl, long index, 150static void dart_build(struct iommu_table *tbl, long index,
151 long npages, unsigned long uaddr, 151 long npages, unsigned long uaddr,
152 enum dma_data_direction direction) 152 enum dma_data_direction direction,
153 struct dma_attrs *attrs)
153{ 154{
154 unsigned int *dp; 155 unsigned int *dp;
155 unsigned int rpn; 156 unsigned int rpn;