[PATCH v3 11/12] arm64: dts: imx8q: add linux,cma node for imx8qm-mek and imx8qxp-mek

Frank Li posted 12 patches 12 months ago
There is a newer version of this series
[PATCH v3 11/12] arm64: dts: imx8q: add linux,cma node for imx8qm-mek and imx8qxp-mek
Posted by Frank Li 12 months ago
Add linux,cma node because some devices, such as camera, need big continue
physical memory.

Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
change from v1 to v3
- none
---
 arch/arm64/boot/dts/freescale/imx8qm-mek.dts  | 9 +++++++++
 arch/arm64/boot/dts/freescale/imx8qxp-mek.dts | 8 ++++++++
 2 files changed, 17 insertions(+)

diff --git a/arch/arm64/boot/dts/freescale/imx8qm-mek.dts b/arch/arm64/boot/dts/freescale/imx8qm-mek.dts
index 50fd3370f7dce..61ef00f4259e1 100644
--- a/arch/arm64/boot/dts/freescale/imx8qm-mek.dts
+++ b/arch/arm64/boot/dts/freescale/imx8qm-mek.dts
@@ -113,6 +113,15 @@ dsp_vdev0buffer: memory@94300000 {
 			reg = <0 0x94300000 0 0x100000>;
 			no-map;
 		};
