summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2017-03-17 12:56:50 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-03-27 13:48:31 -0400
commitb45a67934faeba042dbf6ebe47c520db3ef4090d (patch)
tree771f8c223a47281da915fee3348167724c332f56 /drivers/gpu/nvgpu/gk20a/mm_gk20a.c
parent0c45c5fcb60810f06b0ae05270f0fa7e32d31869 (diff)
gpu: nvgpu: Use nvgpu_timeout for all loops
There were still a few remaining loops where we did not use nvgpu_timeout and required Tegra specific functions for detecting if timeout should be skipped. Replace all of them with nvgpu_timeout and remove including chip-id.h where possible. FE power mode timeout loop also used wrong delay value. It always waited for the whole max timeout instead of looping with smaller increments. If SEC2 ACR boot fails to halt, we should not try to check ACR result from mailbox. Add an early return for that case. JIRA NVGPU-16 Change-Id: I9f0984250d7d01785755338e39822e6631dcaa5a Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/1323227
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/mm_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/mm_gk20a.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
index 9e6dc74c..c31f8482 100644
--- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
@@ -22,7 +22,6 @@
22#include <linux/nvhost.h> 22#include <linux/nvhost.h>
23#include <linux/scatterlist.h> 23#include <linux/scatterlist.h>
24#include <linux/nvmap.h> 24#include <linux/nvmap.h>
25#include <soc/tegra/chip-id.h>
26#include <linux/vmalloc.h> 25#include <linux/vmalloc.h>
27#include <linux/dma-buf.h> 26#include <linux/dma-buf.h>
28#include <linux/dma-mapping.h> 27#include <linux/dma-mapping.h>
@@ -1543,7 +1542,6 @@ static void gk20a_vm_unmap_user(struct vm_gk20a *vm, u64 offset,
1543 struct vm_gk20a_mapping_batch *batch) 1542 struct vm_gk20a_mapping_batch *batch)
1544{ 1543{
1545 struct device *d = dev_from_vm(vm); 1544 struct device *d = dev_from_vm(vm);
1546 int retries = 10000; /* 50 ms */
1547 struct mapped_buffer_node *mapped_buffer; 1545 struct mapped_buffer_node *mapped_buffer;
1548 1546
1549 nvgpu_mutex_acquire(&vm->update_gmmu_lock); 1547 nvgpu_mutex_acquire(&vm->update_gmmu_lock);
@@ -1556,17 +1554,19 @@ static void gk20a_vm_unmap_user(struct vm_gk20a *vm, u64 offset,
1556 } 1554 }
1557 1555
1558 if (mapped_buffer->flags & NVGPU_AS_MAP_BUFFER_FLAGS_FIXED_OFFSET) { 1556 if (mapped_buffer->flags & NVGPU_AS_MAP_BUFFER_FLAGS_FIXED_OFFSET) {
1557 struct nvgpu_timeout timeout;
1558
1559 nvgpu_mutex_release(&vm->update_gmmu_lock); 1559 nvgpu_mutex_release(&vm->update_gmmu_lock);
1560 1560
1561 while (retries >= 0 || !tegra_platform_is_silicon()) { 1561 nvgpu_timeout_init(vm->mm->g, &timeout, 10000,
1562 NVGPU_TIMER_RETRY_TIMER);
1563 do {
1562 if (atomic_read(&mapped_buffer->ref.refcount) == 1) 1564 if (atomic_read(&mapped_buffer->ref.refcount) == 1)
1563 break; 1565 break;
1564 retries--;
1565 udelay(5); 1566 udelay(5);
1566 } 1567 } while (!nvgpu_timeout_expired_msg(&timeout,
1567 if (retries < 0 && tegra_platform_is_silicon()) 1568 "sync-unmap failed on 0x%llx"));
1568 gk20a_err(d, "sync-unmap failed on 0x%llx", 1569
1569 offset);
1570 nvgpu_mutex_acquire(&vm->update_gmmu_lock); 1570 nvgpu_mutex_acquire(&vm->update_gmmu_lock);
1571 } 1571 }
1572 1572