diff options
author | Terje Bergstrom <tbergstrom@nvidia.com> | 2015-04-23 16:28:52 -0400 |
---|---|---|
committer | Alexander Van Brunt <avanbrunt@nvidia.com> | 2015-05-05 16:55:41 -0400 |
commit | 06be77da376f71ac9c73087ac02565cb6eec0eca (patch) | |
tree | bf0e5fe06d91cf33f7dc28d82fd8a9aa53d0defd | |
parent | 9bbffa11de08a96f7f0f1df887bca1e22a85e0f0 (diff) |
gpu: nvgpu: Do not send WFI when finishing channel
The channel teardown process sends a WFI method to ensure that all
work has been completed. But we also preempt the channel a while
later, which also ensures that all work is completed.
Remove the code for submitting WFI, and rely on preemption to handle
idling the pipe.
Change-Id: I2af029184440ee73e70d377f15690ddaf9b8599f
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/735067
Reviewed-on: http://git-master/r/737527
Reviewed-by: Alexander Van Brunt <avanbrunt@nvidia.com>
Tested-by: Alexander Van Brunt <avanbrunt@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index 1a5cf5c4..444a1c2f 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c | |||
@@ -1223,77 +1223,6 @@ bool gk20a_channel_update_and_check_timeout(struct channel_gk20a *ch, | |||
1223 | ch->timeout_accumulated_ms > ch->timeout_ms_max; | 1223 | ch->timeout_accumulated_ms > ch->timeout_ms_max; |
1224 | } | 1224 | } |
1225 | 1225 | ||
1226 | |||
1227 | /* Issue a syncpoint increment *preceded* by a wait-for-idle | ||
1228 | * command. All commands on the channel will have been | ||
1229 | * consumed at the time the fence syncpoint increment occurs. | ||
1230 | */ | ||
1231 | static int gk20a_channel_submit_wfi(struct channel_gk20a *c) | ||
1232 | { | ||
1233 | struct priv_cmd_entry *cmd = NULL; | ||
1234 | struct gk20a *g = c->g; | ||
1235 | u32 free_count; | ||
1236 | int err = 0; | ||
1237 | |||
1238 | if (c->has_timedout) | ||
1239 | return -ETIMEDOUT; | ||
1240 | |||
1241 | update_gp_get(g, c); | ||
1242 | free_count = gp_free_count(c); | ||
1243 | if (unlikely(!free_count)) { | ||
1244 | gk20a_err(dev_from_gk20a(g), | ||
1245 | "not enough gpfifo space"); | ||
1246 | return -EAGAIN; | ||
1247 | } | ||
1248 | |||
1249 | mutex_lock(&c->submit_lock); | ||
1250 | |||
1251 | if (!c->sync) { | ||
1252 | c->sync = gk20a_channel_sync_create(c); | ||
1253 | if (!c->sync) { | ||
1254 | mutex_unlock(&c->submit_lock); | ||
1255 | return -ENOMEM; | ||
1256 | } | ||
1257 | if (g->ops.fifo.resetup_ramfc) | ||
1258 | err = g->ops.fifo.resetup_ramfc(c); | ||
1259 | if (err) | ||
1260 | return err; | ||
1261 | } | ||
1262 | |||
1263 | gk20a_fence_put(c->last_submit.pre_fence); | ||
1264 | gk20a_fence_put(c->last_submit.post_fence); | ||
1265 | c->last_submit.pre_fence = NULL; | ||
1266 | c->last_submit.post_fence = NULL; | ||
1267 | |||
1268 | err = c->sync->incr_wfi(c->sync, &cmd, &c->last_submit.post_fence); | ||
1269 | if (unlikely(err)) { | ||
1270 | mutex_unlock(&c->submit_lock); | ||
1271 | return err; | ||
1272 | } | ||
1273 | |||
1274 | WARN_ON(!c->last_submit.post_fence->wfi); | ||
1275 | |||
1276 | ((struct gpfifo *)(c->gpfifo.mem.cpu_va))[c->gpfifo.put].entry0 = u64_lo32(cmd->gva); | ||
1277 | ((struct gpfifo *)(c->gpfifo.mem.cpu_va))[c->gpfifo.put].entry1 = u64_hi32(cmd->gva) | | ||
1278 | pbdma_gp_entry1_length_f(cmd->size); | ||
1279 | |||
1280 | c->gpfifo.put = (c->gpfifo.put + 1) & (c->gpfifo.entry_num - 1); | ||
1281 | |||
1282 | /* save gp_put */ | ||
1283 | cmd->gp_put = c->gpfifo.put; | ||
1284 | |||
1285 | gk20a_bar1_writel(g, | ||
1286 | c->userd_gpu_va + 4 * ram_userd_gp_put_w(), | ||
1287 | c->gpfifo.put); | ||
1288 | |||
1289 | mutex_unlock(&c->submit_lock); | ||
1290 | |||
1291 | gk20a_dbg_info("post-submit put %d, get %d, size %d", | ||
1292 | c->gpfifo.put, c->gpfifo.get, c->gpfifo.entry_num); | ||
1293 | |||
1294 | return 0; | ||
1295 | } | ||
1296 | |||
1297 | static u32 get_gp_free_count(struct channel_gk20a *c) | 1226 | static u32 get_gp_free_count(struct channel_gk20a *c) |
1298 | { | 1227 | { |
1299 | update_gp_get(c->g, c); | 1228 | update_gp_get(c->g, c); |
@@ -1726,16 +1655,6 @@ int gk20a_channel_finish(struct channel_gk20a *ch, unsigned long timeout) | |||
1726 | if (ch->has_timedout) | 1655 | if (ch->has_timedout) |
1727 | return -ETIMEDOUT; | 1656 | return -ETIMEDOUT; |
1728 | 1657 | ||
1729 | if (!(fence && fence->wfi) && ch->obj_class != KEPLER_C) { | ||
1730 | gk20a_dbg_fn("issuing wfi, incr to finish the channel"); | ||
1731 | err = gk20a_channel_submit_wfi(ch); | ||
1732 | fence = ch->last_submit.post_fence; | ||
1733 | } | ||
1734 | if (err) | ||
1735 | return err; | ||
1736 | |||
1737 | BUG_ON(!(fence && fence->wfi) && ch->obj_class != KEPLER_C); | ||
1738 | |||
1739 | gk20a_dbg_fn("waiting for channel to finish thresh:%d sema:%p", | 1658 | gk20a_dbg_fn("waiting for channel to finish thresh:%d sema:%p", |
1740 | fence->syncpt_value, fence->semaphore); | 1659 | fence->syncpt_value, fence->semaphore); |
1741 | 1660 | ||