gc320: gcx: [WA] Allocate MMU page tables as non cached
authorSundar Raman <a0393242@ti.com>
Mon, 22 Jul 2013 14:25:56 +0000 (09:25 -0500)
committerSundar Raman <a0393242@ti.com>
Thu, 25 Jul 2013 19:40:20 +0000 (14:40 -0500)
In K3.8, the cache flushing APIs for the MMU page tables are not
working correctly. Changed the allocations to non cached to
workaround the problem until the correct root cause is found.

Change-Id: Id87497b86d3d93941926f4fc417a4f8d81a5d570
Signed-off-by: Sundar Raman <a0393242@ti.com>
drivers/misc/gcx/gccore/gcmmu.c
drivers/misc/gcx/gccore/gcqueue.c

index fd0b2ee114faf8dde9d2fb9a75ec5cb9673a2d5c..2bfe52d7e0cfd730827827039bb2d31353c21ac8 100644 (file)
@@ -45,6 +45,8 @@ GCDBG_FILTERDEF(mmu, GCZONE_NONE,
                "dumpunmap")
 
 
+#define USE_CACHED_MASTER      0
+#define USE_CACHED_SLAVE       0
 /*******************************************************************************
  * Internal definitions.
  */
@@ -180,7 +182,11 @@ static enum gcerror allocate_slave(struct gcmmucontext *gcmmucontext,
              prealloccount);
 
        /* Allocate slave table pool. */
+#if USE_CACHED_SLAVE
        gcerror = gc_alloc_cached(&block->pages, preallocsize);
+#else
+       gcerror = gc_alloc_noncached(&block->pages, preallocsize);
+#endif
        if (gcerror != GCERR_NONE) {
                GCERR("failed to allocate slave page table\n");
                gcerror = GCERR_SETGRP(gcerror, GCERR_MMU_STLB_ALLOC);
@@ -218,11 +224,16 @@ static enum gcerror allocate_slave(struct gcmmucontext *gcmmucontext,
                        ((unsigned char *) logical + GCMMU_STLB_SIZE);
        }
 
+#if USE_CACHED_MASTER
        /* Flush CPU cache. */
        gc_flush_region(gcmmucontext->master.physical,
                        gcmmucontext->master.logical,
                        index.loc.mtlb * sizeof(unsigned int),
                        prealloccount * sizeof(unsigned int));
+#else
+               mb();
+#endif
+
 
        GCEXIT(GCZONE_MAPPING);
        return GCERR_NONE;
@@ -499,7 +510,11 @@ enum gcerror gcmmu_create_context(struct gccorecontext *gccorecontext,
        gcmmucontext->pid = pid;
 
        /* Allocate MTLB table. */
+#if USE_CACHED_MASTER
        gcerror = gc_alloc_cached(&gcmmucontext->master, GCMMU_MTLB_SIZE);
+#else
+       gcerror = gc_alloc_noncached(&gcmmucontext->master, GCMMU_MTLB_SIZE);
+#endif
        if (gcerror != GCERR_NONE) {
                gcerror = GCERR_SETGRP(gcerror, GCERR_MMU_MTLB_ALLOC);
                goto exit;
@@ -583,7 +598,11 @@ enum gcerror gcmmu_destroy_context(struct gccorecontext *gccorecontext,
 
        /* Free slave tables. */
        while (gcmmucontext->slavealloc != NULL) {
+#if USE_CACHED_SLAVE
                gc_free_cached(&gcmmucontext->slavealloc->pages);
+#else
+               gc_free_noncached(&gcmmucontext->slavealloc->pages);
+#endif
                nextblock = gcmmucontext->slavealloc->next;
                kfree(gcmmucontext->slavealloc);
                gcmmucontext->slavealloc = nextblock;
@@ -594,7 +613,11 @@ enum gcerror gcmmu_destroy_context(struct gccorecontext *gccorecontext,
                gcmmu->master = ~0U;
 
        /* Free the master table. */
+#if USE_CACHED_MASTER
        gc_free_cached(&gcmmucontext->master);
+#else
+       gc_free_noncached(&gcmmucontext->master);
+#endif
 
        /* Free arenas. */
        GCLOCK(&gcmmu->lock);
@@ -881,10 +904,14 @@ enum gcerror gcmmu_map(struct gccorecontext *gccorecontext,
                                | GCMMU_STLB_EXCEPTION
                                | GCMMU_STLB_WRITEABLE;
 
+#if USE_CACHED_SLAVE
                /* Flush CPU cache. */
                gc_flush_region(slave->physical, slave->logical,
                                index.loc.stlb * sizeof(unsigned int),
                                allocated * sizeof(unsigned int));
+#else
+               mb();
+#endif
 
                GCDBG(GCZONE_MAPPING, "allocated %d pages at %d.%d\n",
                      allocated, index.loc.mtlb, index.loc.stlb);
@@ -1033,10 +1060,14 @@ enum gcerror gcmmu_unmap(struct gccorecontext *gccorecontext,
                for (i = 0; i < freed; i += 1)
                        *stlblogical++ = GCMMU_STLB_ENTRY_VACANT;
 
+#if USE_CACHED_SLAVE
                /* Flush CPU cache. */
                gc_flush_region(slave->physical, slave->logical,
                                index.loc.stlb * sizeof(unsigned int),
                                freed * sizeof(unsigned int));
+#else
+               mb();
+#endif
 
                /* Advance. */
                slave += 1;
index c5a1921c64e66791b9dd0b461f1952e83a116aea..32e7d9546fa5c43464be40b6140c3deb2df1ad2b 100644 (file)
@@ -772,6 +772,7 @@ static int gccmdthread(void *_gccorecontext)
                                GCSETFIELD(0, GCREG_CMD_BUFFER_CTRL,
                                        PREFETCH, headcmdbuf->count));
 
+                       GCDBG(GCZONE_THREAD, "queue restarted.\n");
                        GCUNLOCK(&gcqueue->queuelock);
                        continue;
                }
@@ -821,6 +822,7 @@ static int gccmdthread(void *_gccorecontext)
                                GCDBG(GCZONE_THREAD,
                                      "current location @ 0x%08X.\n",
                                      dmapc);
+                               GCGPUSTATUS();
                                GCUNLOCK(&gcqueue->queuelock);
                                continue;
                        }
@@ -846,6 +848,7 @@ static int gccmdthread(void *_gccorecontext)
                        if (!list_empty(&gcqueue->queue)) {
                                GCDBG(GCZONE_THREAD,
                                      "aborting shutdown to process events\n");
+                               GCGPUSTATUS();
                                GCUNLOCK(&gcqueue->queuelock);
                                continue;
                        }