]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
powerpc/dma: Use the struct dma_attrs in iommu code
authorMark Nelson <markn@au1.ibm.com>
Tue, 15 Jul 2008 19:51:47 +0000 (05:51 +1000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Tue, 22 Jul 2008 00:39:32 +0000 (10:39 +1000)
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>
arch/powerpc/kernel/iommu.c
arch/powerpc/platforms/cell/iommu.c
arch/powerpc/platforms/iseries/iommu.c
arch/powerpc/platforms/pasemi/iommu.c
arch/powerpc/platforms/pseries/iommu.c
arch/powerpc/sysdev/dart_iommu.c
include/asm-powerpc/machdep.h

index 8c68ee9e5d1cfc23cd7d961557e7bbb8e95b733d..2385f68c1751d17774df413d44a30468cf8f5c5e 100644 (file)
@@ -186,7 +186,8 @@ static unsigned long iommu_range_alloc(struct device *dev,
 static dma_addr_t iommu_alloc(struct device *dev, struct iommu_table *tbl,
                              void *page, unsigned int npages,
                              enum dma_data_direction direction,
-                             unsigned long mask, unsigned int align_order)
+                             unsigned long mask, unsigned int align_order,
+                             struct dma_attrs *attrs)
 {
        unsigned long entry, flags;
        dma_addr_t ret = DMA_ERROR_CODE;
@@ -205,7 +206,7 @@ static dma_addr_t iommu_alloc(struct device *dev, struct iommu_table *tbl,
 
        /* Put the TCEs in the HW table */
        ppc_md.tce_build(tbl, entry, npages, (unsigned long)page & IOMMU_PAGE_MASK,
-                        direction);
+                        direction, attrs);
 
 
        /* Flush/invalidate TLB caches if necessary */
@@ -336,7 +337,8 @@ int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
                            npages, entry, dma_addr);
 
                /* Insert into HW table */
-               ppc_md.tce_build(tbl, entry, npages, vaddr & IOMMU_PAGE_MASK, direction);
+               ppc_md.tce_build(tbl, entry, npages, vaddr & IOMMU_PAGE_MASK,
+                                direction, attrs);
 
                /* If we are in an open segment, try merging */
                if (segstart != s) {
@@ -573,7 +575,8 @@ dma_addr_t iommu_map_single(struct device *dev, struct iommu_table *tbl,
                        align = PAGE_SHIFT - IOMMU_PAGE_SHIFT;
 
                dma_handle = iommu_alloc(dev, tbl, vaddr, npages, direction,
-                                        mask >> IOMMU_PAGE_SHIFT, align);
+                                        mask >> IOMMU_PAGE_SHIFT, align,
+                                        attrs);
                if (dma_handle == DMA_ERROR_CODE) {
                        if (printk_ratelimit())  {
                                printk(KERN_INFO "iommu_alloc failed, "
@@ -642,7 +645,7 @@ void *iommu_alloc_coherent(struct device *dev, struct iommu_table *tbl,
        nio_pages = size >> IOMMU_PAGE_SHIFT;
        io_order = get_iommu_order(size);
        mapping = iommu_alloc(dev, tbl, ret, nio_pages, DMA_BIDIRECTIONAL,
-                             mask >> IOMMU_PAGE_SHIFT, io_order);
+                             mask >> IOMMU_PAGE_SHIFT, io_order, NULL);
        if (mapping == DMA_ERROR_CODE) {
                free_pages((unsigned long)ret, order);
                return NULL;
index eeacb3a52ca13c55edac28556e5ba4e8bd61c332..3b7078453e7fbf9a8e2b4e5e3e3badbcc2655031 100644 (file)
@@ -173,7 +173,8 @@ static void invalidate_tce_cache(struct cbe_iommu *iommu, unsigned long *pte,
 }
 
 static void tce_build_cell(struct iommu_table *tbl, long index, long npages,
-               unsigned long uaddr, enum dma_data_direction direction)
+               unsigned long uaddr, enum dma_data_direction direction,
+               struct dma_attrs *attrs)
 {
        int i;
        unsigned long *io_pte, base_pte;
@@ -519,7 +520,7 @@ cell_iommu_setup_window(struct cbe_iommu *iommu, struct device_node *np,
 
        __set_bit(0, window->table.it_map);
        tce_build_cell(&window->table, window->table.it_offset, 1,
-                      (unsigned long)iommu->pad_page, DMA_TO_DEVICE);
+                      (unsigned long)iommu->pad_page, DMA_TO_DEVICE, NULL);
        window->table.it_hint = window->table.it_blocksize;
 
        return window;
index ab5d8687c3cfbf250058972d1f373d4c5bc3b410..bc818e4e203321b50557361ae2f5c4f2717cd4dc 100644 (file)
@@ -42,7 +42,8 @@
 #include <asm/iseries/iommu.h>
 
 static void tce_build_iSeries(struct iommu_table *tbl, long index, long npages,
-               unsigned long uaddr, enum dma_data_direction direction)
+               unsigned long uaddr, enum dma_data_direction direction,
+               struct dma_attrs *attrs)
 {
        u64 rc;
        u64 tce, rpn;
index 86967bdd8774db20ae04d13fb7f4b65c80482192..70541b7a5013ab68faed9758d86487be360bbe8c 100644 (file)
@@ -85,7 +85,8 @@ static int iommu_table_iobmap_inited;
 
 static void iobmap_build(struct iommu_table *tbl, long index,
                         long npages, unsigned long uaddr,
-                        enum dma_data_direction direction)
+                        enum dma_data_direction direction,
+                        struct dma_attrs *attrs)
 {
        u32 *ip;
        u32 rpn;
index 9a12908510fbaaefbb92ab2e73489b9b49f86376..5377dd4b849a5bc8fced028eae7bd2b59c758207 100644 (file)
@@ -50,7 +50,8 @@
 
 static void tce_build_pSeries(struct iommu_table *tbl, long index,
                              long npages, unsigned long uaddr,
-                             enum dma_data_direction direction)
+                             enum dma_data_direction direction,
+                             struct dma_attrs *attrs)
 {
        u64 proto_tce;
        u64 *tcep;
@@ -95,7 +96,8 @@ static unsigned long tce_get_pseries(struct iommu_table *tbl, long index)
 
 static void tce_build_pSeriesLP(struct iommu_table *tbl, long tcenum,
                                long npages, unsigned long uaddr,
-                               enum dma_data_direction direction)
+                               enum dma_data_direction direction,
+                               struct dma_attrs *attrs)
 {
        u64 rc;
        u64 proto_tce, tce;
@@ -127,7 +129,8 @@ static DEFINE_PER_CPU(u64 *, tce_page) = NULL;
 
 static void tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
                                     long npages, unsigned long uaddr,
-                                    enum dma_data_direction direction)
+                                    enum dma_data_direction direction,
+                                    struct dma_attrs *attrs)
 {
        u64 rc;
        u64 proto_tce;
@@ -136,7 +139,8 @@ static void tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
        long l, limit;
 
        if (npages == 1) {
-               tce_build_pSeriesLP(tbl, tcenum, npages, uaddr, direction);
+               tce_build_pSeriesLP(tbl, tcenum, npages, uaddr,
+                                   direction, attrs);
                return;
        }
 
@@ -150,7 +154,7 @@ static void tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
                /* If allocation fails, fall back to the loop implementation */
                if (!tcep) {
                        tce_build_pSeriesLP(tbl, tcenum, npages, uaddr,
-                                           direction);
+                                           direction, attrs);
                        return;
                }
                __get_cpu_var(tce_page) = tcep;
index 005c2ecf976fe810f2f02ddee3f78200d8d3f010..de8c8b542cfa157d76281163e7ca21dfe1071b36 100644 (file)
@@ -149,7 +149,8 @@ static void dart_flush(struct iommu_table *tbl)
 
 static void dart_build(struct iommu_table *tbl, long index,
                       long npages, unsigned long uaddr,
-                      enum dma_data_direction direction)
+                      enum dma_data_direction direction,
+                      struct dma_attrs *attrs)
 {
        unsigned int *dp;
        unsigned int rpn;
index 989922621e353fdfea01149dbf6c075967261510..1233d735fd289a5831e7d6a542a0912b9cffcf32 100644 (file)
@@ -80,7 +80,8 @@ struct machdep_calls {
                                     long index,
                                     long npages,
                                     unsigned long uaddr,
-                                    enum dma_data_direction direction);
+                                    enum dma_data_direction direction,
+                                    struct dma_attrs *attrs);
        void            (*tce_free)(struct iommu_table *tbl,
                                    long index,
                                    long npages);