[meta-freescale] Differences in the Vivante GPU driver code inside the kernel and the external module

Otavio Salvador otavio.salvador at ossystems.com.br
Sat Aug 15 03:27:53 PDT 2015


Hello folks,

I've been poking with the external module integration and I while
debugging a build error I found that the i.MX6 platform code is not in
sync between them.

I am quoting the diff below for people to take a look. Prabhu, could
you please take a look and let us know how to progress on this?

--- /home/otavio/src/linux/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c
2015-08-12 14:25:07.396916517 +0000
+++ imx-gpu-viv-kernel-src/hal/kernel/gc_hal_kernel.c 2015-06-24
14:26:04.000000000 +0000
@@ -170,6 +170,7 @@
             if (kernel->eventObj->lastCommitStamp == kernel->lastCommitStamp
              && kernel->hardware->lastWaitLink    == kernel->restoreAddress
              && mask                              == kernel->restoreMask
+             && kernel->hardware->chipPowerState  == gcvPOWER_ON
             )
             {
                 /* GPU state is not changed, accumlate timeout. */
--- /home/otavio/src/linux/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c
2015-08-12 14:25:07.403582958 +0000
+++ imx-gpu-viv-kernel-src/hal/os/linux/kernel/gc_hal_kernel_os.c
2015-06-24 14:26:04.000000000 +0000
@@ -354,7 +354,9 @@
     OUT gctPHYS_ADDR_T * Address
     )
 {
+#ifndef CONFIG_DEBUG_SPINLOCK
     spinlock_t *lock;
+#endif
     gctUINTPTR_T logical = (gctUINTPTR_T)Logical;
     pgd_t *pgd;
     pud_t *pud;
@@ -384,7 +386,14 @@
         return gcvSTATUS_NOT_FOUND;
     }

+#ifndef CONFIG_DEBUG_SPINLOCK
     pte = pte_offset_map_lock(current->mm, pmd, logical, &lock);
+#else
+    spin_lock(&current->mm->page_table_lock);
+
+    pte = pte_offset_map(pmd, logical);
+#endif
+
     if (!pte)
     {
         return gcvSTATUS_NOT_FOUND;
@@ -392,12 +401,20 @@

     if (!pte_present(*pte))
     {
+#ifndef CONFIG_DEBUG_SPINLOCK
         pte_unmap_unlock(pte, lock);
+#else
+        spin_unlock(&current->mm->page_table_lock);
+#endif
         return gcvSTATUS_NOT_FOUND;
     }

     *Address = (pte_pfn(*pte) << PAGE_SHIFT) | (logical & ~PAGE_MASK);
+#ifndef CONFIG_DEBUG_SPINLOCK
     pte_unmap_unlock(pte, lock);
+#else
+    spin_unlock(&current->mm->page_table_lock);
+#endif

     return gcvSTATUS_OK;
 }
--- /home/otavio/src/linux/drivers/mxc/gpu-viv/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6q14.c
2015-08-12 14:25:07.406916178 +0000
+++ imx-gpu-viv-kernel-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6q14.c
2015-06-24 14:26:04.000000000 +0000
@@ -24,6 +24,11 @@
 #include "gc_hal_kernel_device.h"
 #include "gc_hal_driver.h"
 #include <linux/slab.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
+#include <linux/of_platform.h>
+#include <linux/of_gpio.h>
+#include <linux/of_address.h>
+#endif

 #if USE_PLATFORM_DRIVER
 #   include <linux/platform_device.h>
@@ -35,9 +40,12 @@
 #include <linux/pm_runtime.h>
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
 #include <mach/busfreq.h>
-#else
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)
 #include <linux/busfreq-imx6.h>
 #include <linux/reset.h>
+#else
+#include <linux/busfreq-imx.h>
+#include <linux/reset.h>
 #endif
 #endif

@@ -412,7 +420,7 @@

     Args->gpu3DMinClock = initgpu3DMinClock;

-    if (Args->physSize == 0)
+    if(Args->physSize == 0)
         Args->physSize = 0x80000000;

     return gcvSTATUS_OK;
@@ -445,6 +453,36 @@
 }

 gceSTATUS
+_SetClock(
+    IN gckPLATFORM Platform,
+    IN gceCORE GPU,
+    IN gctBOOL Enable
+    );
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
+static void imx6sx_optimize_qosc_for_GPU(IN gckPLATFORM Platform)
+{
+ struct device_node *np;
+ void __iomem *src_base;
+
+ np = of_find_compatible_node(NULL, NULL, "fsl,imx6sx-qosc");
+ if (!np)
+ return;
+
+ src_base = of_iomap(np, 0);
+ WARN_ON(!src_base);
+     _SetClock(Platform, gcvCORE_MAJOR, gcvTRUE);
+ writel_relaxed(0, src_base); /* Disable clkgate & soft_rst */
+ writel_relaxed(0, src_base+0x60); /* Enable all masters */
+ writel_relaxed(0, src_base+0x1400); /* Disable clkgate & soft_rst for gpu */
+ writel_relaxed(0x0f000222, src_base+0x1400+0xd0); /* Set Write QoS 2
for gpu */
+ writel_relaxed(0x0f000822, src_base+0x1400+0xe0); /* Set Read QoS 8 for gpu */
+     _SetClock(Platform, gcvCORE_MAJOR, gcvFALSE);
+ return;
+}
+#endif
+
+gceSTATUS
 _GetPower(
     IN gckPLATFORM Platform
     )
@@ -546,6 +584,9 @@
     }
 #endif

+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
+    imx6sx_optimize_qosc_for_GPU(Platform);
+#endif
     return gcvSTATUS_OK;
 }


-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750


More information about the meta-freescale mailing list