From 31532aa01d24916b980b5e769d8c8a65b4c8b4a9 Mon Sep 17 00:00:00 2001 From: Shridhar Rasal Date: Wed, 11 Jan 2017 16:30:43 +0530 Subject: [PATCH] video: tegra: host: dla: add GoS backing support Update syncpoint based actions with GoS semaphores. For post actions get both GoS and MSS sem address, for pre actions use MSS sem if GoS sem is not available. In postactions, write 1 to MSS memory and write current max + 1 to GoS memory. DLA-98 Change-Id: I6dbf850bc2c5b86c372ad963a30e9cfad1fc787f Signed-off-by: Shridhar Rasal Reviewed-on: http://git-master/r/1283462 Reviewed-by: svccoveritychecker Reviewed-by: Prashant Gaikwad GVS: Gerrit_Virtual_Submit --- drivers/video/tegra/host/nvdla/nvdla_queue.c | 70 ++++++++++++++++++-- 1 file changed, 63 insertions(+), 7 deletions(-) diff --git a/drivers/video/tegra/host/nvdla/nvdla_queue.c b/drivers/video/tegra/host/nvdla/nvdla_queue.c index ae1a0145..7fec1da7 100644 --- a/drivers/video/tegra/host/nvdla/nvdla_queue.c +++ b/drivers/video/tegra/host/nvdla/nvdla_queue.c @@ -382,9 +382,33 @@ static int nvdla_fill_postactions(struct nvdla_task *task) /* update action */ switch (task->postfences[i].type) { case NVDLA_FENCE_TYPE_SYNCPT: { + dma_addr_t gos_syncpt_addr; + dma_addr_t syncpt_addr; + + /* update GoS backing if available */ + gos_syncpt_addr = nvhost_syncpt_gos_address(pdev, + queue->syncpt_id); + if (gos_syncpt_addr) { + u32 max; + + nvdla_dbg_info(pdev, "post i:%d syncpt:[%u] gos[%pad]", + i, queue->syncpt_id, &gos_syncpt_addr); + + /* send incremented max */ + max = nvhost_syncpt_read_maxval(pdev, + queue->syncpt_id); + next = add_fence_action(next, POSTACTION_SEM, + gos_syncpt_addr, max + 1); + } + + /* For postaction also update MSS addr */ + syncpt_addr = nvhost_syncpt_address(pdev, + queue->syncpt_id); next = add_fence_action(next, POSTACTION_SEM, - nvhost_syncpt_address(pdev, queue->syncpt_id), - 0); + syncpt_addr, 1); + + nvdla_dbg_info(pdev, "post i:%d syncpt:[%u] mss:[%pad]", + i, queue->syncpt_id, &syncpt_addr); break; } case NVDLA_FENCE_TYPE_TS_SEMAPHORE: { @@ -508,6 +532,8 @@ static int nvdla_fill_preactions(struct nvdla_task *task) j = id = thresh = 0; for (j = 0; j < f->num_fences; j++) { + dma_addr_t syncpt_addr; + pt = sync_pt_from_fence(f->cbs[j].sync_pt); id = nvhost_sync_pt_id(pt); thresh = nvhost_sync_pt_thresh(pt); @@ -519,22 +545,52 @@ static int nvdla_fill_preactions(struct nvdla_task *task) break; } + /* check if GoS backing available */ + syncpt_addr = nvhost_syncpt_gos_address(pdev, + id); + + /* if not, then use MSS addr */ + if (!syncpt_addr) { + nvdla_dbg_info(pdev, "pre i:%d GoS missing for syncfd [%d]", + i, id); + syncpt_addr = nvhost_syncpt_address(pdev, + id); + } + nvdla_dbg_info(pdev, "pre i:%d syncfd_pt:[%u] dma_addr[%pad]", + i, id, &syncpt_addr); + + next = add_fence_action(next, PREACTION_SEM_GE, - nvhost_syncpt_address(pdev, id), - thresh); + syncpt_addr, thresh); } break; } case NVDLA_FENCE_TYPE_SYNCPT: { + dma_addr_t syncpt_addr; + nvdla_dbg_info(pdev, "i[%d] id[%d] val[%d]", i, task->prefences[i].syncpoint_index, task->prefences[i].syncpoint_value); + /* check if GoS backing available */ + syncpt_addr = nvhost_syncpt_gos_address(pdev, + task->prefences[i].syncpoint_index); + + /* if not, then use MSS addr */ + if (!syncpt_addr) { + nvdla_dbg_info(pdev, "pre i:%d GoS missing", i); + syncpt_addr = nvhost_syncpt_address(pdev, + task->prefences[i].syncpoint_index); + } + nvdla_dbg_info(pdev, "pre i:%d syncpt:[%u] dma_addr[%pad]", + i, + task->prefences[i].syncpoint_index, + &syncpt_addr); + next = add_fence_action(next, PREACTION_SEM_GE, - nvhost_syncpt_address(pdev, - task->prefences[i].syncpoint_index), - task->prefences[i].syncpoint_value); + syncpt_addr, + task->prefences[i].syncpoint_value); break; } case NVDLA_FENCE_TYPE_SEMAPHORE: {