mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/4] Add global CMA areas for few TI SoCs
@ 2025-04-24  8:44 Jayesh Choudhary
  2025-04-24  8:44 ` [PATCH 1/4] arm64: dts: ti: k3-j721s2-som-p0: Reserve 1056MiB of global CMA Jayesh Choudhary
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Jayesh Choudhary @ 2025-04-24  8:44 UTC (permalink / raw)
  To: nm, vigneshr, linux-kernel
  Cc: robh, krzk+dt, conor+dt, kristo, u-kumar1, devicetree,
	linux-arm-kernel, devarsht, j-choudhary

Hello All,

Following AM62* platforms[0], this patches add global CMA reserve area for:
- J721S2-EVM (1056 MiB)
- J784S4-EVM (1920 MiB)
- AM68-SK (1008 MiB)
- AM69-SK (1904 MiB)

These SoCs does not have MMU and hence they require contiguous memory
pool to support various multimedia usecase.

The calculation was done considering H264 codec requirements, dual-display
supported in each platforms and multicamera use-cases.
Additional buffer was kept for other peripheral s and to account for
fragmentation.
The breakdown is mentioned in each commit message.

[0]: https://lore.kernel.org/all/20240613150902.2173582-1-devarsht@ti.com/

Jayesh Choudhary (4):
  arm64: dts: ti: k3-j721s2-som-p0: Reserve 1056MiB of global CMA
  arm64: dts: ti: k3-j784s4-j742s2-evm-common: Reserve 1920MiB of global
    CMA
  arm64: dts: ti: k3-am68-sk-som: Reserve 1008MiB of global CMA
  arm64: dts: ti: k3-am69-sk: Reserve 1904MiB of global CMA

 arch/arm64/boot/dts/ti/k3-am68-sk-som.dtsi              | 8 ++++++++
 arch/arm64/boot/dts/ti/k3-am69-sk.dts                   | 8 ++++++++
 arch/arm64/boot/dts/ti/k3-j721s2-som-p0.dtsi            | 8 ++++++++
 arch/arm64/boot/dts/ti/k3-j784s4-j742s2-evm-common.dtsi | 8 ++++++++
 4 files changed, 32 insertions(+)

-- 
2.34.1


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

* [PATCH 1/4] arm64: dts: ti: k3-j721s2-som-p0: Reserve 1056MiB of global CMA
  2025-04-24  8:44 [PATCH 0/4] Add global CMA areas for few TI SoCs Jayesh Choudhary
@ 2025-04-24  8:44 ` Jayesh Choudhary
  2025-04-24  8:44 ` [PATCH 2/4] arm64: dts: ti: k3-j784s4-j742s2-evm-common: Reserve 1920MiB " Jayesh Choudhary
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Jayesh Choudhary @ 2025-04-24  8:44 UTC (permalink / raw)
  To: nm, vigneshr, linux-kernel
  Cc: robh, krzk+dt, conor+dt, kristo, u-kumar1, devicetree,
	linux-arm-kernel, devarsht, j-choudhary

Reserve 1056MiB of global CMA pool which is also marked as re-usable
so that OS can also use this region if peripheral drivers are not
using it.

J721S2 has different multimedia components such as Camera, Dual-
Display and H264 Video Codec which uses CMA for buffer allocations.
Assuming the worst case scenario where all three run in parallel,
below is the calculation:

1) IMX390 camera sensor 1920x1080
-> 1920 width x 1080 height x 2 bytesperpixel x 4 buffers :
   15.820 MiB which is ~16MiB
   J721S2 can support 8 cameras so ~128MiB

2) 3840x2160@30fps MHDP via DisplayPort0
-> 3840 width x 2160 height x 4 bytesperpixel x 2 buffers :
   63.281 MiB which is ~64 MiB

3) 2560x1440@60fps DSI via DisplayPort1
-> 2560 width x 1440 height x 4 bytesperpixel x 2 buffers :
   28.125 MiB which is ~29 MiB

4) H264 Video Codec 1920x1080 resolution:
-> For 1080p resolution codec application, we require ~98-100 MiB
   per channel. We require ~800MiB for 8 channel codec application.

Total comes about 1021MiB. Adding 32MiB for other peripherals and
and additional 3MiB for rounding it off to 1056MiB.

Signed-off-by: Jayesh Choudhary <j-choudhary@ti.com>
---
 arch/arm64/boot/dts/ti/k3-j721s2-som-p0.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm64/boot/dts/ti/k3-j721s2-som-p0.dtsi b/arch/arm64/boot/dts/ti/k3-j721s2-som-p0.dtsi
index 54fc5c4f8c3f..2d67fc4bd018 100644
--- a/arch/arm64/boot/dts/ti/k3-j721s2-som-p0.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-j721s2-som-p0.dtsi
@@ -25,6 +25,14 @@ reserved_memory: reserved-memory {
 		#size-cells = <2>;
 		ranges;
 
+		/* global cma region */
+		linux,cma {
+			compatible = "shared-dma-pool";
+			reusable;
+			size = <0x00 0x42000000>;
+			linux,cma-default;
+		};
+
 		secure_ddr: optee@9e800000 {
 			reg = <0x00 0x9e800000 0x00 0x01800000>;
 			alignment = <0x1000>;
-- 
2.34.1


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

* [PATCH 2/4] arm64: dts: ti: k3-j784s4-j742s2-evm-common: Reserve 1920MiB of global CMA
  2025-04-24  8:44 [PATCH 0/4] Add global CMA areas for few TI SoCs Jayesh Choudhary
  2025-04-24  8:44 ` [PATCH 1/4] arm64: dts: ti: k3-j721s2-som-p0: Reserve 1056MiB of global CMA Jayesh Choudhary
