Skip to contentSkip to conversation

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

PATCH RESEND In review Jaewon Kim 5 participants 6 messages May 25, 2016 – Jun 3, 2016

Subsystems (2)
lore
Share & tools
lore

Jaewon Kim

author
#0 lore raw

PATCH RESEND 1/1 drivers: of: of_reserved_mem: fixup the CMA alignment not to affect dma-coherent

From: Jaewon <[email protected]>

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.

---
 drivers/of/of_reserved_mem.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/of/of_reserved_mem.c +4 -1
index ed01c01..45b873e 100644
@@ -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);
Signature · 7 lines
1.9.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#1 lore raw
Quoted 10 lines · Jaewon Kim

From: Jaewon <[email protected]>

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.

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.

Quoted 3 lines
---
 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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#2 lore raw

Hello,

Quoted 10 lines · Rob Herring
Quoted 9 lines · Jaewon Kim

From: Jaewon <[email protected]>

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.

Quoted 8 lines
Quoted 1 line

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.

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

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

Best regards

Signature · 8 lines
Marek Szyprowski, PhD
Samsung R&D Institute Poland

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#3 lore raw
In reply to Jaewon Kim

DQotLS0tLdPKvP7Urbz+LS0tLS0NCreivP7IyzogSmFld29uIEtpbSBbbWFpbHRvOmphZXdvbjMx LmtpbUBzYW1zdW5nLmNvbV0gDQq3osvNyrG85DogMjAxNsTqNdTCMjXI1SAxMjozMA0KytW8/sjL OiByb2JoK2R0QGtlcm5lbC5vcmcNCrOty806IHI2NDM0M0BmcmVlc2NhbGUuY29tOyBtLnN6eXBy b3dza2lAc2Ftc3VuZy5jb207IGdyYW50Lmxpa2VseUBsaW5hcm8ub3JnO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jEuOS4xDQoN Cg==

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

Acked-by on v1 1/1
#4 lore raw
In reply to Jaewon Kim

2016-05-25 12:29 GMT+08:00 Jaewon Kim <[email protected]>:

Quoted 7 lines

From: Jaewon <[email protected]>

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.

Quoted 7 lines

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

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

Jason Liu

Quoted 17 lines
drivers/of/of_reserved_mem.c +4 -2
index ed01c01..45b873e 100644
@@ -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);
--
Quoted 2 lines

1.9.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#5 lore raw
In reply to Jaewon Kim
Quoted 19 lines · Jaewon Kim

From: Jaewon <[email protected]>

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.

---
 drivers/of/of_reserved_mem.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/of/of_reserved_mem.c +0 -0
index ed01c01..45b873e 100644

drivers/of/of_reserved_mem.c static int __init __reserved_mem_alloc_size(unsigned long node, · line 133

Quoted 8 lines
drivers/of/of_reserved_mem.c +4 -1
@@ -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.

Quoted 6 lines
drivers/of/of_reserved_mem.c +0 -1
                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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>