Thread (6 messages) 6 messages, 5 authors, 2016-06-03

答复: [RESEND][PATCH] drivers: of: of_reserved_mem: fixup the CMA alignment not to affect dma-coherent

From: Hui Liu <hidden>
Date: 2016-05-30 13:21:09

-----邮件原件-----
发件人: Jaewon Kim [mailto:jaewon31.kim@samsung.com] 
发送时间: 2016年5月25日 12:30
收件人: robh+dt@kernel.org
抄送: r64343@freescale.com; m.szyprowski@samsung.com; grant.likely@linaro.org; linux-kernel@vger.kernel.org; linux-mm@kvack.org; jaewon31.kim@gmail.com; Jaewon [off-list ref]
主题: [RESEND][PATCH] drivers: of: of_reserved_mem: fixup the CMA alignment not to affect dma-coherent

From: Jaewon <redacted>

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 <redacted>
---
 drivers/of/of_reserved_mem.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)


Acked-by: Jason Liu <redacted>

Jason
diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c index ed01c01..45b873e 100644
--- a/drivers/of/of_reserved_mem.c
+++ b/drivers/of/of_reserved_mem.c
@@ -127,7 +127,10 @@ static int __init __reserved_mem_alloc_size(unsigned long node,
 	}
 
 	/* Need adjust the alignment to satisfy the CMA requirement */
-	if (IS_ENABLED(CONFIG_CMA) && of_flat_dt_is_compatible(node, "shared-dma-pool"))
+	if (IS_ENABLED(CONFIG_CMA)
+	    && of_flat_dt_is_compatible(node, "shared-dma-pool")
+	    && of_get_flat_dt_prop(node, "reusable", NULL)
+	    && !of_get_flat_dt_prop(node, "no-map", NULL)) {
 		align = max(align, (phys_addr_t)PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order));
 
 	prop = of_get_flat_dt_prop(node, "alloc-ranges", &len);
--
1.9.1

韬{.n�+�番zwZ��,j���n���笔�m�b��f�)��骅w+h�ㄨ��&�K�rJ+�Z+����w琚r���L2����i��0�XЩΒ�?��zf���ky���[hv��������zf��K�rJ+��
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help