@ 2025-04-24  8:44 ` Jayesh Choudhary
  2025-04-24  8:44 ` [PATCH 3/4] arm64: dts: ti: k3-am68-sk-som: Reserve 1008MiB " Jayesh Choudhary
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Jayesh Choudhary @ 2025-04-24  8:44 UTC (permalink / raw)
  To: nm, vigneshr, linux-kernel
  Cc: robh, krzk+dt, conor+dt, kristo, u-kumar1, devicetree,
	linux-arm-kernel, devarsht, j-choudhary

Reserve 1920MiB of global CMA pool which is also marked as re-usable
so that OS can also use this region if peripheral drivers are not
using it.

J784S4 has different multimedia components such as Camera, Dual-
Display and H264 Video Codec which uses CMA for buffer allocations.
Assuming the worst case scenario where all three run in parallel,
below is the calculation:

1) IMX390 camera sensor 1920x1080
-> 1920 width x 1080 height x 2 bytesperpixel x 4 buffers :
   15.820 MiB which is ~16MiB
   J784S4 can support 12 cameras so ~192MiB

2) 3840x2160@60fps MHDP via DisplayPort0
-> 3840 width x 2160 height x 4 bytesperpixel x 2 buffers :
   63.281 MiB which is ~64 MiB

3) 2560x1440@60fps DSI via DisplayPort1
-> 2560 width x 1440 height x 4 bytesperpixel x 2 buffers :
   28.125 MiB which is ~29 MiB

4) H264 Video Codec 1920x1080 resolution:
-> For 1080p resolution codec application, we require ~98-100 MiB
   per channel. We require ~1600MiB for 16 channel codec application.

Total comes about 1885MiB. Adding 32MiB for other peripherals and
and additional 3MiB for rounding it off to 1920MiB.

Signed-off-by: Jayesh Choudhary <j-choudhary@ti.com>
---
 arch/arm64/boot/dts/ti/k3-j784s4-j742s2-evm-common.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm64/boot/dts/ti/k3-j784s4-j742s2-evm-common.dtsi b/arch/arm64/boot/dts/ti/k3-j784s4-j742s2-evm-common.dtsi
