Skip to content

Commit 35bd44f

Browse files
committed
arm64: dts: ccimx8mm: add dynamic CMA and GPU memory sizing
Add support for dynamic CMA and GPU memory reservation based on total RAM. This update fixes the Vivante GPU driver failing to load on 4 GiB RAM devices when CMA is allocated near the end of RAM. The CMA range table now allocates around the 2 GiB address. https://onedigi.atlassian.net/browse/DEL-9575 Signed-off-by: Javier Viguera <javier.viguera@digi.com>
1 parent a316f08 commit 35bd44f

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

arch/arm64/boot/dts/digi/ccimx8mm-dvk.dts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,20 @@
298298
};
299299

300300
&gpu {
301+
/*
302+
* Use a table to set a fixed amount of contiguous memory used by the GPU
303+
* per memory configuration. This way we leave plenty of room for the
304+
* other system features when the memory is limited. The table's rows must
305+
* be in increasing RAM order. The GPU CMA should always be smaller than the
306+
* total CMA (see the table in the "reserved-memory" node to see the total CMA
307+
* values per memory configuration).
308+
*/
309+
digi,contiguous-size-table = <
310+
/* RAM CMA*/
311+
0x0 0x40000000 0x0 0x08000000 /* 1 GB variants -> 128 MB of GPU CMA */
312+
0x0 0x80000000 0x0 0x10000000 /* 2 GB variants -> 256 MB of GPU CMA */
313+
0x1 0x00000000 0x0 0x20000000 /* 4 GB variants -> 512 MB of GPU CMA */
314+
>;
301315
status = "okay";
302316
};
303317

arch/arm64/boot/dts/digi/ccimx8mm.dtsi

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,20 @@
108108
ranges;
109109

110110
linux,cma {
111+
compatible = "shared-dma-pool";
112+
reusable;
113+
/* Fallback size in case "digi,size-table" fails to parse */
114+
size = <0 0x14000000>;
115+
alloc-ranges =
116+
<0 0x6A000000 0 0x14000000>,
117+
<0 0x80000000 0 0x50000000>;
118+
linux,cma-default;
111119
digi,size-table = <
112-
/* RAM CMA*/
113-
0x0 0x20000000 0x0 0x6000000 /* 512 MB variants -> 96 MB of CMA */
114-
0x0 0x40000000 0x0 0x14000000 /* 1 GB variants -> 320 MB of CMA */
115-
0x0 0x80000000 0x0 0x28000000 /* 2 GB variants -> 640 MB of CMA */
116-
0x1 0x00000000 0x0 0x50000000 /* 4 GB variants -> 1280 MB of CMA */
120+
/* RAM CMA */
121+
0x0 0x40000000 0x0 0x14000000 /* 1 GB variants -> 320 MB of CMA */
122+
0x0 0x80000000 0x0 0x28000000 /* 2 GB variants -> 640 MB of CMA */
123+
0x1 0x00000000 0x0 0x50000000 /* 4 GB variants -> 1280 MB of CMA */
117124
>;
118-
/delete-property/ alloc-ranges;
119125
};
120126
};
121127

0 commit comments

Comments
 (0)