diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-04-04 20:13:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-04-04 20:13:43 -0400 |
commit | 58bca4a8fa90fcf9069379653b396b2cec642f7f (patch) | |
tree | 483c535136b5b168f36326956453e80ce5aa6543 /arch/microblaze | |
parent | 64ebe987311853ea857a244439de5b947a4b1b07 (diff) | |
parent | 64d70fe5d3640e1a89790ed21120921278f8cb86 (diff) |
Merge branch 'for-linus' of git://git.linaro.org/people/mszyprowski/linux-dma-mapping
Pull DMA mapping branch from Marek Szyprowski:
"Short summary for the whole series:
A few limitations have been identified in the current dma-mapping
design and its implementations for various architectures. There exist
more than one function for allocating and freeing the buffers:
currently these 3 are used dma_{alloc, free}_coherent,
dma_{alloc,free}_writecombine, dma_{alloc,free}_noncoherent.
For most of the systems these calls are almost equivalent and can be
interchanged. For others, especially the truly non-coherent ones
(like ARM), the difference can be easily noticed in overall driver
performance. Sadly not all architectures provide implementations for
all of them, so the drivers might need to be adapted and cannot be
easily shared between different architectures. The provided patches
unify all these functions and hide the differences under the already
existing dma attributes concept. The thread with more references is
available here:
http://www.spinics.net/lists/linux-sh/msg09777.html
These patches are also a prerequisite for unifying DMA-mapping
implementation on ARM architecture with the common one provided by
dma_map_ops structure and extending it with IOMMU support. More
information is available in the following thread:
http://thread.gmane.org/gmane.linux.kernel.cross-arch/12819
More works on dma-mapping framework are planned, especially in the
area of buffer sharing and managing the shared mappings (together with
the recently introduced dma_buf interface: commit d15bd7ee445d
"dma-buf: Introduce dma buffer sharing mechanism").
The patches in the current set introduce a new alloc/free methods
(with support for memory attributes) in dma_map_ops structure, which
will later replace dma_alloc_coherent and dma_alloc_writecombine
functions."
People finally started piping up with support for merging this, so I'm
merging it as the last of the pending stuff from the merge window.
Looks like pohmelfs is going to wait for 3.5 and more external support
for merging.
* 'for-linus' of git://git.linaro.org/people/mszyprowski/linux-dma-mapping:
common: DMA-mapping: add NON-CONSISTENT attribute
common: DMA-mapping: add WRITE_COMBINE attribute
common: dma-mapping: introduce mmap method
common: dma-mapping: remove old alloc_coherent and free_coherent methods
Hexagon: adapt for dma_map_ops changes
Unicore32: adapt for dma_map_ops changes
Microblaze: adapt for dma_map_ops changes
SH: adapt for dma_map_ops changes
Alpha: adapt for dma_map_ops changes
SPARC: adapt for dma_map_ops changes
PowerPC: adapt for dma_map_ops changes
MIPS: adapt for dma_map_ops changes
X86 & IA64: adapt for dma_map_ops changes
common: dma-mapping: introduce generic alloc() and free() methods
Diffstat (limited to 'arch/microblaze')
-rw-r--r-- | arch/microblaze/include/asm/dma-mapping.h | 18 | ||||
-rw-r--r-- | arch/microblaze/kernel/dma.c | 10 |
2 files changed, 18 insertions, 10 deletions
diff --git a/arch/microblaze/include/asm/dma-mapping.h b/arch/microblaze/include/asm/dma-mapping.h index 3a3e5b886854..01d228286cb0 100644 --- a/arch/microblaze/include/asm/dma-mapping.h +++ b/arch/microblaze/include/asm/dma-mapping.h | |||
@@ -123,28 +123,34 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) | |||
123 | #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) | 123 | #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) |
124 | #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) | 124 | #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) |
125 | 125 | ||
126 | static inline void *dma_alloc_coherent(struct device *dev, size_t size, | 126 | #define dma_alloc_coherent(d, s, h, f) dma_alloc_attrs(d, s, h, f, NULL) |
127 | dma_addr_t *dma_handle, gfp_t flag) | 127 | |
128 | static inline void *dma_alloc_attrs(struct device *dev, size_t size, | ||
129 | dma_addr_t *dma_handle, gfp_t flag, | ||
130 | struct dma_attrs *attrs) | ||
128 | { | 131 | { |
129 | struct dma_map_ops *ops = get_dma_ops(dev); | 132 | struct dma_map_ops *ops = get_dma_ops(dev); |
130 | void *memory; | 133 | void *memory; |
131 | 134 | ||
132 | BUG_ON(!ops); | 135 | BUG_ON(!ops); |
133 | 136 | ||
134 | memory = ops->alloc_coherent(dev, size, dma_handle, flag); | 137 | memory = ops->alloc(dev, size, dma_handle, flag, attrs); |
135 | 138 | ||
136 | debug_dma_alloc_coherent(dev, size, *dma_handle, memory); | 139 | debug_dma_alloc_coherent(dev, size, *dma_handle, memory); |
137 | return memory; | 140 | return memory; |
138 | } | 141 | } |
139 | 142 | ||
140 | static inline void dma_free_coherent(struct device *dev, size_t size, | 143 | #define dma_free_coherent(d,s,c,h) dma_free_attrs(d, s, c, h, NULL) |
141 | void *cpu_addr, dma_addr_t dma_handle) | 144 | |
145 | static inline void dma_free_attrs(struct device *dev, size_t size, | ||
146 | void *cpu_addr, dma_addr_t dma_handle, | ||
147 | struct dma_attrs *attrs) | ||
142 | { | 148 | { |
143 | struct dma_map_ops *ops = get_dma_ops(dev); | 149 | struct dma_map_ops *ops = get_dma_ops(dev); |
144 | 150 | ||
145 | BUG_ON(!ops); | 151 | BUG_ON(!ops); |
146 | debug_dma_free_coherent(dev, size, cpu_addr, dma_handle); | 152 | debug_dma_free_coherent(dev, size, cpu_addr, dma_handle); |
147 | ops->free_coherent(dev, size, cpu_addr, dma_handle); | 153 | ops->free(dev, size, cpu_addr, dma_handle, attrs); |
148 | } | 154 | } |
149 | 155 | ||
150 | static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size, | 156 | static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size, |
diff --git a/arch/microblaze/kernel/dma.c b/arch/microblaze/kernel/dma.c index 65a4af4cbbbe..a2bfa2ca5730 100644 --- a/arch/microblaze/kernel/dma.c +++ b/arch/microblaze/kernel/dma.c | |||
@@ -33,7 +33,8 @@ static unsigned long get_dma_direct_offset(struct device *dev) | |||
33 | #define NOT_COHERENT_CACHE | 33 | #define NOT_COHERENT_CACHE |
34 | 34 | ||
35 | static void *dma_direct_alloc_coherent(struct device *dev, size_t size, | 35 | static void *dma_direct_alloc_coherent(struct device *dev, size_t size, |
36 | dma_addr_t *dma_handle, gfp_t flag) | 36 | dma_addr_t *dma_handle, gfp_t flag, |
37 | struct dma_attrs *attrs) | ||
37 | { | 38 | { |
38 | #ifdef NOT_COHERENT_CACHE | 39 | #ifdef NOT_COHERENT_CACHE |
39 | return consistent_alloc(flag, size, dma_handle); | 40 | return consistent_alloc(flag, size, dma_handle); |
@@ -57,7 +58,8 @@ static void *dma_direct_alloc_coherent(struct device *dev, size_t size, | |||
57 | } | 58 | } |
58 | 59 | ||
59 | static void dma_direct_free_coherent(struct device *dev, size_t size, | 60 | static void dma_direct_free_coherent(struct device *dev, size_t size, |
60 | void *vaddr, dma_addr_t dma_handle) | 61 | void *vaddr, dma_addr_t dma_handle, |
62 | struct dma_attrs *attrs) | ||
61 | { | 63 | { |
62 | #ifdef NOT_COHERENT_CACHE | 64 | #ifdef NOT_COHERENT_CACHE |
63 | consistent_free(size, vaddr); | 65 | consistent_free(size, vaddr); |
@@ -176,8 +178,8 @@ dma_direct_sync_sg_for_device(struct device *dev, | |||
176 | } | 178 | } |
177 | 179 | ||
178 | struct dma_map_ops dma_direct_ops = { | 180 | struct dma_map_ops dma_direct_ops = { |
179 | .alloc_coherent = dma_direct_alloc_coherent, | 181 | .alloc = dma_direct_alloc_coherent, |
180 | .free_coherent = dma_direct_free_coherent, | 182 | .free = dma_direct_free_coherent, |
181 | .map_sg = dma_direct_map_sg, | 183 | .map_sg = dma_direct_map_sg, |
182 | .unmap_sg = dma_direct_unmap_sg, | 184 | .unmap_sg = dma_direct_unmap_sg, |
183 | .dma_supported = dma_direct_dma_supported, | 185 | .dma_supported = dma_direct_dma_supported, |