MGS-4716 [#imx-1412] redirect cma limit request with dma32
authorXianzhong <xianzhong.li@nxp.com>
Thu, 18 Apr 2019 15:38:43 +0000 (23:38 +0800)
committerXianzhong <xianzhong.li@nxp.com>
Fri, 19 Apr 2019 16:50:35 +0000 (00:50 +0800)
L4.19 kernel support CONFIG_ZONE_DMA32 feature, which is
better to allocate 4G memory than CMA limit feature.

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c

index 0e8f386..2c4aec3 100644 (file)
@@ -3103,6 +3103,15 @@ gckOS_AllocatePagedMemory(
         gcmkONERROR(gcvSTATUS_OUT_OF_MEMORY);
     }
 
+#if defined(CONFIG_ZONE_DMA32) && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)
+    /* redirect DMA32 pool for CMA LIMIT request */
+    if (Flag & gcvALLOC_FLAG_CMA_LIMIT)
+    {
+        Flag &= ~gcvALLOC_FLAG_CMA_LIMIT;
+        Flag |= gcvALLOC_FLAG_4GB_ADDR;
+    }
+#endif
+
     if (Os->allocatorLimitMarker && (Flag & gcvALLOC_FLAG_CMA_LIMIT))
     {
         Flag &= ~gcvALLOC_FLAG_CACHEABLE;