diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index 031635756..de51e83ee 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c @@ -318,7 +318,6 @@ static void channel_gk20a_bind(struct channel_gk20a *ch_gk20a) void channel_gk20a_unbind(struct channel_gk20a *ch_gk20a) { struct gk20a *g = ch_gk20a->g; - struct gk20a_platform *platform = gk20a_get_platform(g->dev); gk20a_dbg_fn(""); @@ -334,7 +333,7 @@ void channel_gk20a_unbind(struct channel_gk20a *ch_gk20a) * resource at this point * if not, then it will be destroyed at channel_free() */ - if (ch_gk20a->sync && platform->sync_aggressive_destroy) { + if (ch_gk20a->sync && ch_gk20a->sync->aggressive_destroy) { ch_gk20a->sync->destroy(ch_gk20a->sync); ch_gk20a->sync = NULL; } @@ -1470,7 +1469,6 @@ void gk20a_channel_update(struct channel_gk20a *c, int nr_completed) { struct vm_gk20a *vm = c->vm; struct channel_gk20a_job *job, *n; - struct gk20a_platform *platform = gk20a_get_platform(c->g->dev); trace_gk20a_channel_update(c); @@ -1508,7 +1506,7 @@ void gk20a_channel_update(struct channel_gk20a *c, int nr_completed) * the sync resource */ if (list_empty(&c->jobs)) { - if (c->sync && platform->sync_aggressive_destroy && + if (c->sync && c->sync->aggressive_destroy && gk20a_fence_is_expired(c->last_submit.post_fence)) { c->sync->destroy(c->sync); c->sync = NULL; diff --git a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c index a27f08a41..746a2de32 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c @@ -305,6 +305,8 @@ gk20a_channel_syncpt_create(struct channel_gk20a *c) sp->ops.signal_timeline = gk20a_channel_syncpt_signal_timeline; sp->ops.destroy = gk20a_channel_syncpt_destroy; + sp->ops.aggressive_destroy = true; + return &sp->ops; } #endif /* CONFIG_TEGRA_GK20A */ @@ -642,6 +644,10 @@ gk20a_channel_semaphore_create(struct channel_gk20a *c) sema->ops.signal_timeline = gk20a_channel_semaphore_signal_timeline; sema->ops.destroy = gk20a_channel_semaphore_destroy; + /* Aggressively destroying the semaphore sync would cause overhead + * since the pool needs to be mapped to GMMU. */ + sema->ops.aggressive_destroy = false; + return &sema->ops; clean_up: gk20a_channel_semaphore_destroy(&sema->ops); diff --git a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.h b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.h index b2deaff83..a3cd82081 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.h @@ -86,6 +86,9 @@ struct gk20a_channel_sync { * expired. */ void (*signal_timeline)(struct gk20a_channel_sync *s); + /* flag to set sync destroy aggressiveness */ + bool aggressive_destroy; + /* Free the resources allocated by gk20a_channel_sync_create. */ void (*destroy)(struct gk20a_channel_sync *s); }; diff --git a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h index cd68f8e17..f4301dab8 100644 --- a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h @@ -46,7 +46,6 @@ struct gk20a_platform { /* Should be populated at probe. */ bool has_syncpoints; - bool sync_aggressive_destroy; /* Should be populated by probe. */ struct dentry *debugfs; diff --git a/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c b/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c index 9d17aa865..dfbc1ae0b 100644 --- a/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c +++ b/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c @@ -584,11 +584,6 @@ struct gk20a_platform gk20a_tegra_platform = { struct gk20a_platform gm20b_tegra_platform = { .has_syncpoints = true, - /* - * Enable aggressive reclaiming of sync point, becuase we have - * fewer sync points than channels - */ - .sync_aggressive_destroy = true, /* power management configuration */ .railgate_delay = 500, diff --git a/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c b/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c index 5310088f6..24b9f4be6 100644 --- a/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c @@ -63,7 +63,7 @@ static void vgpu_channel_unbind(struct channel_gk20a *ch) * resource at this point * if not, then it will be destroyed at channel_free() */ - if (ch->sync && platform->sync_aggressive_destroy) { + if (ch->sync && ch->sync->aggressive_destroy) { ch->sync->destroy(ch->sync); ch->sync = NULL; }