linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND][PATCH] drivers: of: of_reserved_mem: fixup the CMA alignment not to affect dma-coherent
@ 2016-05-25  4:29 Jaewon Kim
  2016-05-25 14:38 ` Rob Herring
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jaewon Kim @ 2016-05-25  4:29 UTC (permalink / raw)
  To: robh+dt
  Cc: r64343, m.szyprowski, grant.likely, linux-kernel, linux-mm,
	jaewon31.kim, Jaewon

From: Jaewon <jaewon31.kim@samsung.com>

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

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [RESEND][PATCH] drivers: of: of_reserved_mem: fixup the CMA alignment not to affect dma-coherent
  2016-05-25  4:29 [RESEND][PATCH] drivers: of: of_reserved_mem: fixup the CMA alignment not to affect dma-coherent Jaewon Kim
@ 2016-05-25 14:38 ` Rob Herring
  2016-05-27  7:56   ` Marek Szyprowski
  2016-05-31 11:53 ` Jason Liu
  2016-06-03 12:23 ` Rob Herring
  2 siblings, 1 reply; 5+ messages in thread
From: Rob Herring @ 2016-05-25 14:38 UTC (permalink / raw)
  To: Jaewon Kim
  Cc: r64343, Marek Szyprowski, Grant Likely, linux-kernel, linux-mm,
	jaewon31.kim

On Tue, May 24, 2016 at 11:29 PM, Jaewon Kim <jaewon31.kim@samsung.com> wrote:
> From: Jaewon <jaewon31.kim@samsung.com>
>
> 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>

I suppose this needs to go to stable? If so, adding the stable tag and
kernel version would be nice so I don't have to.

> ---
>  drivers/of/of_reserved_mem.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

I'm looking for an ack from Marek on this.

Rob

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RESEND][PATCH] drivers: of: of_reserved_mem: fixup the CMA alignment not to affect dma-coherent
  2016-05-25 14:38 ` Rob Herring
@ 2016-05-27  7:56   ` Marek Szyprowski
  0 siblings, 0 replies; 5+ messages in thread
From: Marek Szyprowski @ 2016-05-27  7:56 UTC (permalink / raw)
  To: Rob Herring, Jaewon Kim
  Cc: r64343, Grant Likely, linux-kernel, linux-mm, jaewon31.kim

Hello,


On 2016-05-25 16:38, Rob Herring wrote:
> On Tue, May 24, 2016 at 11:29 PM, Jaewon Kim <jaewon31.kim@samsung.com> wrote:
>> From: Jaewon <jaewon31.kim@samsung.com>
>>
>> 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>
> I suppose this needs to go to stable? If so, adding the stable tag and
> kernel version would be nice so I don't have to.
>
>> ---
>>   drivers/of/of_reserved_mem.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
> I'm looking for an ack from Marek on this.

Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RESEND][PATCH] drivers: of: of_reserved_mem: fixup the CMA alignment not to affect dma-coherent
  2016-05-25  4:29 [RESEND][PATCH] drivers: of: of_reserved_mem: fixup the CMA alignment not to affect dma-coherent Jaewon Kim
  2016-05-25 14:38 ` Rob Herring
@ 2016-05-31 11:53 ` Jason Liu
  2016-06-03 12:23 ` Rob Herring
  2 siblings, 0 replies; 5+ messages in thread
From: Jason Liu @ 2016-05-31 11:53 UTC (permalink / raw)
  To: Jaewon Kim
  Cc: robh+dt, Jason Liu, m.szyprowski, Grant Likely, LKML, linux-mm,
	jaewon31.kim

2016-05-25 12:29 GMT+08:00 Jaewon Kim <jaewon31.kim@samsung.com>:
> From: Jaewon <jaewon31.kim@samsung.com>
>
> 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>
> ---
>  drivers/of/of_reserved_mem.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>

Acked-by: Jason Liu <r64343@freescale.com>


Jason Liu

> 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
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RESEND][PATCH] drivers: of: of_reserved_mem: fixup the CMA alignment not to affect dma-coherent
  2016-05-25  4:29 [RESEND][PATCH] drivers: of: of_reserved_mem: fixup the CMA alignment not to affect dma-coherent Jaewon Kim
  2016-05-25 14:38 ` Rob Herring
  2016-05-31 11:53 ` Jason Liu
@ 2016-06-03 12:23 ` Rob Herring
  2 siblings, 0 replies; 5+ messages in thread
From: Rob Herring @ 2016-06-03 12:23 UTC (permalink / raw)
  To: Jaewon Kim
  Cc: r64343, Marek Szyprowski, Grant Likely, linux-kernel, linux-mm,
	Jaewon Kim

On Tue, May 24, 2016 at 11:29 PM, Jaewon Kim <jaewon31.kim@samsung.com> wrote:
> From: Jaewon <jaewon31.kim@samsung.com>
>
> 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>
> ---
>  drivers/of/of_reserved_mem.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> 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)) {

This won't actually compile as you add a bracket here, but no closing bracket...

I've fixed up and applied.

>                 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
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-06-03 12:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-25  4:29 [RESEND][PATCH] drivers: of: of_reserved_mem: fixup the CMA alignment not to affect dma-coherent Jaewon Kim
2016-05-25 14:38 ` Rob Herring
2016-05-27  7:56   ` Marek Szyprowski
2016-05-31 11:53 ` Jason Liu
2016-06-03 12:23 ` Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).