aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSundar Raman2013-07-22 09:25:56 -0500
committerSundar Raman2013-07-25 14:40:20 -0500
commitd8058e32d933cab37f0dd100938a164321a54159 (patch)
tree888d4a042ff5cb9e6fada0470cb3d486fbbc1e95
parent73fcff39cca27f0f6916c4f49d70337481185fe1 (diff)
downloadkernel-video-d8058e32d933cab37f0dd100938a164321a54159.tar.gz
kernel-video-d8058e32d933cab37f0dd100938a164321a54159.tar.xz
kernel-video-d8058e32d933cab37f0dd100938a164321a54159.zip
gc320: gcx: [WA] Allocate MMU page tables as non cached
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>
-rw-r--r--drivers/misc/gcx/gccore/gcmmu.c31
-rw-r--r--drivers/misc/gcx/gccore/gcqueue.c3
2 files changed, 34 insertions, 0 deletions
diff --git a/drivers/misc/gcx/gccore/gcmmu.c b/drivers/misc/gcx/gccore/gcmmu.c
index fd0b2ee114f..2bfe52d7e0c 100644
--- a/drivers/misc/gcx/gccore/gcmmu.c
+++ b/drivers/misc/gcx/gccore/gcmmu.c
@@ -45,6 +45,8 @@ GCDBG_FILTERDEF(mmu, GCZONE_NONE,
45 "dumpunmap") 45 "dumpunmap")
46 46
47 47
48#define USE_CACHED_MASTER 0
49#define USE_CACHED_SLAVE 0
48/******************************************************************************* 50/*******************************************************************************
49 * Internal definitions. 51 * Internal definitions.
50 */ 52 */
@@ -180,7 +182,11 @@ static enum gcerror allocate_slave(struct gcmmucontext *gcmmucontext,
180 prealloccount); 182 prealloccount);
181 183
182 /* Allocate slave table pool. */ 184 /* Allocate slave table pool. */
185#if USE_CACHED_SLAVE
183 gcerror = gc_alloc_cached(&block->pages, preallocsize); 186 gcerror = gc_alloc_cached(&block->pages, preallocsize);
187#else
188 gcerror = gc_alloc_noncached(&block->pages, preallocsize);
189#endif
184 if (gcerror != GCERR_NONE) { 190 if (gcerror != GCERR_NONE) {
185 GCERR("failed to allocate slave page table\n"); 191 GCERR("failed to allocate slave page table\n");
186 gcerror = GCERR_SETGRP(gcerror, GCERR_MMU_STLB_ALLOC); 192 gcerror = GCERR_SETGRP(gcerror, GCERR_MMU_STLB_ALLOC);
@@ -218,11 +224,16 @@ static enum gcerror allocate_slave(struct gcmmucontext *gcmmucontext,
218 ((unsigned char *) logical + GCMMU_STLB_SIZE); 224 ((unsigned char *) logical + GCMMU_STLB_SIZE);
219 } 225 }
220 226
227#if USE_CACHED_MASTER
221 /* Flush CPU cache. */ 228 /* Flush CPU cache. */
222 gc_flush_region(gcmmucontext->master.physical, 229 gc_flush_region(gcmmucontext->master.physical,
223 gcmmucontext->master.logical, 230 gcmmucontext->master.logical,
224 index.loc.mtlb * sizeof(unsigned int), 231 index.loc.mtlb * sizeof(unsigned int),
225 prealloccount * sizeof(unsigned int)); 232 prealloccount * sizeof(unsigned int));
233#else
234 mb();
235#endif
236
226 237
227 GCEXIT(GCZONE_MAPPING); 238 GCEXIT(GCZONE_MAPPING);
228 return GCERR_NONE; 239 return GCERR_NONE;
@@ -499,7 +510,11 @@ enum gcerror gcmmu_create_context(struct gccorecontext *gccorecontext,
499 gcmmucontext->pid = pid; 510 gcmmucontext->pid = pid;
500 511
501 /* Allocate MTLB table. */ 512 /* Allocate MTLB table. */
513#if USE_CACHED_MASTER
502 gcerror = gc_alloc_cached(&gcmmucontext->master, GCMMU_MTLB_SIZE); 514 gcerror = gc_alloc_cached(&gcmmucontext->master, GCMMU_MTLB_SIZE);
515#else
516 gcerror = gc_alloc_noncached(&gcmmucontext->master, GCMMU_MTLB_SIZE);
517#endif
503 if (gcerror != GCERR_NONE) { 518 if (gcerror != GCERR_NONE) {
504 gcerror = GCERR_SETGRP(gcerror, GCERR_MMU_MTLB_ALLOC); 519 gcerror = GCERR_SETGRP(gcerror, GCERR_MMU_MTLB_ALLOC);
505 goto exit; 520 goto exit;
@@ -583,7 +598,11 @@ enum gcerror gcmmu_destroy_context(struct gccorecontext *gccorecontext,
583 598
584 /* Free slave tables. */ 599 /* Free slave tables. */
585 while (gcmmucontext->slavealloc != NULL) { 600 while (gcmmucontext->slavealloc != NULL) {
601#if USE_CACHED_SLAVE
586 gc_free_cached(&gcmmucontext->slavealloc->pages); 602 gc_free_cached(&gcmmucontext->slavealloc->pages);
603#else
604 gc_free_noncached(&gcmmucontext->slavealloc->pages);
605#endif
587 nextblock = gcmmucontext->slavealloc->next; 606 nextblock = gcmmucontext->slavealloc->next;
588 kfree(gcmmucontext->slavealloc); 607 kfree(gcmmucontext->slavealloc);
589 gcmmucontext->slavealloc = nextblock; 608 gcmmucontext->slavealloc = nextblock;
@@ -594,7 +613,11 @@ enum gcerror gcmmu_destroy_context(struct gccorecontext *gccorecontext,
594 gcmmu->master = ~0U; 613 gcmmu->master = ~0U;
595 614
596 /* Free the master table. */ 615 /* Free the master table. */
616#if USE_CACHED_MASTER
597 gc_free_cached(&gcmmucontext->master); 617 gc_free_cached(&gcmmucontext->master);
618#else
619 gc_free_noncached(&gcmmucontext->master);
620#endif
598 621
599 /* Free arenas. */ 622 /* Free arenas. */
600 GCLOCK(&gcmmu->lock); 623 GCLOCK(&gcmmu->lock);
@@ -881,10 +904,14 @@ enum gcerror gcmmu_map(struct gccorecontext *gccorecontext,
881 | GCMMU_STLB_EXCEPTION 904 | GCMMU_STLB_EXCEPTION
882 | GCMMU_STLB_WRITEABLE; 905 | GCMMU_STLB_WRITEABLE;
883 906
907#if USE_CACHED_SLAVE
884 /* Flush CPU cache. */ 908 /* Flush CPU cache. */
885 gc_flush_region(slave->physical, slave->logical, 909 gc_flush_region(slave->physical, slave->logical,
886 index.loc.stlb * sizeof(unsigned int), 910 index.loc.stlb * sizeof(unsigned int),
887 allocated * sizeof(unsigned int)); 911 allocated * sizeof(unsigned int));
912#else
913 mb();
914#endif
888 915
889 GCDBG(GCZONE_MAPPING, "allocated %d pages at %d.%d\n", 916 GCDBG(GCZONE_MAPPING, "allocated %d pages at %d.%d\n",
890 allocated, index.loc.mtlb, index.loc.stlb); 917 allocated, index.loc.mtlb, index.loc.stlb);
@@ -1033,10 +1060,14 @@ enum gcerror gcmmu_unmap(struct gccorecontext *gccorecontext,
1033 for (i = 0; i < freed; i += 1) 1060 for (i = 0; i < freed; i += 1)
1034 *stlblogical++ = GCMMU_STLB_ENTRY_VACANT; 1061 *stlblogical++ = GCMMU_STLB_ENTRY_VACANT;
1035 1062
1063#if USE_CACHED_SLAVE
1036 /* Flush CPU cache. */ 1064 /* Flush CPU cache. */
1037 gc_flush_region(slave->physical, slave->logical, 1065 gc_flush_region(slave->physical, slave->logical,
1038 index.loc.stlb * sizeof(unsigned int), 1066 index.loc.stlb * sizeof(unsigned int),
1039 freed * sizeof(unsigned int)); 1067 freed * sizeof(unsigned int));
1068#else
1069 mb();
1070#endif
1040 1071
1041 /* Advance. */ 1072 /* Advance. */
1042 slave += 1; 1073 slave += 1;
diff --git a/drivers/misc/gcx/gccore/gcqueue.c b/drivers/misc/gcx/gccore/gcqueue.c
index c5a1921c64e..32e7d9546fa 100644
--- a/drivers/misc/gcx/gccore/gcqueue.c
+++ b/drivers/misc/gcx/gccore/gcqueue.c
@@ -772,6 +772,7 @@ static int gccmdthread(void *_gccorecontext)
772 GCSETFIELD(0, GCREG_CMD_BUFFER_CTRL, 772 GCSETFIELD(0, GCREG_CMD_BUFFER_CTRL,
773 PREFETCH, headcmdbuf->count)); 773 PREFETCH, headcmdbuf->count));
774 774
775 GCDBG(GCZONE_THREAD, "queue restarted.\n");
775 GCUNLOCK(&gcqueue->queuelock); 776 GCUNLOCK(&gcqueue->queuelock);
776 continue; 777 continue;
777 } 778 }
@@ -821,6 +822,7 @@ static int gccmdthread(void *_gccorecontext)
821 GCDBG(GCZONE_THREAD, 822 GCDBG(GCZONE_THREAD,
822 "current location @ 0x%08X.\n", 823 "current location @ 0x%08X.\n",
823 dmapc); 824 dmapc);
825 GCGPUSTATUS();
824 GCUNLOCK(&gcqueue->queuelock); 826 GCUNLOCK(&gcqueue->queuelock);
825 continue; 827 continue;
826 } 828 }
@@ -846,6 +848,7 @@ static int gccmdthread(void *_gccorecontext)
846 if (!list_empty(&gcqueue->queue)) { 848 if (!list_empty(&gcqueue->queue)) {
847 GCDBG(GCZONE_THREAD, 849 GCDBG(GCZONE_THREAD,
848 "aborting shutdown to process events\n"); 850 "aborting shutdown to process events\n");
851 GCGPUSTATUS();
849 GCUNLOCK(&gcqueue->queuelock); 852 GCUNLOCK(&gcqueue->queuelock);
850 continue; 853 continue;
851 } 854 }