summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/nvgpu/gk20a/mm_gk20a.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
index e1f135e7..d26855f4 100644
--- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
@@ -2981,7 +2981,7 @@ int gk20a_gmmu_alloc_attr_vid_at(struct gk20a *g, enum dma_attr attr,
2981#if defined(CONFIG_GK20A_VIDMEM) 2981#if defined(CONFIG_GK20A_VIDMEM)
2982 u64 addr; 2982 u64 addr;
2983 int err; 2983 int err;
2984 unsigned long end_jiffies = jiffies + msecs_to_jiffies(1000); 2984 bool clear_list_empty;
2985 struct gk20a_allocator *vidmem_alloc = g->mm.vidmem.cleared ? 2985 struct gk20a_allocator *vidmem_alloc = g->mm.vidmem.cleared ?
2986 &g->mm.vidmem.allocator : 2986 &g->mm.vidmem.allocator :
2987 &g->mm.vidmem.bootstrap_allocator; 2987 &g->mm.vidmem.bootstrap_allocator;
@@ -2995,16 +2995,17 @@ int gk20a_gmmu_alloc_attr_vid_at(struct gk20a *g, enum dma_attr attr,
2995 * are not done anyway */ 2995 * are not done anyway */
2996 WARN_ON(attr != 0 && attr != DMA_ATTR_NO_KERNEL_MAPPING); 2996 WARN_ON(attr != 0 && attr != DMA_ATTR_NO_KERNEL_MAPPING);
2997 2997
2998 do { 2998 addr = __gk20a_gmmu_alloc(vidmem_alloc, at, size);
2999 addr = __gk20a_gmmu_alloc(vidmem_alloc, at, size); 2999 if (!addr) {
3000 if (!addr) /* Possible OOM */ 3000 mutex_lock(&g->mm.vidmem.clear_list_mutex);
3001 usleep_range(100, 300); 3001 clear_list_empty = list_empty(&g->mm.vidmem.clear_list_head);
3002 else 3002 mutex_unlock(&g->mm.vidmem.clear_list_mutex);
3003 break;
3004 } while (time_before(jiffies, end_jiffies));
3005 3003
3006 if (!addr) 3004 if (clear_list_empty)
3007 return -ENOMEM; 3005 return -ENOMEM;
3006 else
3007 return -EAGAIN;
3008 }
3008 3009
3009 if (at) 3010 if (at)
3010 mem->fixed = true; 3011 mem->fixed = true;