blob: 63b2a117a03cad58390c8925bc0f5a363d69ef2d [file] [log] [blame]
Catalin Marinas09b55412012-03-05 11:49:30 +00001/*
2 * SWIOTLB-based DMA API implementation
3 *
4 * Copyright (C) 2012 ARM Ltd.
5 * Author: Catalin Marinas <catalin.marinas@arm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include <linux/gfp.h>
21#include <linux/export.h>
22#include <linux/slab.h>
Laura Abbottd4932f92014-10-09 15:26:44 -070023#include <linux/genalloc.h>
Catalin Marinas09b55412012-03-05 11:49:30 +000024#include <linux/dma-mapping.h>
Laura Abbott6ac21042013-12-12 19:28:33 +000025#include <linux/dma-contiguous.h>
Catalin Marinas09b55412012-03-05 11:49:30 +000026#include <linux/vmalloc.h>
27#include <linux/swiotlb.h>
28
29#include <asm/cacheflush.h>
30
31struct dma_map_ops *dma_ops;
32EXPORT_SYMBOL(dma_ops);
33
Laura Abbott214fdbe2014-03-14 19:52:24 +000034static pgprot_t __get_dma_pgprot(struct dma_attrs *attrs, pgprot_t prot,
35 bool coherent)
36{
Catalin Marinas196adf22014-03-24 10:35:35 +000037 if (!coherent || dma_get_attr(DMA_ATTR_WRITE_COMBINE, attrs))
Laura Abbott214fdbe2014-03-14 19:52:24 +000038 return pgprot_writecombine(prot);
Laura Abbott214fdbe2014-03-14 19:52:24 +000039 return prot;
40}
41
Laura Abbottd4932f92014-10-09 15:26:44 -070042static struct gen_pool *atomic_pool;
43
44#define DEFAULT_DMA_COHERENT_POOL_SIZE SZ_256K
45static size_t atomic_pool_size = DEFAULT_DMA_COHERENT_POOL_SIZE;
46
47static int __init early_coherent_pool(char *p)
48{
49 atomic_pool_size = memparse(p, &p);
50 return 0;
51}
52early_param("coherent_pool", early_coherent_pool);
53
Suzuki K. Poulose71328132015-03-19 18:17:09 +000054static void *__alloc_from_pool(size_t size, struct page **ret_page, gfp_t flags)
Laura Abbottd4932f92014-10-09 15:26:44 -070055{
56 unsigned long val;
57 void *ptr = NULL;
58
59 if (!atomic_pool) {
60 WARN(1, "coherent pool not initialised!\n");
61 return NULL;
62 }
63
64 val = gen_pool_alloc(atomic_pool, size);
65 if (val) {
66 phys_addr_t phys = gen_pool_virt_to_phys(atomic_pool, val);
67
68 *ret_page = phys_to_page(phys);
69 ptr = (void *)val;
Marek Szyprowski6829e272015-04-23 12:46:16 +010070 memset(ptr, 0, size);
Laura Abbottd4932f92014-10-09 15:26:44 -070071 }
72
73 return ptr;
74}
75
76static bool __in_atomic_pool(void *start, size_t size)
77{
78 return addr_in_gen_pool(atomic_pool, (unsigned long)start, size);
79}
80
81static int __free_from_pool(void *start, size_t size)
82{
83 if (!__in_atomic_pool(start, size))
84 return 0;
85
86 gen_pool_free(atomic_pool, (unsigned long)start, size);
87
88 return 1;
89}
90
Ritesh Harjanibb10eb72014-02-06 17:21:51 +053091static void *__dma_alloc_coherent(struct device *dev, size_t size,
92 dma_addr_t *dma_handle, gfp_t flags,
93 struct dma_attrs *attrs)
Catalin Marinas09b55412012-03-05 11:49:30 +000094{
Laura Abbottc666e8d2013-12-12 19:28:32 +000095 if (dev == NULL) {
96 WARN_ONCE(1, "Use an actual device structure for DMA allocation\n");
97 return NULL;
98 }
99
Catalin Marinas19e76402014-02-27 12:09:22 +0000100 if (IS_ENABLED(CONFIG_ZONE_DMA) &&
Catalin Marinas09b55412012-03-05 11:49:30 +0000101 dev->coherent_dma_mask <= DMA_BIT_MASK(32))
Catalin Marinas19e76402014-02-27 12:09:22 +0000102 flags |= GFP_DMA;
Laura Abbottd4932f92014-10-09 15:26:44 -0700103 if (IS_ENABLED(CONFIG_DMA_CMA) && (flags & __GFP_WAIT)) {
Laura Abbott6ac21042013-12-12 19:28:33 +0000104 struct page *page;
Suzuki K. Poulose71328132015-03-19 18:17:09 +0000105 void *addr;
Laura Abbott6ac21042013-12-12 19:28:33 +0000106
107 page = dma_alloc_from_contiguous(dev, size >> PAGE_SHIFT,
108 get_order(size));
109 if (!page)
110 return NULL;
111
112 *dma_handle = phys_to_dma(dev, page_to_phys(page));
Suzuki K. Poulose71328132015-03-19 18:17:09 +0000113 addr = page_address(page);
Marek Szyprowski6829e272015-04-23 12:46:16 +0100114 memset(addr, 0, size);
Suzuki K. Poulose71328132015-03-19 18:17:09 +0000115 return addr;
Laura Abbott6ac21042013-12-12 19:28:33 +0000116 } else {
117 return swiotlb_alloc_coherent(dev, size, dma_handle, flags);
118 }
Catalin Marinas09b55412012-03-05 11:49:30 +0000119}
120
Ritesh Harjanibb10eb72014-02-06 17:21:51 +0530121static void __dma_free_coherent(struct device *dev, size_t size,
122 void *vaddr, dma_addr_t dma_handle,
123 struct dma_attrs *attrs)
Catalin Marinas09b55412012-03-05 11:49:30 +0000124{
Laura Abbottd4932f92014-10-09 15:26:44 -0700125 bool freed;
126 phys_addr_t paddr = dma_to_phys(dev, dma_handle);
127
Laura Abbottc666e8d2013-12-12 19:28:32 +0000128 if (dev == NULL) {
129 WARN_ONCE(1, "Use an actual device structure for DMA allocation\n");
130 return;
131 }
132
Laura Abbottd4932f92014-10-09 15:26:44 -0700133 freed = dma_release_from_contiguous(dev,
Laura Abbott6ac21042013-12-12 19:28:33 +0000134 phys_to_page(paddr),
135 size >> PAGE_SHIFT);
Laura Abbottd4932f92014-10-09 15:26:44 -0700136 if (!freed)
Laura Abbott6ac21042013-12-12 19:28:33 +0000137 swiotlb_free_coherent(dev, size, vaddr, dma_handle);
Catalin Marinas09b55412012-03-05 11:49:30 +0000138}
139
Catalin Marinas9d3bfbb2015-01-12 20:48:53 +0000140static void *__dma_alloc(struct device *dev, size_t size,
141 dma_addr_t *dma_handle, gfp_t flags,
142 struct dma_attrs *attrs)
Catalin Marinas73635902013-05-21 17:35:19 +0100143{
Laura Abbottd4932f92014-10-09 15:26:44 -0700144 struct page *page;
Catalin Marinas73635902013-05-21 17:35:19 +0100145 void *ptr, *coherent_ptr;
Catalin Marinas9d3bfbb2015-01-12 20:48:53 +0000146 bool coherent = is_device_dma_coherent(dev);
Catalin Marinas73635902013-05-21 17:35:19 +0100147
148 size = PAGE_ALIGN(size);
Laura Abbottd4932f92014-10-09 15:26:44 -0700149
Catalin Marinas9d3bfbb2015-01-12 20:48:53 +0000150 if (!coherent && !(flags & __GFP_WAIT)) {
Laura Abbottd4932f92014-10-09 15:26:44 -0700151 struct page *page = NULL;
Suzuki K. Poulose71328132015-03-19 18:17:09 +0000152 void *addr = __alloc_from_pool(size, &page, flags);
Laura Abbottd4932f92014-10-09 15:26:44 -0700153
154 if (addr)
155 *dma_handle = phys_to_dma(dev, page_to_phys(page));
156
157 return addr;
Laura Abbottd4932f92014-10-09 15:26:44 -0700158 }
Catalin Marinas73635902013-05-21 17:35:19 +0100159
160 ptr = __dma_alloc_coherent(dev, size, dma_handle, flags, attrs);
161 if (!ptr)
162 goto no_mem;
Catalin Marinas73635902013-05-21 17:35:19 +0100163
Catalin Marinas9d3bfbb2015-01-12 20:48:53 +0000164 /* no need for non-cacheable mapping if coherent */
165 if (coherent)
166 return ptr;
167
Catalin Marinas73635902013-05-21 17:35:19 +0100168 /* remove any dirty cache lines on the kernel alias */
169 __dma_flush_range(ptr, ptr + size);
170
171 /* create a coherent mapping */
172 page = virt_to_page(ptr);
Laura Abbottd4932f92014-10-09 15:26:44 -0700173 coherent_ptr = dma_common_contiguous_remap(page, size, VM_USERMAP,
174 __get_dma_pgprot(attrs,
175 __pgprot(PROT_NORMAL_NC), false),
176 NULL);
Catalin Marinas73635902013-05-21 17:35:19 +0100177 if (!coherent_ptr)
178 goto no_map;
179
180 return coherent_ptr;
181
182no_map:
183 __dma_free_coherent(dev, size, ptr, *dma_handle, attrs);
184no_mem:
Sean Paula52ce122014-10-01 16:31:50 +0100185 *dma_handle = DMA_ERROR_CODE;
Catalin Marinas73635902013-05-21 17:35:19 +0100186 return NULL;
187}
188
Catalin Marinas9d3bfbb2015-01-12 20:48:53 +0000189static void __dma_free(struct device *dev, size_t size,
190 void *vaddr, dma_addr_t dma_handle,
191 struct dma_attrs *attrs)
Catalin Marinas73635902013-05-21 17:35:19 +0100192{
193 void *swiotlb_addr = phys_to_virt(dma_to_phys(dev, dma_handle));
194
Dean Nelson2cff98b2015-04-29 16:09:18 +0100195 size = PAGE_ALIGN(size);
196
Catalin Marinas9d3bfbb2015-01-12 20:48:53 +0000197 if (!is_device_dma_coherent(dev)) {
198 if (__free_from_pool(vaddr, size))
199 return;
200 vunmap(vaddr);
201 }
Catalin Marinas73635902013-05-21 17:35:19 +0100202 __dma_free_coherent(dev, size, swiotlb_addr, dma_handle, attrs);
203}
204
205static dma_addr_t __swiotlb_map_page(struct device *dev, struct page *page,
206 unsigned long offset, size_t size,
207 enum dma_data_direction dir,
208 struct dma_attrs *attrs)
209{
210 dma_addr_t dev_addr;
211
212 dev_addr = swiotlb_map_page(dev, page, offset, size, dir, attrs);
Catalin Marinas9d3bfbb2015-01-12 20:48:53 +0000213 if (!is_device_dma_coherent(dev))
214 __dma_map_area(phys_to_virt(dma_to_phys(dev, dev_addr)), size, dir);
Catalin Marinas73635902013-05-21 17:35:19 +0100215
216 return dev_addr;
217}
218
219
220static void __swiotlb_unmap_page(struct device *dev, dma_addr_t dev_addr,
221 size_t size, enum dma_data_direction dir,
222 struct dma_attrs *attrs)
223{
Catalin Marinas9d3bfbb2015-01-12 20:48:53 +0000224 if (!is_device_dma_coherent(dev))
225 __dma_unmap_area(phys_to_virt(dma_to_phys(dev, dev_addr)), size, dir);
Catalin Marinas73635902013-05-21 17:35:19 +0100226 swiotlb_unmap_page(dev, dev_addr, size, dir, attrs);
227}
228
229static int __swiotlb_map_sg_attrs(struct device *dev, struct scatterlist *sgl,
230 int nelems, enum dma_data_direction dir,
231 struct dma_attrs *attrs)
232{
233 struct scatterlist *sg;
234 int i, ret;
235
236 ret = swiotlb_map_sg_attrs(dev, sgl, nelems, dir, attrs);
Catalin Marinas9d3bfbb2015-01-12 20:48:53 +0000237 if (!is_device_dma_coherent(dev))
238 for_each_sg(sgl, sg, ret, i)
239 __dma_map_area(phys_to_virt(dma_to_phys(dev, sg->dma_address)),
240 sg->length, dir);
Catalin Marinas73635902013-05-21 17:35:19 +0100241
242 return ret;
243}
244
245static void __swiotlb_unmap_sg_attrs(struct device *dev,
246 struct scatterlist *sgl, int nelems,
247 enum dma_data_direction dir,
248 struct dma_attrs *attrs)
249{
250 struct scatterlist *sg;
251 int i;
252
Catalin Marinas9d3bfbb2015-01-12 20:48:53 +0000253 if (!is_device_dma_coherent(dev))
254 for_each_sg(sgl, sg, nelems, i)
255 __dma_unmap_area(phys_to_virt(dma_to_phys(dev, sg->dma_address)),
256 sg->length, dir);
Catalin Marinas73635902013-05-21 17:35:19 +0100257 swiotlb_unmap_sg_attrs(dev, sgl, nelems, dir, attrs);
258}
259
260static void __swiotlb_sync_single_for_cpu(struct device *dev,
261 dma_addr_t dev_addr, size_t size,
262 enum dma_data_direction dir)
263{
Catalin Marinas9d3bfbb2015-01-12 20:48:53 +0000264 if (!is_device_dma_coherent(dev))
265 __dma_unmap_area(phys_to_virt(dma_to_phys(dev, dev_addr)), size, dir);
Catalin Marinas73635902013-05-21 17:35:19 +0100266 swiotlb_sync_single_for_cpu(dev, dev_addr, size, dir);
267}
268
269static void __swiotlb_sync_single_for_device(struct device *dev,
270 dma_addr_t dev_addr, size_t size,
271 enum dma_data_direction dir)
272{
273 swiotlb_sync_single_for_device(dev, dev_addr, size, dir);
Catalin Marinas9d3bfbb2015-01-12 20:48:53 +0000274 if (!is_device_dma_coherent(dev))
275 __dma_map_area(phys_to_virt(dma_to_phys(dev, dev_addr)), size, dir);
Catalin Marinas73635902013-05-21 17:35:19 +0100276}
277
278static void __swiotlb_sync_sg_for_cpu(struct device *dev,
279 struct scatterlist *sgl, int nelems,
280 enum dma_data_direction dir)
281{
282 struct scatterlist *sg;
283 int i;
284
Catalin Marinas9d3bfbb2015-01-12 20:48:53 +0000285 if (!is_device_dma_coherent(dev))
286 for_each_sg(sgl, sg, nelems, i)
287 __dma_unmap_area(phys_to_virt(dma_to_phys(dev, sg->dma_address)),
288 sg->length, dir);
Catalin Marinas73635902013-05-21 17:35:19 +0100289 swiotlb_sync_sg_for_cpu(dev, sgl, nelems, dir);
290}
291
292static void __swiotlb_sync_sg_for_device(struct device *dev,
293 struct scatterlist *sgl, int nelems,
294 enum dma_data_direction dir)
295{
296 struct scatterlist *sg;
297 int i;
298
299 swiotlb_sync_sg_for_device(dev, sgl, nelems, dir);
Catalin Marinas9d3bfbb2015-01-12 20:48:53 +0000300 if (!is_device_dma_coherent(dev))
301 for_each_sg(sgl, sg, nelems, i)
302 __dma_map_area(phys_to_virt(dma_to_phys(dev, sg->dma_address)),
303 sg->length, dir);
Catalin Marinas73635902013-05-21 17:35:19 +0100304}
305
Robin Murphyaaf6f2f2015-07-10 16:47:56 +0100306static int __swiotlb_mmap(struct device *dev,
307 struct vm_area_struct *vma,
308 void *cpu_addr, dma_addr_t dma_addr, size_t size,
309 struct dma_attrs *attrs)
Laura Abbott6e8d7962014-03-14 19:52:23 +0000310{
311 int ret = -ENXIO;
312 unsigned long nr_vma_pages = (vma->vm_end - vma->vm_start) >>
313 PAGE_SHIFT;
314 unsigned long nr_pages = PAGE_ALIGN(size) >> PAGE_SHIFT;
315 unsigned long pfn = dma_to_phys(dev, dma_addr) >> PAGE_SHIFT;
316 unsigned long off = vma->vm_pgoff;
317
Robin Murphyaaf6f2f2015-07-10 16:47:56 +0100318 vma->vm_page_prot = __get_dma_pgprot(attrs, vma->vm_page_prot,
319 is_device_dma_coherent(dev));
320
Laura Abbott6e8d7962014-03-14 19:52:23 +0000321 if (dma_mmap_from_coherent(dev, vma, cpu_addr, size, &ret))
322 return ret;
323
324 if (off < nr_pages && nr_vma_pages <= (nr_pages - off)) {
325 ret = remap_pfn_range(vma, vma->vm_start,
326 pfn + off,
327 vma->vm_end - vma->vm_start,
328 vma->vm_page_prot);
329 }
330
331 return ret;
332}
333
Catalin Marinas9d3bfbb2015-01-12 20:48:53 +0000334static struct dma_map_ops swiotlb_dma_ops = {
335 .alloc = __dma_alloc,
336 .free = __dma_free,
337 .mmap = __swiotlb_mmap,
Catalin Marinas73635902013-05-21 17:35:19 +0100338 .map_page = __swiotlb_map_page,
339 .unmap_page = __swiotlb_unmap_page,
340 .map_sg = __swiotlb_map_sg_attrs,
341 .unmap_sg = __swiotlb_unmap_sg_attrs,
342 .sync_single_for_cpu = __swiotlb_sync_single_for_cpu,
343 .sync_single_for_device = __swiotlb_sync_single_for_device,
344 .sync_sg_for_cpu = __swiotlb_sync_sg_for_cpu,
345 .sync_sg_for_device = __swiotlb_sync_sg_for_device,
346 .dma_supported = swiotlb_dma_supported,
347 .mapping_error = swiotlb_dma_mapping_error,
348};
Catalin Marinas09b55412012-03-05 11:49:30 +0000349
Laura Abbottd4932f92014-10-09 15:26:44 -0700350static int __init atomic_pool_init(void)
351{
352 pgprot_t prot = __pgprot(PROT_NORMAL_NC);
353 unsigned long nr_pages = atomic_pool_size >> PAGE_SHIFT;
354 struct page *page;
355 void *addr;
356 unsigned int pool_size_order = get_order(atomic_pool_size);
357
358 if (dev_get_cma_area(NULL))
359 page = dma_alloc_from_contiguous(NULL, nr_pages,
360 pool_size_order);
361 else
362 page = alloc_pages(GFP_DMA, pool_size_order);
363
364 if (page) {
365 int ret;
366 void *page_addr = page_address(page);
367
368 memset(page_addr, 0, atomic_pool_size);
369 __dma_flush_range(page_addr, page_addr + atomic_pool_size);
370
371 atomic_pool = gen_pool_create(PAGE_SHIFT, -1);
372 if (!atomic_pool)
373 goto free_page;
374
375 addr = dma_common_contiguous_remap(page, atomic_pool_size,
376 VM_USERMAP, prot, atomic_pool_init);
377
378 if (!addr)
379 goto destroy_genpool;
380
381 ret = gen_pool_add_virt(atomic_pool, (unsigned long)addr,
382 page_to_phys(page),
383 atomic_pool_size, -1);
384 if (ret)
385 goto remove_mapping;
386
387 gen_pool_set_algo(atomic_pool,
388 gen_pool_first_fit_order_align,
389 (void *)PAGE_SHIFT);
390
391 pr_info("DMA: preallocated %zu KiB pool for atomic allocations\n",
392 atomic_pool_size / 1024);
393 return 0;
394 }
395 goto out;
396
397remove_mapping:
398 dma_common_free_remap(addr, atomic_pool_size, VM_USERMAP);
399destroy_genpool:
400 gen_pool_destroy(atomic_pool);
401 atomic_pool = NULL;
402free_page:
403 if (!dma_release_from_contiguous(NULL, page, nr_pages))
404 __free_pages(page, pool_size_order);
405out:
406 pr_err("DMA: failed to allocate %zu KiB pool for atomic coherent allocation\n",
407 atomic_pool_size / 1024);
408 return -ENOMEM;
409}
410
Suthikulpanit, Suraveeb6197b92015-06-10 11:08:53 -0500411/********************************************
412 * The following APIs are for dummy DMA ops *
413 ********************************************/
414
415static void *__dummy_alloc(struct device *dev, size_t size,
416 dma_addr_t *dma_handle, gfp_t flags,
417 struct dma_attrs *attrs)
418{
419 return NULL;
420}
421
422static void __dummy_free(struct device *dev, size_t size,
423 void *vaddr, dma_addr_t dma_handle,
424 struct dma_attrs *attrs)
425{
426}
427
428static int __dummy_mmap(struct device *dev,
429 struct vm_area_struct *vma,
430 void *cpu_addr, dma_addr_t dma_addr, size_t size,
431 struct dma_attrs *attrs)
432{
433 return -ENXIO;
434}
435
436static dma_addr_t __dummy_map_page(struct device *dev, struct page *page,
437 unsigned long offset, size_t size,
438 enum dma_data_direction dir,
439 struct dma_attrs *attrs)
440{
441 return DMA_ERROR_CODE;
442}
443
444static void __dummy_unmap_page(struct device *dev, dma_addr_t dev_addr,
445 size_t size, enum dma_data_direction dir,
446 struct dma_attrs *attrs)
447{
448}
449
450static int __dummy_map_sg(struct device *dev, struct scatterlist *sgl,
451 int nelems, enum dma_data_direction dir,
452 struct dma_attrs *attrs)
453{
454 return 0;
455}
456
457static void __dummy_unmap_sg(struct device *dev,
458 struct scatterlist *sgl, int nelems,
459 enum dma_data_direction dir,
460 struct dma_attrs *attrs)
461{
462}
463
464static void __dummy_sync_single(struct device *dev,
465 dma_addr_t dev_addr, size_t size,
466 enum dma_data_direction dir)
467{
468}
469
470static void __dummy_sync_sg(struct device *dev,
471 struct scatterlist *sgl, int nelems,
472 enum dma_data_direction dir)
473{
474}
475
476static int __dummy_mapping_error(struct device *hwdev, dma_addr_t dma_addr)
477{
478 return 1;
479}
480
481static int __dummy_dma_supported(struct device *hwdev, u64 mask)
482{
483 return 0;
484}
485
486struct dma_map_ops dummy_dma_ops = {
487 .alloc = __dummy_alloc,
488 .free = __dummy_free,
489 .mmap = __dummy_mmap,
490 .map_page = __dummy_map_page,
491 .unmap_page = __dummy_unmap_page,
492 .map_sg = __dummy_map_sg,
493 .unmap_sg = __dummy_unmap_sg,
494 .sync_single_for_cpu = __dummy_sync_single,
495 .sync_single_for_device = __dummy_sync_single,
496 .sync_sg_for_cpu = __dummy_sync_sg,
497 .sync_sg_for_device = __dummy_sync_sg,
498 .mapping_error = __dummy_mapping_error,
499 .dma_supported = __dummy_dma_supported,
500};
501EXPORT_SYMBOL(dummy_dma_ops);
502
Catalin Marinasa1e50a82015-02-05 18:01:53 +0000503static int __init arm64_dma_init(void)
Catalin Marinas09b55412012-03-05 11:49:30 +0000504{
Catalin Marinasa1e50a82015-02-05 18:01:53 +0000505 int ret;
Catalin Marinas36909512014-02-27 12:24:57 +0000506
Catalin Marinas9d3bfbb2015-01-12 20:48:53 +0000507 dma_ops = &swiotlb_dma_ops;
Catalin Marinas36909512014-02-27 12:24:57 +0000508
Catalin Marinasa1e50a82015-02-05 18:01:53 +0000509 ret = atomic_pool_init();
Laura Abbottd4932f92014-10-09 15:26:44 -0700510
511 return ret;
512}
513arch_initcall(arm64_dma_init);
Catalin Marinas09b55412012-03-05 11:49:30 +0000514
515#define PREALLOC_DMA_DEBUG_ENTRIES 4096
516
517static int __init dma_debug_do_init(void)
518{
519 dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
520 return 0;
521}
522fs_initcall(dma_debug_do_init);