MGS-2485 [#imx-309] fix gpu base address for new mmu version
authorXianzhong <xianzhong.li@nxp.com>
Thu, 16 Feb 2017 03:16:43 +0000 (11:16 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:10:42 +0000 (15:10 -0500)
The new gpu mmu has no base address feature and need set zero,
But hardware mmu version is not initialized before set baseaddress,

Hence kernel will get the wrong base address and pass to user driver,
This fix will add mmu version initialization before version check.

Date: Feb 15, 2017
Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
drivers/mxc/gpu-viv/hal/kernel/arch/gc_hal_kernel_hardware.c
drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c

index de22c84..4e2b053 100644 (file)
@@ -1555,6 +1555,8 @@ gckHARDWARE_Construct(
     /* Identify the hardware. */
     gcmkONERROR(_IdentifyHardwareByDatabase(hardware, Os, Core, &hardware->identity));
 
+    hardware->mmuVersion = gckHARDWARE_IsFeatureAvailable(hardware, gcvFEATURE_MMU);
+
     /* Get the system's physical base address for old MMU */
     if (hardware->mmuVersion == 0)
     {
@@ -1612,9 +1614,6 @@ gckHARDWARE_Construct(
 
     hardware->powerMutex = gcvNULL;
 
-    hardware->mmuVersion = gckHARDWARE_IsFeatureAvailable(hardware, gcvFEATURE_MMU);
-
-
     /* Determine whether bug fixes #1 are present. */
     hardware->extraEventStates = (gckHARDWARE_IsFeatureAvailable(hardware, gcvFEATURE_BUG_FIXES1) == gcvFALSE);
 
@@ -12192,7 +12191,7 @@ gckHARDWARE_GetBaseAddress(
     gcmkVERIFY_ARGUMENT(BaseAddress != gcvNULL);
 
     /* Test if we have a new Memory Controller. */
-    if (gckHARDWARE_IsFeatureAvailable(Hardware, gcvFEATURE_MMU))
+    if (gckHARDWARE_IsFeatureAvailable(Hardware, gcvFEATURE_MC20))
     {
         /* No base address required. */
         *BaseAddress = 0;
index 271bc9c..147b0ff 100644 (file)
@@ -1922,9 +1922,7 @@ gckKERNEL_Dispatch(
     {
     case gcvHAL_GET_BASE_ADDRESS:
         /* Get base address. */
-        gcmkONERROR(
-            gckHARDWARE_GetBaseAddress(kernel->hardware, &Interface->u.GetBaseAddress.baseAddress));
-
+        Interface->u.GetBaseAddress.baseAddress = Kernel->hardware->baseAddress;
         Interface->u.GetBaseAddress.flatMappingStart = Kernel->mmu->flatMappingStart;
         Interface->u.GetBaseAddress.flatMappingEnd = Kernel->mmu->flatMappingEnd;
         break;