diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2007-02-06 12:29:53 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2007-02-08 09:49:37 -0500 |
commit | 7f8e33546d17c7d8849be3a6623c3b6b3c9b588b (patch) | |
tree | 4ddbbf921dde932f8ce83b519608f945ae43a120 /arch/arm | |
parent | 56660faf9e8088542e85207df45fb9c5f4dd3909 (diff) |
[ARM] Don't call consistent_sync() for DMA coherent memory
Memory allocated by the coherent memory allocators will be marked
uncacheable, which means it's pointless calling consistent_sync()
to perform cache maintainence on this memory; it's just a waste of
CPU cycles.
Moreover, with the (subsequent) merge of outer cache support, it
actually breaks things to call consistent_sync() on anything but
direct-mapped memory.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/common/dmabounce.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/arch/arm/common/dmabounce.c b/arch/arm/common/dmabounce.c index 2e635b814c14..272702accd8b 100644 --- a/arch/arm/common/dmabounce.c +++ b/arch/arm/common/dmabounce.c | |||
@@ -281,10 +281,14 @@ map_single(struct device *dev, void *ptr, size_t size, | |||
281 | ptr = buf->safe; | 281 | ptr = buf->safe; |
282 | 282 | ||
283 | dma_addr = buf->safe_dma_addr; | 283 | dma_addr = buf->safe_dma_addr; |
284 | } else { | ||
285 | /* | ||
286 | * We don't need to sync the DMA buffer since | ||
287 | * it was allocated via the coherent allocators. | ||
288 | */ | ||
289 | consistent_sync(ptr, size, dir); | ||
284 | } | 290 | } |
285 | 291 | ||
286 | consistent_sync(ptr, size, dir); | ||
287 | |||
288 | return dma_addr; | 292 | return dma_addr; |
289 | } | 293 | } |
290 | 294 | ||
@@ -397,7 +401,10 @@ sync_single(struct device *dev, dma_addr_t dma_addr, size_t size, | |||
397 | default: | 401 | default: |
398 | BUG(); | 402 | BUG(); |
399 | } | 403 | } |
400 | consistent_sync(buf->safe, size, dir); | 404 | /* |
405 | * No need to sync the safe buffer - it was allocated | ||
406 | * via the coherent allocators. | ||
407 | */ | ||
401 | } else { | 408 | } else { |
402 | consistent_sync(dma_to_virt(dev, dma_addr), size, dir); | 409 | consistent_sync(dma_to_virt(dev, dma_addr), size, dir); |
403 | } | 410 | } |