From 9bbffa11de08a96f7f0f1df887bca1e22a85e0f0 Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Mon, 23 Feb 2015 20:51:18 -0800 Subject: gpu: nvgpu: Reconfigure instance block with syncpt Resetup RAMFC once sync point id is allocated for a channel. Change-Id: Idbac406bea1c94c89ef587dda08fddc740c1fadb Signed-off-by: Terje Bergstrom Reviewed-on: http://git-master/r/711302 Reviewed-on: http://git-master/r/737526 Reviewed-by: Alexander Van Brunt Tested-by: Alexander Van Brunt Reviewed-by: Automatic_Commit_Validation_User --- drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 10 +++++++++- drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c | 14 ++++++++++++++ drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.h | 3 +++ drivers/gpu/nvgpu/gk20a/gk20a.h | 1 + 4 files changed, 27 insertions(+), 1 deletion(-) (limited to 'drivers/gpu/nvgpu/gk20a') diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index dafed8f8..1a5cf5c4 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c @@ -1233,7 +1233,7 @@ static int gk20a_channel_submit_wfi(struct channel_gk20a *c) struct priv_cmd_entry *cmd = NULL; struct gk20a *g = c->g; u32 free_count; - int err; + int err = 0; if (c->has_timedout) return -ETIMEDOUT; @@ -1254,6 +1254,10 @@ static int gk20a_channel_submit_wfi(struct channel_gk20a *c) mutex_unlock(&c->submit_lock); return -ENOMEM; } + if (g->ops.fifo.resetup_ramfc) + err = g->ops.fifo.resetup_ramfc(c); + if (err) + return err; } gk20a_fence_put(c->last_submit.pre_fence); @@ -1547,6 +1551,10 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c, mutex_unlock(&c->submit_lock); goto clean_up; } + if (g->ops.fifo.resetup_ramfc) + err = g->ops.fifo.resetup_ramfc(c); + if (err) + return err; } /* diff --git a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c index 73b2d7ec..a488178f 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c @@ -271,6 +271,13 @@ static void gk20a_channel_syncpt_signal_timeline( /* Nothing to do. */ } +static int gk20a_channel_syncpt_id(struct gk20a_channel_sync *s) +{ + struct gk20a_channel_syncpt *sp = + container_of(s, struct gk20a_channel_syncpt, ops); + return sp->id; +} + static void gk20a_channel_syncpt_destroy(struct gk20a_channel_sync *s) { struct gk20a_channel_syncpt *sp = @@ -306,6 +313,7 @@ gk20a_channel_syncpt_create(struct channel_gk20a *c) sp->ops.incr_user = gk20a_channel_syncpt_incr_user; sp->ops.set_min_eq_max = gk20a_channel_syncpt_set_min_eq_max; sp->ops.signal_timeline = gk20a_channel_syncpt_signal_timeline; + sp->ops.syncpt_id = gk20a_channel_syncpt_id; sp->ops.destroy = gk20a_channel_syncpt_destroy; sp->ops.aggressive_destroy = true; @@ -587,6 +595,11 @@ static void gk20a_channel_semaphore_signal_timeline( gk20a_sync_timeline_signal(sp->timeline); } +static int gk20a_channel_semaphore_syncpt_id(struct gk20a_channel_sync *s) +{ + return -EINVAL; +} + static void gk20a_channel_semaphore_destroy(struct gk20a_channel_sync *s) { struct gk20a_channel_semaphore *sema = @@ -645,6 +658,7 @@ gk20a_channel_semaphore_create(struct channel_gk20a *c) sema->ops.incr_user = gk20a_channel_semaphore_incr_user; sema->ops.set_min_eq_max = gk20a_channel_semaphore_set_min_eq_max; sema->ops.signal_timeline = gk20a_channel_semaphore_signal_timeline; + sema->ops.syncpt_id = gk20a_channel_semaphore_syncpt_id; sema->ops.destroy = gk20a_channel_semaphore_destroy; /* Aggressively destroying the semaphore sync would cause overhead diff --git a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.h b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.h index a3cd8208..a347cbab 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); + /* Returns the sync point id or negative number if no syncpt*/ + int (*syncpt_id)(struct gk20a_channel_sync *s); + /* flag to set sync destroy aggressiveness */ bool aggressive_destroy; diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index 2b905dcc..7e919e2e 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h @@ -217,6 +217,7 @@ struct gpu_ops { void (*free_inst)(struct gk20a *g, struct channel_gk20a *ch); int (*setup_ramfc)(struct channel_gk20a *c, u64 gpfifo_base, u32 gpfifo_entries); + int (*resetup_ramfc)(struct channel_gk20a *c); int (*preempt_channel)(struct gk20a *g, u32 hw_chid); int (*update_runlist)(struct gk20a *g, u32 runlist_id, u32 hw_chid, bool add, -- cgit v1.2.2