index 2664f74a9c7a..33b54afe0a06 100644
--- a/arch/arm64/boot/dts/ti/k3-j784s4-j742s2-evm-common.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-j784s4-j742s2-evm-common.dtsi
@@ -27,6 +27,14 @@ reserved_memory: reserved-memory {
 		#size-cells = <2>;
 		ranges;
 
+		/* global cma region */
+		linux,cma {
+			compatible = "shared-dma-pool";
+			reusable;
+			size = <0x00 0x78000000>;
+			linux,cma-default;
+		};
+
 		secure_ddr: optee@9e800000 {
 			reg = <0x00 0x9e800000 0x00 0x01800000>;
 			no-map;
-- 
2.34.1


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

* [PATCH 3/4] arm64: dts: ti: k3-am68-sk-som: Reserve 1008MiB of global CMA
  2025-04-24  8:44 [PATCH 0/4] Add global CMA areas for few TI SoCs Jayesh Choudhary
  2025-04-24  8:44 ` [PATCH 1/4] arm64: dts: ti: k3-j721s2-som-p0: Reserve 1056MiB of global CMA Jayesh Choudhary
  2025-04-24  8:44 ` [PATCH 2/4] arm64: dts: ti: k3-j784s4-j742s2-evm-common: Reserve 1920MiB " Jayesh Choudhary
@ 2025-04-24  8:44 ` Jayesh Choudhary
  2025-04-24  8:44 ` [PATCH 4/4] arm64: dts: ti: k3-am69-sk: Reserve 1904MiB " Jayesh Choudhary
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Jayesh Choudhary @ 2025-04-24  8:44 UTC (permalink / raw)
  To: nm, vigneshr, linux-kernel
  Cc: robh, krzk+dt, conor+dt, kristo, u-kumar1, devicetree,
	linux-arm-kernel, devarsht, j-choudhary

Reserve 1008MiB of global CMA pool which is also marked as re-usable
so that OS can also use this region if peripheral drivers are not
using it.

AM68-SK has different multimedia components such as Camera, Dual-
Display and H264 Video Codec which uses CMA for buffer allocations.
Assuming the worst case scenario where all three run in parallel,
below is the calculation:

1) IMX390 camera sensor 1920x1080
-> 1920 width x 1080 height x 2 bytesperpixel x 4 buffers :
   15.820 MiB which is ~16MiB
   AM68-SK can support 8 cameras so ~128MiB

2) 1920x1080 HDMI
-> 1920 width x 1080 height x 4 bytesperpixel x 2 buffers :
   15.820 MiB which is ~16MiB

3) 2560x1440@60fps DSI via DisplayPort0
-> 2560 width x 1440 height x 4 bytesperpixel x 2 buffers :
   28.125 MiB which is ~29 MiB

4) H264 Video Codec 1920x1080 resolution:
-> For 1080p resolution codec application, we require ~98-100 MiB
   per channel. We require ~800MiB for 8 channel codec application.

Total comes about 973MiB. Adding 32MiB for other peripherals and
and additional 3MiB for rounding it off to 1008MiB.

Signed-off-by: Jayesh Choudhary <j-choudhary@ti.com>
---
 arch/arm64/boot/dts/ti/k3-am68-sk-som.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm64/boot/dts/ti/k3-am68-sk-som.dtsi b/arch/arm64/boot/dts/ti/k3-am68-sk-som.dtsi
