diff options
-rw-r--r-- | arch/ia64/hp/common/sba_iommu.c | 11 | ||||
-rw-r--r-- | arch/ia64/include/asm/dma-mapping.h | 18 | ||||
-rw-r--r-- | arch/ia64/kernel/pci-swiotlb.c | 14 | ||||
-rw-r--r-- | arch/ia64/sn/pci/pci_dma.c | 9 | ||||
-rw-r--r-- | arch/x86/include/asm/dma-mapping.h | 26 | ||||
-rw-r--r-- | arch/x86/kernel/amd_gart_64.c | 11 | ||||
-rw-r--r-- | arch/x86/kernel/pci-calgary_64.c | 9 | ||||
-rw-r--r-- | arch/x86/kernel/pci-dma.c | 3 | ||||
-rw-r--r-- | arch/x86/kernel/pci-nommu.c | 6 | ||||
-rw-r--r-- | arch/x86/kernel/pci-swiotlb.c | 17 | ||||
-rw-r--r-- | arch/x86/xen/pci-swiotlb-xen.c | 4 | ||||
-rw-r--r-- | drivers/iommu/amd_iommu.c | 10 | ||||
-rw-r--r-- | drivers/iommu/intel-iommu.c | 9 | ||||
-rw-r--r-- | drivers/xen/swiotlb-xen.c | 5 | ||||
-rw-r--r-- | include/xen/swiotlb-xen.h | 6 |
15 files changed, 99 insertions, 59 deletions
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c index f5f4ef149aac..e5eb9c4b2198 100644 --- a/arch/ia64/hp/common/sba_iommu.c +++ b/arch/ia64/hp/common/sba_iommu.c | |||
@@ -1130,7 +1130,8 @@ void sba_unmap_single_attrs(struct device *dev, dma_addr_t iova, size_t size, | |||
1130 | * See Documentation/DMA-API-HOWTO.txt | 1130 | * See Documentation/DMA-API-HOWTO.txt |
1131 | */ | 1131 | */ |
1132 | static void * | 1132 | static void * |
1133 | sba_alloc_coherent (struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flags) | 1133 | sba_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, |
1134 | gfp_t flags, struct dma_attrs *attrs) | ||
1134 | { | 1135 | { |
1135 | struct ioc *ioc; | 1136 | struct ioc *ioc; |
1136 | void *addr; | 1137 | void *addr; |
@@ -1192,8 +1193,8 @@ sba_alloc_coherent (struct device *dev, size_t size, dma_addr_t *dma_handle, gfp | |||
1192 | * | 1193 | * |
1193 | * See Documentation/DMA-API-HOWTO.txt | 1194 | * See Documentation/DMA-API-HOWTO.txt |
1194 | */ | 1195 | */ |
1195 | static void sba_free_coherent (struct device *dev, size_t size, void *vaddr, | 1196 | static void sba_free_coherent(struct device *dev, size_t size, void *vaddr, |
1196 | dma_addr_t dma_handle) | 1197 | dma_addr_t dma_handle, struct dma_attrs *attrs) |
1197 | { | 1198 | { |
1198 | sba_unmap_single_attrs(dev, dma_handle, size, 0, NULL); | 1199 | sba_unmap_single_attrs(dev, dma_handle, size, 0, NULL); |
1199 | free_pages((unsigned long) vaddr, get_order(size)); | 1200 | free_pages((unsigned long) vaddr, get_order(size)); |
@@ -2213,8 +2214,8 @@ sba_page_override(char *str) | |||
2213 | __setup("sbapagesize=",sba_page_override); | 2214 | __setup("sbapagesize=",sba_page_override); |
2214 | 2215 | ||
2215 | struct dma_map_ops sba_dma_ops = { | 2216 | struct dma_map_ops sba_dma_ops = { |
2216 | .alloc_coherent = sba_alloc_coherent, | 2217 | .alloc = sba_alloc_coherent, |
2217 | .free_coherent = sba_free_coherent, | 2218 | .free = sba_free_coherent, |
2218 | .map_page = sba_map_page, | 2219 | .map_page = sba_map_page, |
2219 | .unmap_page = sba_unmap_page, | 2220 | .unmap_page = sba_unmap_page, |
2220 | .map_sg = sba_map_sg_attrs, | 2221 | .map_sg = sba_map_sg_attrs, |
diff --git a/arch/ia64/include/asm/dma-mapping.h b/arch/ia64/include/asm/dma-mapping.h index 4336d080b241..4f5e8148440d 100644 --- a/arch/ia64/include/asm/dma-mapping.h +++ b/arch/ia64/include/asm/dma-mapping.h | |||
@@ -23,23 +23,29 @@ extern void machvec_dma_sync_single(struct device *, dma_addr_t, size_t, | |||
23 | extern void machvec_dma_sync_sg(struct device *, struct scatterlist *, int, | 23 | extern void machvec_dma_sync_sg(struct device *, struct scatterlist *, int, |
24 | enum dma_data_direction); | 24 | enum dma_data_direction); |
25 | 25 | ||
26 | static inline void *dma_alloc_coherent(struct device *dev, size_t size, | 26 | #define dma_alloc_coherent(d,s,h,f) dma_alloc_attrs(d,s,h,f,NULL) |
27 | dma_addr_t *daddr, gfp_t gfp) | 27 | |
28 | static inline void *dma_alloc_attrs(struct device *dev, size_t size, | ||
29 | dma_addr_t *daddr, gfp_t gfp, | ||
30 | struct dma_attrs *attrs) | ||
28 | { | 31 | { |
29 | struct dma_map_ops *ops = platform_dma_get_ops(dev); | 32 | struct dma_map_ops *ops = platform_dma_get_ops(dev); |
30 | void *caddr; | 33 | void *caddr; |
31 | 34 | ||
32 | caddr = ops->alloc_coherent(dev, size, daddr, gfp); | 35 | caddr = ops->alloc(dev, size, daddr, gfp, attrs); |
33 | debug_dma_alloc_coherent(dev, size, *daddr, caddr); | 36 | debug_dma_alloc_coherent(dev, size, *daddr, caddr); |
34 | return caddr; | 37 | return caddr; |
35 | } | 38 | } |
36 | 39 | ||
37 | static inline void dma_free_coherent(struct device *dev, size_t size, | 40 | #define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL) |
38 | void *caddr, dma_addr_t daddr) | 41 | |
42 | static inline void dma_free_attrs(struct device *dev, size_t size, | ||
43 | void *caddr, dma_addr_t daddr, | ||
44 | struct dma_attrs *attrs) | ||
39 | { | 45 | { |
40 | struct dma_map_ops *ops = platform_dma_get_ops(dev); | 46 | struct dma_map_ops *ops = platform_dma_get_ops(dev); |
41 | debug_dma_free_coherent(dev, size, caddr, daddr); | 47 | debug_dma_free_coherent(dev, size, caddr, daddr); |
42 | ops->free_coherent(dev, size, caddr, daddr); | 48 | ops->free(dev, size, caddr, daddr, attrs); |
43 | } | 49 | } |
44 | 50 | ||
45 | #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) | 51 | #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) |
diff --git a/arch/ia64/kernel/pci-swiotlb.c b/arch/ia64/kernel/pci-swiotlb.c index d9485d952ed0..939260aeac98 100644 --- a/arch/ia64/kernel/pci-swiotlb.c +++ b/arch/ia64/kernel/pci-swiotlb.c | |||
@@ -15,16 +15,24 @@ int swiotlb __read_mostly; | |||
15 | EXPORT_SYMBOL(swiotlb); | 15 | EXPORT_SYMBOL(swiotlb); |
16 | 16 | ||
17 | static void *ia64_swiotlb_alloc_coherent(struct device *dev, size_t size, | 17 | static void *ia64_swiotlb_alloc_coherent(struct device *dev, size_t size, |
18 | dma_addr_t *dma_handle, gfp_t gfp) | 18 | dma_addr_t *dma_handle, gfp_t gfp, |
19 | struct dma_attrs *attrs) | ||
19 | { | 20 | { |
20 | if (dev->coherent_dma_mask != DMA_BIT_MASK(64)) | 21 | if (dev->coherent_dma_mask != DMA_BIT_MASK(64)) |
21 | gfp |= GFP_DMA; | 22 | gfp |= GFP_DMA; |
22 | return swiotlb_alloc_coherent(dev, size, dma_handle, gfp); | 23 | return swiotlb_alloc_coherent(dev, size, dma_handle, gfp); |
23 | } | 24 | } |
24 | 25 | ||
26 | static void ia64_swiotlb_free_coherent(struct device *dev, size_t size, | ||
27 | void *vaddr, dma_addr_t dma_addr, | ||
28 | struct dma_attrs *attrs) | ||
29 | { | ||
30 | swiotlb_free_coherent(dev, size, vaddr, dma_addr); | ||
31 | } | ||
32 | |||
25 | struct dma_map_ops swiotlb_dma_ops = { | 33 | struct dma_map_ops swiotlb_dma_ops = { |
26 | .alloc_coherent = ia64_swiotlb_alloc_coherent, | 34 | .alloc = ia64_swiotlb_alloc_coherent, |
27 | .free_coherent = swiotlb_free_coherent, | 35 | .free = ia64_swiotlb_free_coherent, |
28 | .map_page = swiotlb_map_page, | 36 | .map_page = swiotlb_map_page, |
29 | .unmap_page = swiotlb_unmap_page, | 37 | .unmap_page = swiotlb_unmap_page, |
30 | .map_sg = swiotlb_map_sg_attrs, | 38 | .map_sg = swiotlb_map_sg_attrs, |
diff --git a/arch/ia64/sn/pci/pci_dma.c b/arch/ia64/sn/pci/pci_dma.c index a9d310de57da..3290d6e00c31 100644 --- a/arch/ia64/sn/pci/pci_dma.c +++ b/arch/ia64/sn/pci/pci_dma.c | |||
@@ -76,7 +76,8 @@ EXPORT_SYMBOL(sn_dma_set_mask); | |||
76 | * more information. | 76 | * more information. |
77 | */ | 77 | */ |
78 | static void *sn_dma_alloc_coherent(struct device *dev, size_t size, | 78 | static void *sn_dma_alloc_coherent(struct device *dev, size_t size, |
79 | dma_addr_t * dma_handle, gfp_t flags) | 79 | dma_addr_t * dma_handle, gfp_t flags, |
80 | struct dma_attrs *attrs) | ||
80 | { | 81 | { |
81 | void *cpuaddr; | 82 | void *cpuaddr; |
82 | unsigned long phys_addr; | 83 | unsigned long phys_addr; |
@@ -137,7 +138,7 @@ static void *sn_dma_alloc_coherent(struct device *dev, size_t size, | |||
137 | * any associated IOMMU mappings. | 138 | * any associated IOMMU mappings. |
138 | */ | 139 | */ |
139 | static void sn_dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, | 140 | static void sn_dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, |
140 | dma_addr_t dma_handle) | 141 | dma_addr_t dma_handle, struct dma_attrs *attrs) |
141 | { | 142 | { |
142 | struct pci_dev *pdev = to_pci_dev(dev); | 143 | struct pci_dev *pdev = to_pci_dev(dev); |
143 | struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev); | 144 | struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev); |
@@ -466,8 +467,8 @@ int sn_pci_legacy_write(struct pci_bus *bus, u16 port, u32 val, u8 size) | |||
466 | } | 467 | } |
467 | 468 | ||
468 | static struct dma_map_ops sn_dma_ops = { | 469 | static struct dma_map_ops sn_dma_ops = { |
469 | .alloc_coherent = sn_dma_alloc_coherent, | 470 | .alloc = sn_dma_alloc_coherent, |
470 | .free_coherent = sn_dma_free_coherent, | 471 | .free = sn_dma_free_coherent, |
471 | .map_page = sn_dma_map_page, | 472 | .map_page = sn_dma_map_page, |
472 | .unmap_page = sn_dma_unmap_page, | 473 | .unmap_page = sn_dma_unmap_page, |
473 | .map_sg = sn_dma_map_sg, | 474 | .map_sg = sn_dma_map_sg, |
diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h index ed3065fd6314..4b4331d71935 100644 --- a/arch/x86/include/asm/dma-mapping.h +++ b/arch/x86/include/asm/dma-mapping.h | |||
@@ -59,7 +59,8 @@ extern int dma_supported(struct device *hwdev, u64 mask); | |||
59 | extern int dma_set_mask(struct device *dev, u64 mask); | 59 | extern int dma_set_mask(struct device *dev, u64 mask); |
60 | 60 | ||
61 | extern void *dma_generic_alloc_coherent(struct device *dev, size_t size, | 61 | extern void *dma_generic_alloc_coherent(struct device *dev, size_t size, |
62 | dma_addr_t *dma_addr, gfp_t flag); | 62 | dma_addr_t *dma_addr, gfp_t flag, |
63 | struct dma_attrs *attrs); | ||
63 | 64 | ||
64 | static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) | 65 | static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) |
65 | { | 66 | { |
@@ -111,9 +112,11 @@ static inline gfp_t dma_alloc_coherent_gfp_flags(struct device *dev, gfp_t gfp) | |||
111 | return gfp; | 112 | return gfp; |
112 | } | 113 | } |
113 | 114 | ||
115 | #define dma_alloc_coherent(d,s,h,f) dma_alloc_attrs(d,s,h,f,NULL) | ||
116 | |||
114 | static inline void * | 117 | static inline void * |
115 | dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, | 118 | dma_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_handle, |
116 | gfp_t gfp) | 119 | gfp_t gfp, struct dma_attrs *attrs) |
117 | { | 120 | { |
118 | struct dma_map_ops *ops = get_dma_ops(dev); | 121 | struct dma_map_ops *ops = get_dma_ops(dev); |
119 | void *memory; | 122 | void *memory; |
@@ -129,18 +132,21 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, | |||
129 | if (!is_device_dma_capable(dev)) | 132 | if (!is_device_dma_capable(dev)) |
130 | return NULL; | 133 | return NULL; |
131 | 134 | ||
132 | if (!ops->alloc_coherent) | 135 | if (!ops->alloc) |
133 | return NULL; | 136 | return NULL; |
134 | 137 | ||
135 | memory = ops->alloc_coherent(dev, size, dma_handle, | 138 | memory = ops->alloc(dev, size, dma_handle, |
136 | dma_alloc_coherent_gfp_flags(dev, gfp)); | 139 | dma_alloc_coherent_gfp_flags(dev, gfp), attrs); |
137 | debug_dma_alloc_coherent(dev, size, *dma_handle, memory); | 140 | debug_dma_alloc_coherent(dev, size, *dma_handle, memory); |
138 | 141 | ||
139 | return memory; | 142 | return memory; |
140 | } | 143 | } |
141 | 144 | ||
142 | static inline void dma_free_coherent(struct device *dev, size_t size, | 145 | #define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL) |
143 | void *vaddr, dma_addr_t bus) | 146 | |
147 | static inline void dma_free_attrs(struct device *dev, size_t size, | ||
148 | void *vaddr, dma_addr_t bus, | ||
149 | struct dma_attrs *attrs) | ||
144 | { | 150 | { |
145 | struct dma_map_ops *ops = get_dma_ops(dev); | 151 | struct dma_map_ops *ops = get_dma_ops(dev); |
146 | 152 | ||
@@ -150,8 +156,8 @@ static inline void dma_free_coherent(struct device *dev, size_t size, | |||
150 | return; | 156 | return; |
151 | 157 | ||
152 | debug_dma_free_coherent(dev, size, vaddr, bus); | 158 | debug_dma_free_coherent(dev, size, vaddr, bus); |
153 | if (ops->free_coherent) | 159 | if (ops->free) |
154 | ops->free_coherent(dev, size, vaddr, bus); | 160 | ops->free(dev, size, vaddr, bus, attrs); |
155 | } | 161 | } |
156 | 162 | ||
157 | #endif | 163 | #endif |
diff --git a/arch/x86/kernel/amd_gart_64.c b/arch/x86/kernel/amd_gart_64.c index b1e7c7f7a0af..e66311200cbd 100644 --- a/arch/x86/kernel/amd_gart_64.c +++ b/arch/x86/kernel/amd_gart_64.c | |||
@@ -477,7 +477,7 @@ error: | |||
477 | /* allocate and map a coherent mapping */ | 477 | /* allocate and map a coherent mapping */ |
478 | static void * | 478 | static void * |
479 | gart_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_addr, | 479 | gart_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_addr, |
480 | gfp_t flag) | 480 | gfp_t flag, struct dma_attrs *attrs) |
481 | { | 481 | { |
482 | dma_addr_t paddr; | 482 | dma_addr_t paddr; |
483 | unsigned long align_mask; | 483 | unsigned long align_mask; |
@@ -500,7 +500,8 @@ gart_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_addr, | |||
500 | } | 500 | } |
501 | __free_pages(page, get_order(size)); | 501 | __free_pages(page, get_order(size)); |
502 | } else | 502 | } else |
503 | return dma_generic_alloc_coherent(dev, size, dma_addr, flag); | 503 | return dma_generic_alloc_coherent(dev, size, dma_addr, flag, |
504 | attrs); | ||
504 | 505 | ||
505 | return NULL; | 506 | return NULL; |
506 | } | 507 | } |
@@ -508,7 +509,7 @@ gart_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_addr, | |||
508 | /* free a coherent mapping */ | 509 | /* free a coherent mapping */ |
509 | static void | 510 | static void |
510 | gart_free_coherent(struct device *dev, size_t size, void *vaddr, | 511 | gart_free_coherent(struct device *dev, size_t size, void *vaddr, |
511 | dma_addr_t dma_addr) | 512 | dma_addr_t dma_addr, struct dma_attrs *attrs) |
512 | { | 513 | { |
513 | gart_unmap_page(dev, dma_addr, size, DMA_BIDIRECTIONAL, NULL); | 514 | gart_unmap_page(dev, dma_addr, size, DMA_BIDIRECTIONAL, NULL); |
514 | free_pages((unsigned long)vaddr, get_order(size)); | 515 | free_pages((unsigned long)vaddr, get_order(size)); |
@@ -700,8 +701,8 @@ static struct dma_map_ops gart_dma_ops = { | |||
700 | .unmap_sg = gart_unmap_sg, | 701 | .unmap_sg = gart_unmap_sg, |
701 | .map_page = gart_map_page, | 702 | .map_page = gart_map_page, |
702 | .unmap_page = gart_unmap_page, | 703 | .unmap_page = gart_unmap_page, |
703 | .alloc_coherent = gart_alloc_coherent, | 704 | .alloc = gart_alloc_coherent, |
704 | .free_coherent = gart_free_coherent, | 705 | .free = gart_free_coherent, |
705 | .mapping_error = gart_mapping_error, | 706 | .mapping_error = gart_mapping_error, |
706 | }; | 707 | }; |
707 | 708 | ||
diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c index 726494b58345..07b587c5a2d2 100644 --- a/arch/x86/kernel/pci-calgary_64.c +++ b/arch/x86/kernel/pci-calgary_64.c | |||
@@ -431,7 +431,7 @@ static void calgary_unmap_page(struct device *dev, dma_addr_t dma_addr, | |||
431 | } | 431 | } |
432 | 432 | ||
433 | static void* calgary_alloc_coherent(struct device *dev, size_t size, | 433 | static void* calgary_alloc_coherent(struct device *dev, size_t size, |
434 | dma_addr_t *dma_handle, gfp_t flag) | 434 | dma_addr_t *dma_handle, gfp_t flag, struct dma_attrs *attrs) |
435 | { | 435 | { |
436 | void *ret = NULL; | 436 | void *ret = NULL; |
437 | dma_addr_t mapping; | 437 | dma_addr_t mapping; |
@@ -464,7 +464,8 @@ error: | |||
464 | } | 464 | } |
465 | 465 | ||
466 | static void calgary_free_coherent(struct device *dev, size_t size, | 466 | static void calgary_free_coherent(struct device *dev, size_t size, |
467 | void *vaddr, dma_addr_t dma_handle) | 467 | void *vaddr, dma_addr_t dma_handle, |
468 | struct dma_attrs *attrs) | ||
468 | { | 469 | { |
469 | unsigned int npages; | 470 | unsigned int npages; |
470 | struct iommu_table *tbl = find_iommu_table(dev); | 471 | struct iommu_table *tbl = find_iommu_table(dev); |
@@ -477,8 +478,8 @@ static void calgary_free_coherent(struct device *dev, size_t size, | |||
477 | } | 478 | } |
478 | 479 | ||
479 | static struct dma_map_ops calgary_dma_ops = { | 480 | static struct dma_map_ops calgary_dma_ops = { |
480 | .alloc_coherent = calgary_alloc_coherent, | 481 | .alloc = calgary_alloc_coherent, |
481 | .free_coherent = calgary_free_coherent, | 482 | .free = calgary_free_coherent, |
482 | .map_sg = calgary_map_sg, | 483 | .map_sg = calgary_map_sg, |
483 | .unmap_sg = calgary_unmap_sg, | 484 | .unmap_sg = calgary_unmap_sg, |
484 | .map_page = calgary_map_page, | 485 | .map_page = calgary_map_page, |
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c index 1c4d769e21ea..75e1cc19e630 100644 --- a/arch/x86/kernel/pci-dma.c +++ b/arch/x86/kernel/pci-dma.c | |||
@@ -96,7 +96,8 @@ void __init pci_iommu_alloc(void) | |||
96 | } | 96 | } |
97 | } | 97 | } |
98 | void *dma_generic_alloc_coherent(struct device *dev, size_t size, | 98 | void *dma_generic_alloc_coherent(struct device *dev, size_t size, |
99 | dma_addr_t *dma_addr, gfp_t flag) | 99 | dma_addr_t *dma_addr, gfp_t flag, |
100 | struct dma_attrs *attrs) | ||
100 | { | 101 | { |
101 | unsigned long dma_mask; | 102 | unsigned long dma_mask; |
102 | struct page *page; | 103 | struct page *page; |
diff --git a/arch/x86/kernel/pci-nommu.c b/arch/x86/kernel/pci-nommu.c index 3af4af810c07..f96050685b46 100644 --- a/arch/x86/kernel/pci-nommu.c +++ b/arch/x86/kernel/pci-nommu.c | |||
@@ -75,7 +75,7 @@ static int nommu_map_sg(struct device *hwdev, struct scatterlist *sg, | |||
75 | } | 75 | } |
76 | 76 | ||
77 | static void nommu_free_coherent(struct device *dev, size_t size, void *vaddr, | 77 | static void nommu_free_coherent(struct device *dev, size_t size, void *vaddr, |
78 | dma_addr_t dma_addr) | 78 | dma_addr_t dma_addr, struct dma_attrs *attrs) |
79 | { | 79 | { |
80 | free_pages((unsigned long)vaddr, get_order(size)); | 80 | free_pages((unsigned long)vaddr, get_order(size)); |
81 | } | 81 | } |
@@ -96,8 +96,8 @@ static void nommu_sync_sg_for_device(struct device *dev, | |||
96 | } | 96 | } |
97 | 97 | ||
98 | struct dma_map_ops nommu_dma_ops = { | 98 | struct dma_map_ops nommu_dma_ops = { |
99 | .alloc_coherent = dma_generic_alloc_coherent, | 99 | .alloc = dma_generic_alloc_coherent, |
100 | .free_coherent = nommu_free_coherent, | 100 | .free = nommu_free_coherent, |
101 | .map_sg = nommu_map_sg, | 101 | .map_sg = nommu_map_sg, |
102 | .map_page = nommu_map_page, | 102 | .map_page = nommu_map_page, |
103 | .sync_single_for_device = nommu_sync_single_for_device, | 103 | .sync_single_for_device = nommu_sync_single_for_device, |
diff --git a/arch/x86/kernel/pci-swiotlb.c b/arch/x86/kernel/pci-swiotlb.c index 8f972cbddef0..6c483ba98b9c 100644 --- a/arch/x86/kernel/pci-swiotlb.c +++ b/arch/x86/kernel/pci-swiotlb.c | |||
@@ -15,21 +15,30 @@ | |||
15 | int swiotlb __read_mostly; | 15 | int swiotlb __read_mostly; |
16 | 16 | ||
17 | static void *x86_swiotlb_alloc_coherent(struct device *hwdev, size_t size, | 17 | static void *x86_swiotlb_alloc_coherent(struct device *hwdev, size_t size, |
18 | dma_addr_t *dma_handle, gfp_t flags) | 18 | dma_addr_t *dma_handle, gfp_t flags, |
19 | struct dma_attrs *attrs) | ||
19 | { | 20 | { |
20 | void *vaddr; | 21 | void *vaddr; |
21 | 22 | ||
22 | vaddr = dma_generic_alloc_coherent(hwdev, size, dma_handle, flags); | 23 | vaddr = dma_generic_alloc_coherent(hwdev, size, dma_handle, flags, |
24 | attrs); | ||
23 | if (vaddr) | 25 | if (vaddr) |
24 | return vaddr; | 26 | return vaddr; |
25 | 27 | ||
26 | return swiotlb_alloc_coherent(hwdev, size, dma_handle, flags); | 28 | return swiotlb_alloc_coherent(hwdev, size, dma_handle, flags); |
27 | } | 29 | } |
28 | 30 | ||
31 | static void x86_swiotlb_free_coherent(struct device *dev, size_t size, | ||
32 | void *vaddr, dma_addr_t dma_addr, | ||
33 | struct dma_attrs *attrs) | ||
34 | { | ||
35 | swiotlb_free_coherent(dev, size, vaddr, dma_addr); | ||
36 | } | ||
37 | |||
29 | static struct dma_map_ops swiotlb_dma_ops = { | 38 | static struct dma_map_ops swiotlb_dma_ops = { |
30 | .mapping_error = swiotlb_dma_mapping_error, | 39 | .mapping_error = swiotlb_dma_mapping_error, |
31 | .alloc_coherent = x86_swiotlb_alloc_coherent, | 40 | .alloc = x86_swiotlb_alloc_coherent, |
32 | .free_coherent = swiotlb_free_coherent, | 41 | .free = x86_swiotlb_free_coherent, |
33 | .sync_single_for_cpu = swiotlb_sync_single_for_cpu, | 42 | .sync_single_for_cpu = swiotlb_sync_single_for_cpu, |
34 | .sync_single_for_device = swiotlb_sync_single_for_device, | 43 | .sync_single_for_device = swiotlb_sync_single_for_device, |
35 | .sync_sg_for_cpu = swiotlb_sync_sg_for_cpu, | 44 | .sync_sg_for_cpu = swiotlb_sync_sg_for_cpu, |
diff --git a/arch/x86/xen/pci-swiotlb-xen.c b/arch/x86/xen/pci-swiotlb-xen.c index b480d4207a4c..967633ad98c4 100644 --- a/arch/x86/xen/pci-swiotlb-xen.c +++ b/arch/x86/xen/pci-swiotlb-xen.c | |||
@@ -12,8 +12,8 @@ int xen_swiotlb __read_mostly; | |||
12 | 12 | ||
13 | static struct dma_map_ops xen_swiotlb_dma_ops = { | 13 | static struct dma_map_ops xen_swiotlb_dma_ops = { |
14 | .mapping_error = xen_swiotlb_dma_mapping_error, | 14 | .mapping_error = xen_swiotlb_dma_mapping_error, |
15 | .alloc_coherent = xen_swiotlb_alloc_coherent, | 15 | .alloc = xen_swiotlb_alloc_coherent, |
16 | .free_coherent = xen_swiotlb_free_coherent, | 16 | .free = xen_swiotlb_free_coherent, |
17 | .sync_single_for_cpu = xen_swiotlb_sync_single_for_cpu, | 17 | .sync_single_for_cpu = xen_swiotlb_sync_single_for_cpu, |
18 | .sync_single_for_device = xen_swiotlb_sync_single_for_device, | 18 | .sync_single_for_device = xen_swiotlb_sync_single_for_device, |
19 | .sync_sg_for_cpu = xen_swiotlb_sync_sg_for_cpu, | 19 | .sync_sg_for_cpu = xen_swiotlb_sync_sg_for_cpu, |
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index f75e0608be5b..daa333f97b78 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c | |||
@@ -2707,7 +2707,8 @@ static void unmap_sg(struct device *dev, struct scatterlist *sglist, | |||
2707 | * The exported alloc_coherent function for dma_ops. | 2707 | * The exported alloc_coherent function for dma_ops. |
2708 | */ | 2708 | */ |
2709 | static void *alloc_coherent(struct device *dev, size_t size, | 2709 | static void *alloc_coherent(struct device *dev, size_t size, |
2710 | dma_addr_t *dma_addr, gfp_t flag) | 2710 | dma_addr_t *dma_addr, gfp_t flag, |
2711 | struct dma_attrs *attrs) | ||
2711 | { | 2712 | { |
2712 | unsigned long flags; | 2713 | unsigned long flags; |
2713 | void *virt_addr; | 2714 | void *virt_addr; |
@@ -2765,7 +2766,8 @@ out_free: | |||
2765 | * The exported free_coherent function for dma_ops. | 2766 | * The exported free_coherent function for dma_ops. |
2766 | */ | 2767 | */ |
2767 | static void free_coherent(struct device *dev, size_t size, | 2768 | static void free_coherent(struct device *dev, size_t size, |
2768 | void *virt_addr, dma_addr_t dma_addr) | 2769 | void *virt_addr, dma_addr_t dma_addr, |
2770 | struct dma_attrs *attrs) | ||
2769 | { | 2771 | { |
2770 | unsigned long flags; | 2772 | unsigned long flags; |
2771 | struct protection_domain *domain; | 2773 | struct protection_domain *domain; |
@@ -2846,8 +2848,8 @@ static void prealloc_protection_domains(void) | |||
2846 | } | 2848 | } |
2847 | 2849 | ||
2848 | static struct dma_map_ops amd_iommu_dma_ops = { | 2850 | static struct dma_map_ops amd_iommu_dma_ops = { |
2849 | .alloc_coherent = alloc_coherent, | 2851 | .alloc = alloc_coherent, |
2850 | .free_coherent = free_coherent, | 2852 | .free = free_coherent, |
2851 | .map_page = map_page, | 2853 | .map_page = map_page, |
2852 | .unmap_page = unmap_page, | 2854 | .unmap_page = unmap_page, |
2853 | .map_sg = map_sg, | 2855 | .map_sg = map_sg, |
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index c9c6053198d4..e39bfdc055c3 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
@@ -2938,7 +2938,8 @@ static void intel_unmap_page(struct device *dev, dma_addr_t dev_addr, | |||
2938 | } | 2938 | } |
2939 | 2939 | ||
2940 | static void *intel_alloc_coherent(struct device *hwdev, size_t size, | 2940 | static void *intel_alloc_coherent(struct device *hwdev, size_t size, |
2941 | dma_addr_t *dma_handle, gfp_t flags) | 2941 | dma_addr_t *dma_handle, gfp_t flags, |
2942 | struct dma_attrs *attrs) | ||
2942 | { | 2943 | { |
2943 | void *vaddr; | 2944 | void *vaddr; |
2944 | int order; | 2945 | int order; |
@@ -2970,7 +2971,7 @@ static void *intel_alloc_coherent(struct device *hwdev, size_t size, | |||
2970 | } | 2971 | } |
2971 | 2972 | ||
2972 | static void intel_free_coherent(struct device *hwdev, size_t size, void *vaddr, | 2973 | static void intel_free_coherent(struct device *hwdev, size_t size, void *vaddr, |
2973 | dma_addr_t dma_handle) | 2974 | dma_addr_t dma_handle, struct dma_attrs *attrs) |
2974 | { | 2975 | { |
2975 | int order; | 2976 | int order; |
2976 | 2977 | ||
@@ -3115,8 +3116,8 @@ static int intel_mapping_error(struct device *dev, dma_addr_t dma_addr) | |||
3115 | } | 3116 | } |
3116 | 3117 | ||
3117 | struct dma_map_ops intel_dma_ops = { | 3118 | struct dma_map_ops intel_dma_ops = { |
3118 | .alloc_coherent = intel_alloc_coherent, | 3119 | .alloc = intel_alloc_coherent, |
3119 | .free_coherent = intel_free_coherent, | 3120 | .free = intel_free_coherent, |
3120 | .map_sg = intel_map_sg, | 3121 | .map_sg = intel_map_sg, |
3121 | .unmap_sg = intel_unmap_sg, | 3122 | .unmap_sg = intel_unmap_sg, |
3122 | .map_page = intel_map_page, | 3123 | .map_page = intel_map_page, |
diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c index 19e6a2041371..1afb4fba11b4 100644 --- a/drivers/xen/swiotlb-xen.c +++ b/drivers/xen/swiotlb-xen.c | |||
@@ -204,7 +204,8 @@ error: | |||
204 | 204 | ||
205 | void * | 205 | void * |
206 | xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size, | 206 | xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size, |
207 | dma_addr_t *dma_handle, gfp_t flags) | 207 | dma_addr_t *dma_handle, gfp_t flags, |
208 | struct dma_attrs *attrs) | ||
208 | { | 209 | { |
209 | void *ret; | 210 | void *ret; |
210 | int order = get_order(size); | 211 | int order = get_order(size); |
@@ -253,7 +254,7 @@ EXPORT_SYMBOL_GPL(xen_swiotlb_alloc_coherent); | |||
253 | 254 | ||
254 | void | 255 | void |
255 | xen_swiotlb_free_coherent(struct device *hwdev, size_t size, void *vaddr, | 256 | xen_swiotlb_free_coherent(struct device *hwdev, size_t size, void *vaddr, |
256 | dma_addr_t dev_addr) | 257 | dma_addr_t dev_addr, struct dma_attrs *attrs) |
257 | { | 258 | { |
258 | int order = get_order(size); | 259 | int order = get_order(size); |
259 | phys_addr_t phys; | 260 | phys_addr_t phys; |
diff --git a/include/xen/swiotlb-xen.h b/include/xen/swiotlb-xen.h index 2ea2fdc79c16..4f4d449f00f6 100644 --- a/include/xen/swiotlb-xen.h +++ b/include/xen/swiotlb-xen.h | |||
@@ -7,11 +7,13 @@ extern void xen_swiotlb_init(int verbose); | |||
7 | 7 | ||
8 | extern void | 8 | extern void |
9 | *xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size, | 9 | *xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size, |
10 | dma_addr_t *dma_handle, gfp_t flags); | 10 | dma_addr_t *dma_handle, gfp_t flags, |
11 | struct dma_attrs *attrs); | ||
11 | 12 | ||
12 | extern void | 13 | extern void |
13 | xen_swiotlb_free_coherent(struct device *hwdev, size_t size, | 14 | xen_swiotlb_free_coherent(struct device *hwdev, size_t size, |
14 | void *vaddr, dma_addr_t dma_handle); | 15 | void *vaddr, dma_addr_t dma_handle, |
16 | struct dma_attrs *attrs); | ||
15 | 17 | ||
16 | extern dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page, | 18 | extern dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page, |
17 | unsigned long offset, size_t size, | 19 | unsigned long offset, size_t size, |