Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drivers: of: of_reserved_mem: fixup the CMA alignment not to affect dma-coherent

There was an alignment mismatch issue for CMA and it was fixed by
commit 1cc8e3458b51 ("drivers: of: of_reserved_mem: fixup the alignment with CMA setup").
However the way of the commit considers not only dma-contiguous(CMA) but also
dma-coherent which has no that requirement.

This patch checks more to distinguish dma-contiguous(CMA) from dma-coherent.

Signed-off-by: Jaewon Kim <jaewon31.kim@samsung.com>
Acked-by: Jason Liu <r64343@freescale.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
[robh: remove erroneous opening bracket]
Signed-off-by: Rob Herring <robh@kernel.org>

authored by

Jaewon and committed by
Rob Herring
7d482813 39935466

+4 -1
+4 -1
drivers/of/of_reserved_mem.c
··· 127 127 } 128 128 129 129 /* Need adjust the alignment to satisfy the CMA requirement */ 130 - if (IS_ENABLED(CONFIG_CMA) && of_flat_dt_is_compatible(node, "shared-dma-pool")) 130 + if (IS_ENABLED(CONFIG_CMA) 131 + && of_flat_dt_is_compatible(node, "shared-dma-pool") 132 + && of_get_flat_dt_prop(node, "reusable", NULL) 133 + && !of_get_flat_dt_prop(node, "no-map", NULL)) 131 134 align = max(align, (phys_addr_t)PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order)); 132 135 133 136 prop = of_get_flat_dt_prop(node, "alloc-ranges", &len);