aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/Kconfig1
-rw-r--r--arch/powerpc/include/asm/dma-mapping.h11
-rw-r--r--arch/powerpc/kernel/dma.c11
3 files changed, 22 insertions, 1 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 6078253c6d76..9e03991dc878 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -121,6 +121,7 @@ config PPC
121 select HAVE_ARCH_TRACEHOOK 121 select HAVE_ARCH_TRACEHOOK
122 select HAVE_LMB 122 select HAVE_LMB
123 select HAVE_DMA_ATTRS 123 select HAVE_DMA_ATTRS
124 select HAVE_DMA_API_DEBUG
124 select USE_GENERIC_SMP_HELPERS if SMP 125 select USE_GENERIC_SMP_HELPERS if SMP
125 select HAVE_OPROFILE 126 select HAVE_OPROFILE
126 select HAVE_SYSCALL_WRAPPERS if PPC64 127 select HAVE_SYSCALL_WRAPPERS if PPC64
diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h
index 4bd41b4051e3..cb2ca41dd526 100644
--- a/arch/powerpc/include/asm/dma-mapping.h
+++ b/arch/powerpc/include/asm/dma-mapping.h
@@ -127,9 +127,15 @@ static inline void *dma_alloc_coherent(struct device *dev, size_t size,
127 dma_addr_t *dma_handle, gfp_t flag) 127 dma_addr_t *dma_handle, gfp_t flag)
128{ 128{
129 struct dma_map_ops *dma_ops = get_dma_ops(dev); 129 struct dma_map_ops *dma_ops = get_dma_ops(dev);
130 void *cpu_addr;
130 131
131 BUG_ON(!dma_ops); 132 BUG_ON(!dma_ops);
132 return dma_ops->alloc_coherent(dev, size, dma_handle, flag); 133
134 cpu_addr = dma_ops->alloc_coherent(dev, size, dma_handle, flag);
135
136 debug_dma_alloc_coherent(dev, size, *dma_handle, cpu_addr);
137
138 return cpu_addr;
133} 139}
134 140
135static inline void dma_free_coherent(struct device *dev, size_t size, 141static inline void dma_free_coherent(struct device *dev, size_t size,
@@ -138,6 +144,9 @@ static inline void dma_free_coherent(struct device *dev, size_t size,
138 struct dma_map_ops *dma_ops = get_dma_ops(dev); 144 struct dma_map_ops *dma_ops = get_dma_ops(dev);
139 145
140 BUG_ON(!dma_ops); 146 BUG_ON(!dma_ops);
147
148 debug_dma_free_coherent(dev, size, cpu_addr, dma_handle);
149
141 dma_ops->free_coherent(dev, size, cpu_addr, dma_handle); 150 dma_ops->free_coherent(dev, size, cpu_addr, dma_handle);
142} 151}
143 152
diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c
index c61f70e145ad..21b784d7e7d0 100644
--- a/arch/powerpc/kernel/dma.c
+++ b/arch/powerpc/kernel/dma.c
@@ -7,6 +7,7 @@
7 7
8#include <linux/device.h> 8#include <linux/device.h>
9#include <linux/dma-mapping.h> 9#include <linux/dma-mapping.h>
10#include <linux/dma-debug.h>
10#include <linux/lmb.h> 11#include <linux/lmb.h>
11#include <asm/bug.h> 12#include <asm/bug.h>
12#include <asm/abs_addr.h> 13#include <asm/abs_addr.h>
@@ -156,3 +157,13 @@ struct dma_map_ops dma_direct_ops = {
156#endif 157#endif
157}; 158};
158EXPORT_SYMBOL(dma_direct_ops); 159EXPORT_SYMBOL(dma_direct_ops);
160
161#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
162
163static int __init dma_init(void)
164{
165 dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
166
167 return 0;
168}
169fs_initcall(dma_init);