summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/channel_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_gk20a.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
index 0249a1c6..d0d38f83 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
@@ -122,7 +122,8 @@ static struct channel_gk20a *allocate_channel(struct fifo_gk20a *f)
122static void free_channel(struct fifo_gk20a *f, 122static void free_channel(struct fifo_gk20a *f,
123 struct channel_gk20a *ch) 123 struct channel_gk20a *ch)
124{ 124{
125 struct gk20a_platform *platform = gk20a_get_platform(f->g->dev); 125 struct gk20a_platform *platform;
126 struct gk20a *g = f->g;
126 127
127 trace_gk20a_release_used_channel(ch->hw_chid); 128 trace_gk20a_release_used_channel(ch->hw_chid);
128 /* refcount is zero here and channel is in a freed/dead state */ 129 /* refcount is zero here and channel is in a freed/dead state */
@@ -132,10 +133,18 @@ static void free_channel(struct fifo_gk20a *f,
132 f->used_channels--; 133 f->used_channels--;
133 nvgpu_mutex_release(&f->free_chs_mutex); 134 nvgpu_mutex_release(&f->free_chs_mutex);
134 135
135 if (platform->aggressive_sync_destroy_thresh && 136 /*
137 * On teardown it is not possible to dereference platform, but ignoring
138 * this is fine then because no new channels would be created.
139 */
140 if (!g->driver_is_dying) {
141 platform = gk20a_get_platform(g->dev);
142
143 if (platform->aggressive_sync_destroy_thresh &&
136 (f->used_channels < 144 (f->used_channels <
137 platform->aggressive_sync_destroy_thresh)) 145 platform->aggressive_sync_destroy_thresh))
138 platform->aggressive_sync_destroy = false; 146 platform->aggressive_sync_destroy = false;
147 }
139} 148}
140 149
141int channel_gk20a_commit_va(struct channel_gk20a *c) 150int channel_gk20a_commit_va(struct channel_gk20a *c)
@@ -3016,7 +3025,12 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
3016 bool need_deferred_cleanup = false; 3025 bool need_deferred_cleanup = false;
3017 struct nvgpu_gpfifo __user *user_gpfifo = args ? 3026 struct nvgpu_gpfifo __user *user_gpfifo = args ?
3018 (struct nvgpu_gpfifo __user *)(uintptr_t)args->gpfifo : NULL; 3027 (struct nvgpu_gpfifo __user *)(uintptr_t)args->gpfifo : NULL;
3019 struct gk20a_platform *platform = gk20a_get_platform(d); 3028 struct gk20a_platform *platform;
3029
3030 if (g->driver_is_dying)
3031 return -ENODEV;
3032
3033 platform = gk20a_get_platform(d);
3020 3034
3021 if (c->has_timedout) 3035 if (c->has_timedout)
3022 return -ETIMEDOUT; 3036 return -ETIMEDOUT;