index 4ca2d4e2fb9b..2b02575549eb 100644
--- a/arch/arm64/boot/dts/ti/k3-am68-sk-som.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am68-sk-som.dtsi
@@ -22,6 +22,14 @@ reserved_memory: reserved-memory {
 		#size-cells = <2>;
 		ranges;
 
+		/* global cma region */
+		linux,cma {
+			compatible = "shared-dma-pool";
+			reusable;
+			size = <0x00 0x3f000000>;
+			linux,cma-default;
+		};
+
 		secure_ddr: optee@9e800000 {
 			reg = <0x00 0x9e800000 0x00 0x01800000>;
 			no-map;
-- 
2.34.1


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

* [PATCH 4/4] arm64: dts: ti: k3-am69-sk: Reserve 1904MiB of global CMA
  2025-04-24  8:44 [PATCH 0/4] Add global CMA areas for few TI SoCs Jayesh Choudhary
                   ` (2 preceding siblings ...)
  2025-04-24  8:44 ` [PATCH 3/4] arm64: dts: ti: k3-am68-sk-som: Reserve 1008MiB " Jayesh Choudhary
@ 2025-04-24  8:44 ` Jayesh Choudhary
  2025-04-28 14:42 ` [PATCH 0/4] Add global CMA areas for few TI SoCs Andrew Davis
  2025-05-06 14:20 ` Brandon Brnich
  5 siblings, 0 replies; 7+ messages in thread
From: Jayesh Choudhary @ 2025-04-24  8:44 UTC (permalink / raw)
  To: nm, vigneshr, linux-kernel
  Cc: robh, krzk+dt, conor+dt, kristo, u-kumar1, devicetree,
	linux-arm-kernel, devarsht, j-choudhary

Reserve 1904MiB of global CMA pool which is also marked as re-usable
so that OS can also use this region if peripheral drivers are not
using it.

AM69-SK has different multimedia components such as Camera, Dual-
Display and H264 Video Codec which uses CMA for buffer allocations.
Assuming the worst case scenario where all three run in parallel,
below is the calculation:

1) IMX390 camera sensor 1920x1080
-> 1920 width x 1080 height x 2 bytesperpixel x 4 buffers :
   15.820 MiB which is ~16MiB
   AM69-SK can support 12 cameras so ~192MiB

2) 3840x2160@60fps MHDP via DisplayPort0
-> 3840 width x 2160 height x 4 bytesperpixel x 2 buffers :
   63.281 MiB which is ~64 MiB

3) 1920x1080@60fps HDMI
-> 1920 width x 1080 height x 4 bytesperpixel x 2 buffers :
   15.820 MiB which is ~16MiB

4) H264 Video Codec 1920x1080 resolution:
-> For 1080p resolution codec application, we require ~98-100 MiB
   per channel. We require ~1600MiB for 16 channel codec application.

Total comes about 1872MiB. Adding 32MiB for other peripherals to
get 1904MiB.

Signed-off-by: Jayesh Choudhary <j-choudhary@ti.com>
---
 arch/arm64/boot/dts/ti/k3-am69-sk.dts | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm64/boot/dts/ti/k3-am69-sk.dts b/arch/arm64/boot/dts/ti/k3-am69-sk.dts
index b85227052f97..37228ec64852 100644
--- a/arch/arm64/boot/dts/ti/k3-am69-sk.dts
+++ b/arch/arm64/boot/dts/ti/k3-am69-sk.dts
@@ -44,6 +44,14 @@ reserved_memory: reserved-memory {
 		#size-cells = <2>;
 		ranges;
 
+		/* global cma region */
+		linux,cma {
+			compatible = "shared-dma-pool";
+			reusable;
+			size = <0x00 0x77000000>;
+			linux,cma-default;
+		};
+
 		secure_ddr: optee@9e800000 {
 			reg = <0x00 0x9e800000 0x00 0x01800000>;
 			no-map;
-- 
2.34.1


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

* Re: [PATCH 0/4] Add global CMA areas for few TI SoCs
  2025-04-24  8:44 [PATCH 0/4] Add global CMA areas for few TI SoCs Jayesh Choudhary
                   ` (3 preceding siblings ...)
  2025-04-24  8:44 ` [PATCH 4/4] arm64: dts: ti: k3-am69-sk: Reserve 1904MiB " Jayesh Choudhary
@ 2025-04-28 14:42 ` Andrew Davis
  2025-05-06 14:20 ` Brandon Brnich
  5 siblings, 0 replies; 7+ messages in thread
From: Andrew Davis @ 2025-04-28 14:42 UTC (permalink / raw)
  To: Jayesh Choudhary, nm, vigneshr, linux-kernel
  Cc: robh, krzk+dt, conor+dt, kristo, u-kumar1, devicetree,
	linux-arm-kernel, devarsht

On 4/24/25 3:44 AM, Jayesh Choudhary wrote:
> Hello All,
> 
> Following AM62* platforms[0], this patches add global CMA reserve area for:
> - J721S2-EVM (1056 MiB)
> - J784S4-EVM (1920 MiB)
> - AM68-SK (1008 MiB)
> - AM69-SK (1904 MiB)
> 
> These SoCs does not have MMU and hence they require contiguous memory
> pool to support various multimedia usecase.
> 
> The calculation was done considering H264 codec requirements, dual-display
> supported in each platforms and multicamera use-cases.
> Additional buffer was kept for other peripheral s and to account for
> fragmentation.

What if I'm not going to use 8 cameras, 2 displays, and decode 16 H264
streams all at the same time? Why should I always lose 2GB of DRAM
unconditionally, just in-case someone someday runs this imagined
worst-case situation?

If I *do* intend to have my device perform some nightmare use-case like
the above, I can pass the needed CMA size in on the kernel command line.
That is a configuration for my specific use-case after all, and DT is
*not* for configuration, especially not insane configurations like this.

Andrew

> The breakdown is mentioned in each commit message.
> 
> [0]: https://lore.kernel.org/all/20240613150902.2173582-1-devarsht@ti.com/
> 
> Jayesh Choudhary (4):
>    arm64: dts: ti: k3-j721s2-som-p0: Reserve 1056MiB of global CMA
>    arm64: dts: ti: k3-j784s4-j742s2-evm-common: Reserve 1920MiB of global
>      CMA
>    arm64: dts: ti: k3-am68-sk-som: Reserve 1008MiB of global CMA
>    arm64: dts: ti: k3-am69-sk: Reserve 1904MiB of global CMA
> 
>   arch/arm64/boot/dts/ti/k3-am68-sk-som.dtsi              | 8 ++++++++
>   arch/arm64/boot/dts/ti/k3-am69-sk.dts                   | 8 ++++++++
>   arch/arm64/boot/dts/ti/k3-j721s2-som-p0.dtsi            | 8 ++++++++
>   arch/arm64/boot/dts/ti/k3-j784s4-j742s2-evm-common.dtsi | 8 ++++++++
>   4 files changed, 32 insertions(+)
> 

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

* Re: [PATCH 0/4] Add global CMA areas for few TI SoCs
  2025-04-24  8:44 [PATCH 0/4] Add global CMA areas for few TI SoCs Jayesh Choudhary
                   ` (4 preceding siblings ...)
  2025-04-28 14:42 ` [PATCH 0/4] Add global CMA areas for few TI SoCs Andrew Davis
@ 2025-05-06 14:20 ` Brandon Brnich
  5 siblings, 0 replies; 7+ messages in thread
From: Brandon Brnich @ 2025-05-06 14:20 UTC (permalink / raw)
  To: Jayesh Choudhary, nm, vigneshr, linux-kernel
  Cc: robh, krzk+dt, conor+dt, kristo, u-kumar1, devicetree,
	linux-arm-kernel, devarsht, afd

Hi Jayesh

On 4/24/2025 3:44 AM, Jayesh Choudhary wrote:
> Hello All,
> 
> Following AM62* platforms[0], this patches add global CMA reserve area for:
> - J721S2-EVM (1056 MiB)
> - J784S4-EVM (1920 MiB)
> - AM68-SK (1008 MiB)
> - AM69-SK (1904 MiB)
> 
> These SoCs does not have MMU and hence they require contiguous memory
> pool to support various multimedia usecase.

This series will break multimedia support in our tree if accepted. I 
gave a similar response to Devarsh when trying to get CMA carveout 
accepted for AM62p[0]. Essentially, Wave5 still does not have support 
for 48 bit addressing in upstream, so memory allocation still needs to 
happen in 32-bit range. Can we force the memory carveout in this region 
using the alloc-ranges? Devarsh did this with AM62A[1].

Best,
Brandon

[0]: 
https://lore.kernel.org/all/20240614170409.zu4vaatdac4o6w2o@udba0500997/
[1]: https://lore.kernel.org/all/20240613150902.2173582-3-devarsht@ti.com/

> 
> The calculation was done considering H264 codec requirements, dual-display
> supported in each platforms and multicamera use-cases.
> Additional buffer was kept for other peripheral s and to account for
> fragmentation.
> The breakdown is mentioned in each commit message.
> 
> [0]: https://lore.kernel.org/all/20240613150902.2173582-1-devarsht@ti.com/
> 
> Jayesh Choudhary (4):
>    arm64: dts: ti: k3-j721s2-som-p0: Reserve 1056MiB of global CMA
>    arm64: dts: ti: k3-j784s4-j742s2-evm-common: Reserve 1920MiB of global
>      CMA
>    arm64: dts: ti: k3-am68-sk-som: Reserve 1008MiB of global CMA
>    arm64: dts: ti: k3-am69-sk: Reserve 1904MiB of global CMA
> 
>   arch/arm64/boot/dts/ti/k3-am68-sk-som.dtsi              | 8 ++++++++
>   arch/arm64/boot/dts/ti/k3-am69-sk.dts                   | 8 ++++++++
>   arch/arm64/boot/dts/ti/k3-j721s2-som-p0.dtsi            | 8 ++++++++
>   arch/arm64/boot/dts/ti/k3-j784s4-j742s2-evm-common.dtsi | 8 ++++++++
>   4 files changed, 32 insertions(+)
> 


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

end of thread, other threads:[~2025-05-06 14:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-24  8:44 [PATCH 0/4] Add global CMA areas for few TI SoCs Jayesh Choudhary
2025-04-24  8:44 ` [PATCH 1/4] arm64: dts: ti: k3-j721s2-som-p0: Reserve 1056MiB of global CMA Jayesh Choudhary
2025-04-24  8:44 ` [PATCH 2/4] arm64: dts: ti: k3-j784s4-j742s2-evm-common: Reserve 1920MiB " Jayesh Choudhary
2025-04-24  8:44 ` [PATCH 3/4] arm64: dts: ti: k3-am68-sk-som: Reserve 1008MiB " Jayesh Choudhary
2025-04-24  8:44 ` [PATCH 4/4] arm64: dts: ti: k3-am69-sk: Reserve 1904MiB " Jayesh Choudhary
2025-04-28 14:42 ` [PATCH 0/4] Add global CMA areas for few TI SoCs Andrew Davis
2025-05-06 14:20 ` Brandon Brnich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®