From d8058e32d933cab37f0dd100938a164321a54159 Mon Sep 17 00:00:00 2001 From: Sundar Raman Date: Mon, 22 Jul 2013 09:25:56 -0500 Subject: 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 --- drivers/misc/gcx/gccore/gcmmu.c | 31 +++++++++++++++++++++++++++++++ drivers/misc/gcx/gccore/gcqueue.c | 3 +++ 2 files changed, 34 insertions(+) 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, "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; 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) 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; } -- cgit v1.2.3-54-g00ecf