summaryrefslogtreecommitdiffstats
path: root/arch/arm/mm/dma-mapping.c
diff options
context:
space:
mode:
authorMarek Szyprowski2012-08-20 11:19:25 +0200
committerMarek Szyprowski2012-08-28 21:01:02 +0200
commit6e5267aa543817015edb4a65c66e15f9809f92bd (patch)
tree9ec9d3d3003a0fc341856b81f0f2b30476daa51e /arch/arm/mm/dma-mapping.c
parentARM: relax conditions required for enabling Contiguous Memory Allocator (diff)
downloadkernel-qcow2-linux-6e5267aa543817015edb4a65c66e15f9809f92bd.tar.gz
kernel-qcow2-linux-6e5267aa543817015edb4a65c66e15f9809f92bd.tar.xz
kernel-qcow2-linux-6e5267aa543817015edb4a65c66e15f9809f92bd.zip
ARM: DMA-Mapping: add function for setting coherent pool size from platform code
Some platforms might require to increase atomic coherent pool to make sure that their device will be able to allocate all their buffers from atomic context. This function can be also used to decrease atomic coherent pool size if coherent allocations are not used for the given sub-platform. Suggested-by: Josh Coombs <josh.coombs@gmail.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Diffstat (limited to 'arch/arm/mm/dma-mapping.c')
-rw-r--r--arch/arm/mm/dma-mapping.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 4e7d1182e8a3..d1cc9c1d3566 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -267,6 +267,8 @@ static void __dma_free_remap(void *cpu_addr, size_t size)
vunmap(cpu_addr);
}
+#define DEFAULT_DMA_COHERENT_POOL_SIZE SZ_256K
+
struct dma_pool {
size_t size;
spinlock_t lock;
@@ -277,7 +279,7 @@ struct dma_pool {
};
static struct dma_pool atomic_pool = {
- .size = SZ_256K,
+ .size = DEFAULT_DMA_COHERENT_POOL_SIZE,
};
static int __init early_coherent_pool(char *p)
@@ -287,6 +289,21 @@ static int __init early_coherent_pool(char *p)
}
early_param("coherent_pool", early_coherent_pool);
+void __init init_dma_coherent_pool_size(unsigned long size)
+{
+ /*
+ * Catch any attempt to set the pool size too late.
+ */
+ BUG_ON(atomic_pool.vaddr);
+
+ /*
+ * Set architecture specific coherent pool size only if
+ * it has not been changed by kernel command line parameter.
+ */
+ if (atomic_pool.size == DEFAULT_DMA_COHERENT_POOL_SIZE)
+ atomic_pool.size = size;
+}
+
/*
* Initialise the coherent pool for atomic allocations.
*/