Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 1 | /* |
| 2 | * Coherent per-device memory handling. |
| 3 | * Borrowed from i386 |
| 4 | */ |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 5 | #include <linux/slab.h> |
Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 6 | #include <linux/kernel.h> |
Paul Gortmaker | 08a999c | 2011-07-01 16:07:32 -0400 | [diff] [blame] | 7 | #include <linux/module.h> |
Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 8 | #include <linux/dma-mapping.h> |
| 9 | |
| 10 | struct dma_coherent_mem { |
| 11 | void *virt_base; |
Marin Mitov | ed1d218 | 2010-05-31 13:03:04 +0300 | [diff] [blame] | 12 | dma_addr_t device_base; |
Bjorn Helgaas | 88a984b | 2014-05-20 16:54:22 -0600 | [diff] [blame] | 13 | unsigned long pfn_base; |
Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 14 | int size; |
| 15 | int flags; |
| 16 | unsigned long *bitmap; |
Marek Szyprowski | 7bfa5ab | 2014-10-13 15:51:07 -0700 | [diff] [blame] | 17 | spinlock_t spinlock; |
Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 18 | }; |
| 19 | |
Marek Szyprowski | 7bfa5ab | 2014-10-13 15:51:07 -0700 | [diff] [blame] | 20 | static int dma_init_coherent_memory(phys_addr_t phys_addr, dma_addr_t device_addr, |
| 21 | size_t size, int flags, |
| 22 | struct dma_coherent_mem **mem) |
Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 23 | { |
Marek Szyprowski | 7bfa5ab | 2014-10-13 15:51:07 -0700 | [diff] [blame] | 24 | struct dma_coherent_mem *dma_mem = NULL; |
Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 25 | void __iomem *mem_base = NULL; |
| 26 | int pages = size >> PAGE_SHIFT; |
| 27 | int bitmap_size = BITS_TO_LONGS(pages) * sizeof(long); |
| 28 | |
| 29 | if ((flags & (DMA_MEMORY_MAP | DMA_MEMORY_IO)) == 0) |
| 30 | goto out; |
| 31 | if (!size) |
| 32 | goto out; |
Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 33 | |
Bjorn Helgaas | 88a984b | 2014-05-20 16:54:22 -0600 | [diff] [blame] | 34 | mem_base = ioremap(phys_addr, size); |
Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 35 | if (!mem_base) |
| 36 | goto out; |
| 37 | |
Marek Szyprowski | 7bfa5ab | 2014-10-13 15:51:07 -0700 | [diff] [blame] | 38 | dma_mem = kzalloc(sizeof(struct dma_coherent_mem), GFP_KERNEL); |
| 39 | if (!dma_mem) |
Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 40 | goto out; |
Marek Szyprowski | 7bfa5ab | 2014-10-13 15:51:07 -0700 | [diff] [blame] | 41 | dma_mem->bitmap = kzalloc(bitmap_size, GFP_KERNEL); |
| 42 | if (!dma_mem->bitmap) |
| 43 | goto out; |
Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 44 | |
Marek Szyprowski | 7bfa5ab | 2014-10-13 15:51:07 -0700 | [diff] [blame] | 45 | dma_mem->virt_base = mem_base; |
| 46 | dma_mem->device_base = device_addr; |
| 47 | dma_mem->pfn_base = PFN_DOWN(phys_addr); |
| 48 | dma_mem->size = pages; |
| 49 | dma_mem->flags = flags; |
| 50 | spin_lock_init(&dma_mem->spinlock); |
| 51 | |
| 52 | *mem = dma_mem; |
Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 53 | |
| 54 | if (flags & DMA_MEMORY_MAP) |
| 55 | return DMA_MEMORY_MAP; |
| 56 | |
| 57 | return DMA_MEMORY_IO; |
| 58 | |
Marek Szyprowski | 7bfa5ab | 2014-10-13 15:51:07 -0700 | [diff] [blame] | 59 | out: |
| 60 | kfree(dma_mem); |
Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 61 | if (mem_base) |
| 62 | iounmap(mem_base); |
| 63 | return 0; |
| 64 | } |
Marek Szyprowski | 7bfa5ab | 2014-10-13 15:51:07 -0700 | [diff] [blame] | 65 | |
| 66 | static void dma_release_coherent_memory(struct dma_coherent_mem *mem) |
| 67 | { |
| 68 | if (!mem) |
| 69 | return; |
| 70 | iounmap(mem->virt_base); |
| 71 | kfree(mem->bitmap); |
| 72 | kfree(mem); |
| 73 | } |
| 74 | |
| 75 | static int dma_assign_coherent_memory(struct device *dev, |
| 76 | struct dma_coherent_mem *mem) |
| 77 | { |
| 78 | if (dev->dma_mem) |
| 79 | return -EBUSY; |
| 80 | |
| 81 | dev->dma_mem = mem; |
| 82 | /* FIXME: this routine just ignores DMA_MEMORY_INCLUDES_CHILDREN */ |
| 83 | |
| 84 | return 0; |
| 85 | } |
| 86 | |
| 87 | int dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr, |
| 88 | dma_addr_t device_addr, size_t size, int flags) |
| 89 | { |
| 90 | struct dma_coherent_mem *mem; |
| 91 | int ret; |
| 92 | |
| 93 | ret = dma_init_coherent_memory(phys_addr, device_addr, size, flags, |
| 94 | &mem); |
| 95 | if (ret == 0) |
| 96 | return 0; |
| 97 | |
| 98 | if (dma_assign_coherent_memory(dev, mem) == 0) |
| 99 | return ret; |
| 100 | |
| 101 | dma_release_coherent_memory(mem); |
| 102 | return 0; |
| 103 | } |
Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 104 | EXPORT_SYMBOL(dma_declare_coherent_memory); |
| 105 | |
| 106 | void dma_release_declared_memory(struct device *dev) |
| 107 | { |
| 108 | struct dma_coherent_mem *mem = dev->dma_mem; |
| 109 | |
| 110 | if (!mem) |
| 111 | return; |
Marek Szyprowski | 7bfa5ab | 2014-10-13 15:51:07 -0700 | [diff] [blame] | 112 | dma_release_coherent_memory(mem); |
Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 113 | dev->dma_mem = NULL; |
Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 114 | } |
| 115 | EXPORT_SYMBOL(dma_release_declared_memory); |
| 116 | |
| 117 | void *dma_mark_declared_memory_occupied(struct device *dev, |
| 118 | dma_addr_t device_addr, size_t size) |
| 119 | { |
| 120 | struct dma_coherent_mem *mem = dev->dma_mem; |
Marek Szyprowski | 7bfa5ab | 2014-10-13 15:51:07 -0700 | [diff] [blame] | 121 | unsigned long flags; |
Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 122 | int pos, err; |
Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 123 | |
Jan Beulich | d2dc1f4 | 2008-08-05 13:01:31 -0700 | [diff] [blame] | 124 | size += device_addr & ~PAGE_MASK; |
Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 125 | |
| 126 | if (!mem) |
| 127 | return ERR_PTR(-EINVAL); |
| 128 | |
Marek Szyprowski | 7bfa5ab | 2014-10-13 15:51:07 -0700 | [diff] [blame] | 129 | spin_lock_irqsave(&mem->spinlock, flags); |
Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 130 | pos = (device_addr - mem->device_base) >> PAGE_SHIFT; |
Jan Beulich | d2dc1f4 | 2008-08-05 13:01:31 -0700 | [diff] [blame] | 131 | err = bitmap_allocate_region(mem->bitmap, pos, get_order(size)); |
Marek Szyprowski | 7bfa5ab | 2014-10-13 15:51:07 -0700 | [diff] [blame] | 132 | spin_unlock_irqrestore(&mem->spinlock, flags); |
| 133 | |
Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 134 | if (err != 0) |
| 135 | return ERR_PTR(err); |
| 136 | return mem->virt_base + (pos << PAGE_SHIFT); |
| 137 | } |
| 138 | EXPORT_SYMBOL(dma_mark_declared_memory_occupied); |
| 139 | |
Dmitry Baryshkov | b6d4f7e | 2008-07-20 15:01:10 +0400 | [diff] [blame] | 140 | /** |
Dmitry Baryshkov | cb3952b | 2008-07-30 14:46:50 +0400 | [diff] [blame] | 141 | * dma_alloc_from_coherent() - try to allocate memory from the per-device coherent area |
Dmitry Baryshkov | b6d4f7e | 2008-07-20 15:01:10 +0400 | [diff] [blame] | 142 | * |
| 143 | * @dev: device from which we allocate memory |
| 144 | * @size: size of requested memory area |
| 145 | * @dma_handle: This will be filled with the correct dma handle |
| 146 | * @ret: This pointer will be filled with the virtual address |
Paul Mundt | 0609697 | 2009-01-21 18:51:53 +0900 | [diff] [blame] | 147 | * to allocated area. |
Dmitry Baryshkov | b6d4f7e | 2008-07-20 15:01:10 +0400 | [diff] [blame] | 148 | * |
Dmitry Baryshkov | cb3952b | 2008-07-30 14:46:50 +0400 | [diff] [blame] | 149 | * This function should be only called from per-arch dma_alloc_coherent() |
Dmitry Baryshkov | b6d4f7e | 2008-07-20 15:01:10 +0400 | [diff] [blame] | 150 | * to support allocation from per-device coherent memory pools. |
| 151 | * |
| 152 | * Returns 0 if dma_alloc_coherent should continue with allocating from |
Dmitry Baryshkov | cb3952b | 2008-07-30 14:46:50 +0400 | [diff] [blame] | 153 | * generic memory areas, or !0 if dma_alloc_coherent should return @ret. |
Dmitry Baryshkov | b6d4f7e | 2008-07-20 15:01:10 +0400 | [diff] [blame] | 154 | */ |
Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 155 | int dma_alloc_from_coherent(struct device *dev, ssize_t size, |
| 156 | dma_addr_t *dma_handle, void **ret) |
| 157 | { |
Andrew Morton | eccd83e | 2009-01-06 14:43:09 -0800 | [diff] [blame] | 158 | struct dma_coherent_mem *mem; |
Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 159 | int order = get_order(size); |
Marek Szyprowski | 7bfa5ab | 2014-10-13 15:51:07 -0700 | [diff] [blame] | 160 | unsigned long flags; |
Andrew Morton | eccd83e | 2009-01-06 14:43:09 -0800 | [diff] [blame] | 161 | int pageno; |
Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 162 | |
Andrew Morton | eccd83e | 2009-01-06 14:43:09 -0800 | [diff] [blame] | 163 | if (!dev) |
| 164 | return 0; |
| 165 | mem = dev->dma_mem; |
| 166 | if (!mem) |
| 167 | return 0; |
Paul Mundt | 0609697 | 2009-01-21 18:51:53 +0900 | [diff] [blame] | 168 | |
| 169 | *ret = NULL; |
Marek Szyprowski | 7bfa5ab | 2014-10-13 15:51:07 -0700 | [diff] [blame] | 170 | spin_lock_irqsave(&mem->spinlock, flags); |
Paul Mundt | 0609697 | 2009-01-21 18:51:53 +0900 | [diff] [blame] | 171 | |
Adrian McMenamin | cdf57ca | 2009-01-21 18:47:38 +0900 | [diff] [blame] | 172 | if (unlikely(size > (mem->size << PAGE_SHIFT))) |
Paul Mundt | 0609697 | 2009-01-21 18:51:53 +0900 | [diff] [blame] | 173 | goto err; |
Andrew Morton | eccd83e | 2009-01-06 14:43:09 -0800 | [diff] [blame] | 174 | |
| 175 | pageno = bitmap_find_free_region(mem->bitmap, mem->size, order); |
Paul Mundt | 0609697 | 2009-01-21 18:51:53 +0900 | [diff] [blame] | 176 | if (unlikely(pageno < 0)) |
| 177 | goto err; |
| 178 | |
| 179 | /* |
| 180 | * Memory was found in the per-device area. |
| 181 | */ |
| 182 | *dma_handle = mem->device_base + (pageno << PAGE_SHIFT); |
| 183 | *ret = mem->virt_base + (pageno << PAGE_SHIFT); |
| 184 | memset(*ret, 0, size); |
Marek Szyprowski | 7bfa5ab | 2014-10-13 15:51:07 -0700 | [diff] [blame] | 185 | spin_unlock_irqrestore(&mem->spinlock, flags); |
Paul Mundt | 0609697 | 2009-01-21 18:51:53 +0900 | [diff] [blame] | 186 | |
Andrew Morton | eccd83e | 2009-01-06 14:43:09 -0800 | [diff] [blame] | 187 | return 1; |
Paul Mundt | 0609697 | 2009-01-21 18:51:53 +0900 | [diff] [blame] | 188 | |
| 189 | err: |
Marek Szyprowski | 7bfa5ab | 2014-10-13 15:51:07 -0700 | [diff] [blame] | 190 | spin_unlock_irqrestore(&mem->spinlock, flags); |
Paul Mundt | 0609697 | 2009-01-21 18:51:53 +0900 | [diff] [blame] | 191 | /* |
| 192 | * In the case where the allocation can not be satisfied from the |
| 193 | * per-device area, try to fall back to generic memory if the |
| 194 | * constraints allow it. |
| 195 | */ |
| 196 | return mem->flags & DMA_MEMORY_EXCLUSIVE; |
Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 197 | } |
Ingo Molnar | a38409f | 2008-08-20 12:16:09 +0200 | [diff] [blame] | 198 | EXPORT_SYMBOL(dma_alloc_from_coherent); |
Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 199 | |
Dmitry Baryshkov | b6d4f7e | 2008-07-20 15:01:10 +0400 | [diff] [blame] | 200 | /** |
Dmitry Baryshkov | cb3952b | 2008-07-30 14:46:50 +0400 | [diff] [blame] | 201 | * dma_release_from_coherent() - try to free the memory allocated from per-device coherent memory pool |
Dmitry Baryshkov | b6d4f7e | 2008-07-20 15:01:10 +0400 | [diff] [blame] | 202 | * @dev: device from which the memory was allocated |
| 203 | * @order: the order of pages allocated |
| 204 | * @vaddr: virtual address of allocated pages |
| 205 | * |
| 206 | * This checks whether the memory was allocated from the per-device |
| 207 | * coherent memory pool and if so, releases that memory. |
| 208 | * |
| 209 | * Returns 1 if we correctly released the memory, or 0 if |
Dmitry Baryshkov | cb3952b | 2008-07-30 14:46:50 +0400 | [diff] [blame] | 210 | * dma_release_coherent() should proceed with releasing memory from |
Dmitry Baryshkov | b6d4f7e | 2008-07-20 15:01:10 +0400 | [diff] [blame] | 211 | * generic pools. |
| 212 | */ |
Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 213 | int dma_release_from_coherent(struct device *dev, int order, void *vaddr) |
| 214 | { |
| 215 | struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL; |
| 216 | |
| 217 | if (mem && vaddr >= mem->virt_base && vaddr < |
| 218 | (mem->virt_base + (mem->size << PAGE_SHIFT))) { |
| 219 | int page = (vaddr - mem->virt_base) >> PAGE_SHIFT; |
Marek Szyprowski | 7bfa5ab | 2014-10-13 15:51:07 -0700 | [diff] [blame] | 220 | unsigned long flags; |
Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 221 | |
Marek Szyprowski | 7bfa5ab | 2014-10-13 15:51:07 -0700 | [diff] [blame] | 222 | spin_lock_irqsave(&mem->spinlock, flags); |
Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 223 | bitmap_release_region(mem->bitmap, page, order); |
Marek Szyprowski | 7bfa5ab | 2014-10-13 15:51:07 -0700 | [diff] [blame] | 224 | spin_unlock_irqrestore(&mem->spinlock, flags); |
Dmitry Baryshkov | ee7e551 | 2008-06-29 14:18:46 +0400 | [diff] [blame] | 225 | return 1; |
| 226 | } |
| 227 | return 0; |
| 228 | } |
Ingo Molnar | a38409f | 2008-08-20 12:16:09 +0200 | [diff] [blame] | 229 | EXPORT_SYMBOL(dma_release_from_coherent); |
Marek Szyprowski | bca0fa5 | 2012-03-23 13:05:14 +0100 | [diff] [blame] | 230 | |
| 231 | /** |
| 232 | * dma_mmap_from_coherent() - try to mmap the memory allocated from |
| 233 | * per-device coherent memory pool to userspace |
| 234 | * @dev: device from which the memory was allocated |
| 235 | * @vma: vm_area for the userspace memory |
| 236 | * @vaddr: cpu address returned by dma_alloc_from_coherent |
| 237 | * @size: size of the memory buffer allocated by dma_alloc_from_coherent |
Randy Dunlap | 6e7b4a5 | 2012-06-09 15:02:59 -0700 | [diff] [blame] | 238 | * @ret: result from remap_pfn_range() |
Marek Szyprowski | bca0fa5 | 2012-03-23 13:05:14 +0100 | [diff] [blame] | 239 | * |
| 240 | * This checks whether the memory was allocated from the per-device |
| 241 | * coherent memory pool and if so, maps that memory to the provided vma. |
| 242 | * |
Laurent Pinchart | ba4d93b | 2012-10-18 09:29:44 +0200 | [diff] [blame] | 243 | * Returns 1 if we correctly mapped the memory, or 0 if the caller should |
| 244 | * proceed with mapping memory from generic pools. |
Marek Szyprowski | bca0fa5 | 2012-03-23 13:05:14 +0100 | [diff] [blame] | 245 | */ |
| 246 | int dma_mmap_from_coherent(struct device *dev, struct vm_area_struct *vma, |
| 247 | void *vaddr, size_t size, int *ret) |
| 248 | { |
| 249 | struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL; |
| 250 | |
| 251 | if (mem && vaddr >= mem->virt_base && vaddr + size <= |
| 252 | (mem->virt_base + (mem->size << PAGE_SHIFT))) { |
| 253 | unsigned long off = vma->vm_pgoff; |
| 254 | int start = (vaddr - mem->virt_base) >> PAGE_SHIFT; |
| 255 | int user_count = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; |
| 256 | int count = size >> PAGE_SHIFT; |
| 257 | |
| 258 | *ret = -ENXIO; |
| 259 | if (off < count && user_count <= count - off) { |
Bjorn Helgaas | 88a984b | 2014-05-20 16:54:22 -0600 | [diff] [blame] | 260 | unsigned long pfn = mem->pfn_base + start + off; |
Marek Szyprowski | bca0fa5 | 2012-03-23 13:05:14 +0100 | [diff] [blame] | 261 | *ret = remap_pfn_range(vma, vma->vm_start, pfn, |
| 262 | user_count << PAGE_SHIFT, |
| 263 | vma->vm_page_prot); |
| 264 | } |
| 265 | return 1; |
| 266 | } |
| 267 | return 0; |
| 268 | } |
| 269 | EXPORT_SYMBOL(dma_mmap_from_coherent); |
Marek Szyprowski | 7bfa5ab | 2014-10-13 15:51:07 -0700 | [diff] [blame] | 270 | |
| 271 | /* |
| 272 | * Support for reserved memory regions defined in device tree |
| 273 | */ |
| 274 | #ifdef CONFIG_OF_RESERVED_MEM |
| 275 | #include <linux/of.h> |
| 276 | #include <linux/of_fdt.h> |
| 277 | #include <linux/of_reserved_mem.h> |
| 278 | |
| 279 | static int rmem_dma_device_init(struct reserved_mem *rmem, struct device *dev) |
| 280 | { |
| 281 | struct dma_coherent_mem *mem = rmem->priv; |
| 282 | |
| 283 | if (!mem && |
| 284 | dma_init_coherent_memory(rmem->base, rmem->base, rmem->size, |
| 285 | DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE, |
| 286 | &mem) != DMA_MEMORY_MAP) { |
| 287 | pr_err("Reserved memory: failed to init DMA memory pool at %pa, size %ld MiB\n", |
| 288 | &rmem->base, (unsigned long)rmem->size / SZ_1M); |
| 289 | return -ENODEV; |
| 290 | } |
| 291 | rmem->priv = mem; |
| 292 | dma_assign_coherent_memory(dev, mem); |
| 293 | return 0; |
| 294 | } |
| 295 | |
| 296 | static void rmem_dma_device_release(struct reserved_mem *rmem, |
| 297 | struct device *dev) |
| 298 | { |
| 299 | dev->dma_mem = NULL; |
| 300 | } |
| 301 | |
| 302 | static const struct reserved_mem_ops rmem_dma_ops = { |
| 303 | .device_init = rmem_dma_device_init, |
| 304 | .device_release = rmem_dma_device_release, |
| 305 | }; |
| 306 | |
| 307 | static int __init rmem_dma_setup(struct reserved_mem *rmem) |
| 308 | { |
| 309 | unsigned long node = rmem->fdt_node; |
| 310 | |
| 311 | if (of_get_flat_dt_prop(node, "reusable", NULL)) |
| 312 | return -EINVAL; |
| 313 | |
| 314 | #ifdef CONFIG_ARM |
| 315 | if (!of_get_flat_dt_prop(node, "no-map", NULL)) { |
| 316 | pr_err("Reserved memory: regions without no-map are not yet supported\n"); |
| 317 | return -EINVAL; |
| 318 | } |
| 319 | #endif |
| 320 | |
| 321 | rmem->ops = &rmem_dma_ops; |
| 322 | pr_info("Reserved memory: created DMA memory pool at %pa, size %ld MiB\n", |
| 323 | &rmem->base, (unsigned long)rmem->size / SZ_1M); |
| 324 | return 0; |
| 325 | } |
| 326 | RESERVEDMEM_OF_DECLARE(dma, "shared-dma-pool", rmem_dma_setup); |
| 327 | #endif |