diff options
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/Kconfig | 1 | ||||
-rw-r--r-- | arch/powerpc/kernel/dma_64.c | 34 | ||||
-rw-r--r-- | arch/powerpc/kernel/ibmebus.c | 12 | ||||
-rw-r--r-- | arch/powerpc/kernel/iommu.c | 11 | ||||
-rw-r--r-- | arch/powerpc/platforms/iseries/iommu.c | 4 | ||||
-rw-r--r-- | arch/powerpc/platforms/ps3/system-bus.c | 17 |
6 files changed, 50 insertions, 29 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index f2a0f50146e1..462c86a4eefb 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -110,6 +110,7 @@ config PPC | |||
110 | select HAVE_KPROBES | 110 | select HAVE_KPROBES |
111 | select HAVE_KRETPROBES | 111 | select HAVE_KRETPROBES |
112 | select HAVE_LMB | 112 | select HAVE_LMB |
113 | select HAVE_DMA_ATTRS | ||
113 | 114 | ||
114 | config EARLY_PRINTK | 115 | config EARLY_PRINTK |
115 | bool | 116 | bool |
diff --git a/arch/powerpc/kernel/dma_64.c b/arch/powerpc/kernel/dma_64.c index 739744508c6e..3ae0c35d21f9 100644 --- a/arch/powerpc/kernel/dma_64.c +++ b/arch/powerpc/kernel/dma_64.c | |||
@@ -50,32 +50,38 @@ static void dma_iommu_free_coherent(struct device *dev, size_t size, | |||
50 | */ | 50 | */ |
51 | static dma_addr_t dma_iommu_map_single(struct device *dev, void *vaddr, | 51 | static dma_addr_t dma_iommu_map_single(struct device *dev, void *vaddr, |
52 | size_t size, | 52 | size_t size, |
53 | enum dma_data_direction direction) | 53 | enum dma_data_direction direction, |
54 | struct dma_attrs *attrs) | ||
54 | { | 55 | { |
55 | return iommu_map_single(dev, dev->archdata.dma_data, vaddr, size, | 56 | return iommu_map_single(dev, dev->archdata.dma_data, vaddr, size, |
56 | device_to_mask(dev), direction); | 57 | device_to_mask(dev), direction, attrs); |
57 | } | 58 | } |
58 | 59 | ||
59 | 60 | ||
60 | static void dma_iommu_unmap_single(struct device *dev, dma_addr_t dma_handle, | 61 | static void dma_iommu_unmap_single(struct device *dev, dma_addr_t dma_handle, |
61 | size_t size, | 62 | size_t size, |
62 | enum dma_data_direction direction) | 63 | enum dma_data_direction direction, |
64 | struct dma_attrs *attrs) | ||
63 | { | 65 | { |
64 | iommu_unmap_single(dev->archdata.dma_data, dma_handle, size, direction); | 66 | iommu_unmap_single(dev->archdata.dma_data, dma_handle, size, direction, |
67 | attrs); | ||
65 | } | 68 | } |
66 | 69 | ||
67 | 70 | ||
68 | static int dma_iommu_map_sg(struct device *dev, struct scatterlist *sglist, | 71 | static int dma_iommu_map_sg(struct device *dev, struct scatterlist *sglist, |
69 | int nelems, enum dma_data_direction direction) | 72 | int nelems, enum dma_data_direction direction, |
73 | struct dma_attrs *attrs) | ||
70 | { | 74 | { |
71 | return iommu_map_sg(dev, dev->archdata.dma_data, sglist, nelems, | 75 | return iommu_map_sg(dev, dev->archdata.dma_data, sglist, nelems, |
72 | device_to_mask(dev), direction); | 76 | device_to_mask(dev), direction, attrs); |
73 | } | 77 | } |
74 | 78 | ||
75 | static void dma_iommu_unmap_sg(struct device *dev, struct scatterlist *sglist, | 79 | static void dma_iommu_unmap_sg(struct device *dev, struct scatterlist *sglist, |
76 | int nelems, enum dma_data_direction direction) | 80 | int nelems, enum dma_data_direction direction, |
81 | struct dma_attrs *attrs) | ||
77 | { | 82 | { |
78 | iommu_unmap_sg(dev->archdata.dma_data, sglist, nelems, direction); | 83 | iommu_unmap_sg(dev->archdata.dma_data, sglist, nelems, direction, |
84 | attrs); | ||
79 | } | 85 | } |
80 | 86 | ||
81 | /* We support DMA to/from any memory page via the iommu */ | 87 | /* We support DMA to/from any memory page via the iommu */ |
@@ -148,19 +154,22 @@ static void dma_direct_free_coherent(struct device *dev, size_t size, | |||
148 | 154 | ||
149 | static dma_addr_t dma_direct_map_single(struct device *dev, void *ptr, | 155 | static dma_addr_t dma_direct_map_single(struct device *dev, void *ptr, |
150 | size_t size, | 156 | size_t size, |
151 | enum dma_data_direction direction) | 157 | enum dma_data_direction direction, |
158 | struct dma_attrs *attrs) | ||
152 | { | 159 | { |
153 | return virt_to_abs(ptr) + get_dma_direct_offset(dev); | 160 | return virt_to_abs(ptr) + get_dma_direct_offset(dev); |
154 | } | 161 | } |
155 | 162 | ||
156 | static void dma_direct_unmap_single(struct device *dev, dma_addr_t dma_addr, | 163 | static void dma_direct_unmap_single(struct device *dev, dma_addr_t dma_addr, |
157 | size_t size, | 164 | size_t size, |
158 | enum dma_data_direction direction) | 165 | enum dma_data_direction direction, |
166 | struct dma_attrs *attrs) | ||
159 | { | 167 | { |
160 | } | 168 | } |
161 | 169 | ||
162 | static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, | 170 | static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, |
163 | int nents, enum dma_data_direction direction) | 171 | int nents, enum dma_data_direction direction, |
172 | struct dma_attrs *attrs) | ||
164 | { | 173 | { |
165 | struct scatterlist *sg; | 174 | struct scatterlist *sg; |
166 | int i; | 175 | int i; |
@@ -174,7 +183,8 @@ static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, | |||
174 | } | 183 | } |
175 | 184 | ||
176 | static void dma_direct_unmap_sg(struct device *dev, struct scatterlist *sg, | 185 | static void dma_direct_unmap_sg(struct device *dev, struct scatterlist *sg, |
177 | int nents, enum dma_data_direction direction) | 186 | int nents, enum dma_data_direction direction, |
187 | struct dma_attrs *attrs) | ||
178 | { | 188 | { |
179 | } | 189 | } |
180 | 190 | ||
diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c index 9971159c8040..e3b1fcd6d991 100644 --- a/arch/powerpc/kernel/ibmebus.c +++ b/arch/powerpc/kernel/ibmebus.c | |||
@@ -82,7 +82,8 @@ static void ibmebus_free_coherent(struct device *dev, | |||
82 | static dma_addr_t ibmebus_map_single(struct device *dev, | 82 | static dma_addr_t ibmebus_map_single(struct device *dev, |
83 | void *ptr, | 83 | void *ptr, |
84 | size_t size, | 84 | size_t size, |
85 | enum dma_data_direction direction) | 85 | enum dma_data_direction direction, |
86 | struct dma_attrs *attrs) | ||
86 | { | 87 | { |
87 | return (dma_addr_t)(ptr); | 88 | return (dma_addr_t)(ptr); |
88 | } | 89 | } |
@@ -90,14 +91,16 @@ static dma_addr_t ibmebus_map_single(struct device *dev, | |||
90 | static void ibmebus_unmap_single(struct device *dev, | 91 | static void ibmebus_unmap_single(struct device *dev, |
91 | dma_addr_t dma_addr, | 92 | dma_addr_t dma_addr, |
92 | size_t size, | 93 | size_t size, |
93 | enum dma_data_direction direction) | 94 | enum dma_data_direction direction, |
95 | struct dma_attrs *attrs) | ||
94 | { | 96 | { |
95 | return; | 97 | return; |
96 | } | 98 | } |
97 | 99 | ||
98 | static int ibmebus_map_sg(struct device *dev, | 100 | static int ibmebus_map_sg(struct device *dev, |
99 | struct scatterlist *sgl, | 101 | struct scatterlist *sgl, |
100 | int nents, enum dma_data_direction direction) | 102 | int nents, enum dma_data_direction direction, |
103 | struct dma_attrs *attrs) | ||
101 | { | 104 | { |
102 | struct scatterlist *sg; | 105 | struct scatterlist *sg; |
103 | int i; | 106 | int i; |
@@ -112,7 +115,8 @@ static int ibmebus_map_sg(struct device *dev, | |||
112 | 115 | ||
113 | static void ibmebus_unmap_sg(struct device *dev, | 116 | static void ibmebus_unmap_sg(struct device *dev, |
114 | struct scatterlist *sg, | 117 | struct scatterlist *sg, |
115 | int nents, enum dma_data_direction direction) | 118 | int nents, enum dma_data_direction direction, |
119 | struct dma_attrs *attrs) | ||
116 | { | 120 | { |
117 | return; | 121 | return; |
118 | } | 122 | } |
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c index ccf00fe9cee6..8c68ee9e5d1c 100644 --- a/arch/powerpc/kernel/iommu.c +++ b/arch/powerpc/kernel/iommu.c | |||
@@ -269,7 +269,8 @@ static void iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr, | |||
269 | 269 | ||
270 | int iommu_map_sg(struct device *dev, struct iommu_table *tbl, | 270 | int iommu_map_sg(struct device *dev, struct iommu_table *tbl, |
271 | struct scatterlist *sglist, int nelems, | 271 | struct scatterlist *sglist, int nelems, |
272 | unsigned long mask, enum dma_data_direction direction) | 272 | unsigned long mask, enum dma_data_direction direction, |
273 | struct dma_attrs *attrs) | ||
273 | { | 274 | { |
274 | dma_addr_t dma_next = 0, dma_addr; | 275 | dma_addr_t dma_next = 0, dma_addr; |
275 | unsigned long flags; | 276 | unsigned long flags; |
@@ -411,7 +412,8 @@ int iommu_map_sg(struct device *dev, struct iommu_table *tbl, | |||
411 | 412 | ||
412 | 413 | ||
413 | void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist, | 414 | void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist, |
414 | int nelems, enum dma_data_direction direction) | 415 | int nelems, enum dma_data_direction direction, |
416 | struct dma_attrs *attrs) | ||
415 | { | 417 | { |
416 | struct scatterlist *sg; | 418 | struct scatterlist *sg; |
417 | unsigned long flags; | 419 | unsigned long flags; |
@@ -553,7 +555,7 @@ void iommu_free_table(struct iommu_table *tbl, const char *node_name) | |||
553 | */ | 555 | */ |
554 | dma_addr_t iommu_map_single(struct device *dev, struct iommu_table *tbl, | 556 | dma_addr_t iommu_map_single(struct device *dev, struct iommu_table *tbl, |
555 | void *vaddr, size_t size, unsigned long mask, | 557 | void *vaddr, size_t size, unsigned long mask, |
556 | enum dma_data_direction direction) | 558 | enum dma_data_direction direction, struct dma_attrs *attrs) |
557 | { | 559 | { |
558 | dma_addr_t dma_handle = DMA_ERROR_CODE; | 560 | dma_addr_t dma_handle = DMA_ERROR_CODE; |
559 | unsigned long uaddr; | 561 | unsigned long uaddr; |
@@ -586,7 +588,8 @@ dma_addr_t iommu_map_single(struct device *dev, struct iommu_table *tbl, | |||
586 | } | 588 | } |
587 | 589 | ||
588 | void iommu_unmap_single(struct iommu_table *tbl, dma_addr_t dma_handle, | 590 | void iommu_unmap_single(struct iommu_table *tbl, dma_addr_t dma_handle, |
589 | size_t size, enum dma_data_direction direction) | 591 | size_t size, enum dma_data_direction direction, |
592 | struct dma_attrs *attrs) | ||
590 | { | 593 | { |
591 | unsigned int npages; | 594 | unsigned int npages; |
592 | 595 | ||
diff --git a/arch/powerpc/platforms/iseries/iommu.c b/arch/powerpc/platforms/iseries/iommu.c index 11fa3c772ed5..ab5d8687c3cf 100644 --- a/arch/powerpc/platforms/iseries/iommu.c +++ b/arch/powerpc/platforms/iseries/iommu.c | |||
@@ -214,13 +214,13 @@ dma_addr_t iseries_hv_map(void *vaddr, size_t size, | |||
214 | enum dma_data_direction direction) | 214 | enum dma_data_direction direction) |
215 | { | 215 | { |
216 | return iommu_map_single(NULL, &vio_iommu_table, vaddr, size, | 216 | return iommu_map_single(NULL, &vio_iommu_table, vaddr, size, |
217 | DMA_32BIT_MASK, direction); | 217 | DMA_32BIT_MASK, direction, NULL); |
218 | } | 218 | } |
219 | 219 | ||
220 | void iseries_hv_unmap(dma_addr_t dma_handle, size_t size, | 220 | void iseries_hv_unmap(dma_addr_t dma_handle, size_t size, |
221 | enum dma_data_direction direction) | 221 | enum dma_data_direction direction) |
222 | { | 222 | { |
223 | iommu_unmap_single(&vio_iommu_table, dma_handle, size, direction); | 223 | iommu_unmap_single(&vio_iommu_table, dma_handle, size, direction, NULL); |
224 | } | 224 | } |
225 | 225 | ||
226 | void __init iommu_vio_init(void) | 226 | void __init iommu_vio_init(void) |
diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c index cf215e981c3e..d66c3628a112 100644 --- a/arch/powerpc/platforms/ps3/system-bus.c +++ b/arch/powerpc/platforms/ps3/system-bus.c | |||
@@ -555,7 +555,7 @@ static void ps3_free_coherent(struct device *_dev, size_t size, void *vaddr, | |||
555 | */ | 555 | */ |
556 | 556 | ||
557 | static dma_addr_t ps3_sb_map_single(struct device *_dev, void *ptr, size_t size, | 557 | static dma_addr_t ps3_sb_map_single(struct device *_dev, void *ptr, size_t size, |
558 | enum dma_data_direction direction) | 558 | enum dma_data_direction direction, struct dma_attrs *attrs) |
559 | { | 559 | { |
560 | struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); | 560 | struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); |
561 | int result; | 561 | int result; |
@@ -575,7 +575,8 @@ static dma_addr_t ps3_sb_map_single(struct device *_dev, void *ptr, size_t size, | |||
575 | 575 | ||
576 | static dma_addr_t ps3_ioc0_map_single(struct device *_dev, void *ptr, | 576 | static dma_addr_t ps3_ioc0_map_single(struct device *_dev, void *ptr, |
577 | size_t size, | 577 | size_t size, |
578 | enum dma_data_direction direction) | 578 | enum dma_data_direction direction, |
579 | struct dma_attrs *attrs) | ||
579 | { | 580 | { |
580 | struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); | 581 | struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); |
581 | int result; | 582 | int result; |
@@ -608,7 +609,7 @@ static dma_addr_t ps3_ioc0_map_single(struct device *_dev, void *ptr, | |||
608 | } | 609 | } |
609 | 610 | ||
610 | static void ps3_unmap_single(struct device *_dev, dma_addr_t dma_addr, | 611 | static void ps3_unmap_single(struct device *_dev, dma_addr_t dma_addr, |
611 | size_t size, enum dma_data_direction direction) | 612 | size_t size, enum dma_data_direction direction, struct dma_attrs *attrs) |
612 | { | 613 | { |
613 | struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); | 614 | struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); |
614 | int result; | 615 | int result; |
@@ -622,7 +623,7 @@ static void ps3_unmap_single(struct device *_dev, dma_addr_t dma_addr, | |||
622 | } | 623 | } |
623 | 624 | ||
624 | static int ps3_sb_map_sg(struct device *_dev, struct scatterlist *sgl, | 625 | static int ps3_sb_map_sg(struct device *_dev, struct scatterlist *sgl, |
625 | int nents, enum dma_data_direction direction) | 626 | int nents, enum dma_data_direction direction, struct dma_attrs *attrs) |
626 | { | 627 | { |
627 | #if defined(CONFIG_PS3_DYNAMIC_DMA) | 628 | #if defined(CONFIG_PS3_DYNAMIC_DMA) |
628 | BUG_ON("do"); | 629 | BUG_ON("do"); |
@@ -651,14 +652,15 @@ static int ps3_sb_map_sg(struct device *_dev, struct scatterlist *sgl, | |||
651 | 652 | ||
652 | static int ps3_ioc0_map_sg(struct device *_dev, struct scatterlist *sg, | 653 | static int ps3_ioc0_map_sg(struct device *_dev, struct scatterlist *sg, |
653 | int nents, | 654 | int nents, |
654 | enum dma_data_direction direction) | 655 | enum dma_data_direction direction, |
656 | struct dma_attrs *attrs) | ||
655 | { | 657 | { |
656 | BUG(); | 658 | BUG(); |
657 | return 0; | 659 | return 0; |
658 | } | 660 | } |
659 | 661 | ||
660 | static void ps3_sb_unmap_sg(struct device *_dev, struct scatterlist *sg, | 662 | static void ps3_sb_unmap_sg(struct device *_dev, struct scatterlist *sg, |
661 | int nents, enum dma_data_direction direction) | 663 | int nents, enum dma_data_direction direction, struct dma_attrs *attrs) |
662 | { | 664 | { |
663 | #if defined(CONFIG_PS3_DYNAMIC_DMA) | 665 | #if defined(CONFIG_PS3_DYNAMIC_DMA) |
664 | BUG_ON("do"); | 666 | BUG_ON("do"); |
@@ -666,7 +668,8 @@ static void ps3_sb_unmap_sg(struct device *_dev, struct scatterlist *sg, | |||
666 | } | 668 | } |
667 | 669 | ||
668 | static void ps3_ioc0_unmap_sg(struct device *_dev, struct scatterlist *sg, | 670 | static void ps3_ioc0_unmap_sg(struct device *_dev, struct scatterlist *sg, |
669 | int nents, enum dma_data_direction direction) | 671 | int nents, enum dma_data_direction direction, |
672 | struct dma_attrs *attrs) | ||
670 | { | 673 | { |
671 | BUG(); | 674 | BUG(); |
672 | } | 675 | } |