|
25 | 25 | #include <linux/memblock.h>
|
26 | 26 | #include <linux/kmemleak.h>
|
27 | 27 | #include <linux/cma.h>
|
| 28 | +#include <linux/dma-map-ops.h> |
28 | 29 |
|
29 | 30 | #include "of_private.h"
|
30 | 31 |
|
@@ -175,13 +176,17 @@ static int __init __reserved_mem_reserve_reg(unsigned long node,
|
175 | 176 | base = dt_mem_next_cell(dt_root_addr_cells, &prop);
|
176 | 177 | size = dt_mem_next_cell(dt_root_size_cells, &prop);
|
177 | 178 |
|
178 |
| - if (size && |
179 |
| - early_init_dt_reserve_memory(base, size, nomap) == 0) |
| 179 | + if (size && early_init_dt_reserve_memory(base, size, nomap) == 0) { |
| 180 | + /* Architecture specific contiguous memory fixup. */ |
| 181 | + if (of_flat_dt_is_compatible(node, "shared-dma-pool") && |
| 182 | + of_get_flat_dt_prop(node, "reusable", NULL)) |
| 183 | + dma_contiguous_early_fixup(base, size); |
180 | 184 | pr_debug("Reserved memory: reserved region for node '%s': base %pa, size %lu MiB\n",
|
181 | 185 | uname, &base, (unsigned long)(size / SZ_1M));
|
182 |
| - else |
| 186 | + } else { |
183 | 187 | pr_err("Reserved memory: failed to reserve memory for node '%s': base %pa, size %lu MiB\n",
|
184 | 188 | uname, &base, (unsigned long)(size / SZ_1M));
|
| 189 | + } |
185 | 190 |
|
186 | 191 | len -= t_len;
|
187 | 192 | }
|
@@ -472,7 +477,10 @@ static int __init __reserved_mem_alloc_size(unsigned long node, const char *unam
|
472 | 477 | uname, (unsigned long)(size / SZ_1M));
|
473 | 478 | return -ENOMEM;
|
474 | 479 | }
|
475 |
| - |
| 480 | + /* Architecture specific contiguous memory fixup. */ |
| 481 | + if (of_flat_dt_is_compatible(node, "shared-dma-pool") && |
| 482 | + of_get_flat_dt_prop(node, "reusable", NULL)) |
| 483 | + dma_contiguous_early_fixup(base, size); |
476 | 484 | /* Save region in the reserved_mem array */
|
477 | 485 | fdt_reserved_mem_save_node(node, uname, base, size);
|
478 | 486 | return 0;
|
|
0 commit comments