+
+		/* global autoconfigured region for contiguous allocations */
+		linux,cma {
+			compatible = "shared-dma-pool";
+			alloc-ranges = <0 0xc0000000 0 0x3c000000>;
+			size = <0 0x3c000000>;
+			linux,cma-default;
+			reusable;
+		};
 	};
 
 	lvds_backlight0: backlight-lvds0 {
diff --git a/arch/arm64/boot/dts/freescale/imx8qxp-mek.dts b/arch/arm64/boot/dts/freescale/imx8qxp-mek.dts
index be79c793213a5..89c6516c5ba90 100644
--- a/arch/arm64/boot/dts/freescale/imx8qxp-mek.dts
+++ b/arch/arm64/boot/dts/freescale/imx8qxp-mek.dts
@@ -56,6 +56,14 @@ dsp_vdev0buffer: memory@94300000 {
 			reg = <0 0x94300000 0 0x100000>;
 			no-map;
 		};
+
+		linux,cma {
+			compatible = "shared-dma-pool";
+			alloc-ranges = <0 0xc0000000 0 0x3c000000>;
+			size = <0 0x3c000000>;
+			linux,cma-default;
+			reusable;
+		};
 	};
 
 	reg_usdhc2_vmmc: usdhc2-vmmc {

-- 
2.34.1
Re: [PATCH v3 11/12] arm64: dts: imx8q: add linux,cma node for imx8qm-mek and imx8qxp-mek
Posted by Laurent Pinchart 10 months, 2 weeks ago
Hi Frank,

Thank you for the patch.

On Mon, Feb 10, 2025 at 03:59:30PM -0500, Frank Li wrote:
> Add linux,cma node because some devices, such as camera, need big continue
> physical memory.
> 
> Signed-off-by: Frank Li <Frank.Li@nxp.com>
> ---
> change from v1 to v3
> - none
> ---
>  arch/arm64/boot/dts/freescale/imx8qm-mek.dts  | 9 +++++++++
>  arch/arm64/boot/dts/freescale/imx8qxp-mek.dts | 8 ++++++++
>  2 files changed, 17 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/freescale/imx8qm-mek.dts b/arch/arm64/boot/dts/freescale/imx8qm-mek.dts
> index 50fd3370f7dce..61ef00f4259e1 100644
> --- a/arch/arm64/boot/dts/freescale/imx8qm-mek.dts
> +++ b/arch/arm64/boot/dts/freescale/imx8qm-mek.dts
> @@ -113,6 +113,15 @@ dsp_vdev0buffer: memory@94300000 {
>  			reg = <0 0x94300000 0 0x100000>;
>  			no-map;
>  		};
> +
> +		/* global autoconfigured region for contiguous allocations */
> +		linux,cma {
> +			compatible = "shared-dma-pool";
> +			alloc-ranges = <0 0xc0000000 0 0x3c000000>;
> +			size = <0 0x3c000000>;
> +			linux,cma-default;
> +			reusable;
> +		};

This is system memory. Why is it reserved here, hardcoding a specific
use case in a board DT, instead of specifying an overall CMA size in the
kernel configuration or through the kernel command line ?

>  	};
>  
>  	lvds_backlight0: backlight-lvds0 {
> diff --git a/arch/arm64/boot/dts/freescale/imx8qxp-mek.dts b/arch/arm64/boot/dts/freescale/imx8qxp-mek.dts
> index be79c793213a5..89c6516c5ba90 100644
> --- a/arch/arm64/boot/dts/freescale/imx8qxp-mek.dts
> +++ b/arch/arm64/boot/dts/freescale/imx8qxp-mek.dts
> @@ -56,6 +56,14 @@ dsp_vdev0buffer: memory@94300000 {
>  			reg = <0 0x94300000 0 0x100000>;
>  			no-map;
>  		};
> +
> +		linux,cma {
> +			compatible = "shared-dma-pool";
> +			alloc-ranges = <0 0xc0000000 0 0x3c000000>;
> +			size = <0 0x3c000000>;
> +			linux,cma-default;
> +			reusable;
> +		};
>  	};
>  
>  	reg_usdhc2_vmmc: usdhc2-vmmc {

-- 
Regards,

Laurent Pinchart
Re: [PATCH v3 11/12] arm64: dts: imx8q: add linux,cma node for imx8qm-mek and imx8qxp-mek
Posted by Frank Li 10 months, 2 weeks ago
On Thu, Mar 27, 2025 at 09:00:37PM +0200, Laurent Pinchart wrote:
> Hi Frank,
>
> Thank you for the patch.
>
> On Mon, Feb 10, 2025 at 03:59:30PM -0500, Frank Li wrote:
> > Add linux,cma node because some devices, such as camera, need big continue
> > physical memory.
> >
> > Signed-off-by: Frank Li <Frank.Li@nxp.com>
> > ---
> > change from v1 to v3
> > - none
> > ---
> >  arch/arm64/boot/dts/freescale/imx8qm-mek.dts  | 9 +++++++++
> >  arch/arm64/boot/dts/freescale/imx8qxp-mek.dts | 8 ++++++++
> >  2 files changed, 17 insertions(+)
> >
> > diff --git a/arch/arm64/boot/dts/freescale/imx8qm-mek.dts b/arch/arm64/boot/dts/freescale/imx8qm-mek.dts
> > index 50fd3370f7dce..61ef00f4259e1 100644
> > --- a/arch/arm64/boot/dts/freescale/imx8qm-mek.dts
> > +++ b/arch/arm64/boot/dts/freescale/imx8qm-mek.dts
> > @@ -113,6 +113,15 @@ dsp_vdev0buffer: memory@94300000 {
> >  			reg = <0 0x94300000 0 0x100000>;
> >  			no-map;
> >  		};
> > +
> > +		/* global autoconfigured region for contiguous allocations */
> > +		linux,cma {
> > +			compatible = "shared-dma-pool";
> > +			alloc-ranges = <0 0xc0000000 0 0x3c000000>;
> > +			size = <0 0x3c000000>;
> > +			linux,cma-default;
> > +			reusable;
> > +		};
>
> This is system memory. Why is it reserved here, hardcoding a specific
> use case in a board DT, instead of specifying an overall CMA size in the
> kernel configuration or through the kernel command line ?

Other imx boards dts also have linux,cma, which provide a default CMA size.
Generally we use one linux kernel image for difference boards. DTS should
provide default cma value for specific board.

kernel command line is more like debug methods. we don't want to depend on
uboot too much.

Frank

>
> >  	};
> >
> >  	lvds_backlight0: backlight-lvds0 {
> > diff --git a/arch/arm64/boot/dts/freescale/imx8qxp-mek.dts b/arch/arm64/boot/dts/freescale/imx8qxp-mek.dts
> > index be79c793213a5..89c6516c5ba90 100644
> > --- a/arch/arm64/boot/dts/freescale/imx8qxp-mek.dts
> > +++ b/arch/arm64/boot/dts/freescale/imx8qxp-mek.dts
> > @@ -56,6 +56,14 @@ dsp_vdev0buffer: memory@94300000 {
> >  			reg = <0 0x94300000 0 0x100000>;
> >  			no-map;
> >  		};
> > +
> > +		linux,cma {
> > +			compatible = "shared-dma-pool";
> > +			alloc-ranges = <0 0xc0000000 0 0x3c000000>;
> > +			size = <0 0x3c000000>;
> > +			linux,cma-default;
> > +			reusable;
> > +		};
> >  	};
> >
> >  	reg_usdhc2_vmmc: usdhc2-vmmc {
>
> --
> Regards,
>
> Laurent Pinchart