summaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2014-04-01 01:28:44 -0400
committerDan Willemsen <dwillemsen@nvidia.com>2015-03-18 15:09:53 -0400
commit2fbf6e7afb316d698d0062828876eeed1a1b43b2 (patch)
treefacd78d1a24f074e5b4894169ae3ef30ef651d97 /drivers/gpu
parentaf8c1dc3a834850512f1fba863077048a3e14f21 (diff)
gpu: nvgpu: Allow suppressing WFI on submit
Allow suppressing WFI when submitting work and requesting a fence back. Bug 1491545 Change-Id: Ic3d061bb4f116cf7ea68dbd6a1b2ace9f11d0ab5 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/390457
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_gk20a.c9
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c10
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.h2
3 files changed, 16 insertions, 5 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
index 61938f8e..cf239b55 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
@@ -1450,6 +1450,7 @@ static int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
1450 /* we might need two extra gpfifo entries - one for pre fence 1450 /* we might need two extra gpfifo entries - one for pre fence
1451 * and one for post fence. */ 1451 * and one for post fence. */
1452 const int extra_entries = 2; 1452 const int extra_entries = 2;
1453 bool need_wfi = !(flags & NVHOST_SUBMIT_GPFIFO_FLAGS_SUPPRESS_WFI);
1453 1454
1454 if (c->has_timedout) 1455 if (c->has_timedout)
1455 return -ETIMEDOUT; 1456 return -ETIMEDOUT;
@@ -1549,10 +1550,12 @@ static int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
1549 flags & NVHOST_SUBMIT_GPFIFO_FLAGS_SYNC_FENCE) 1550 flags & NVHOST_SUBMIT_GPFIFO_FLAGS_SYNC_FENCE)
1550 err = c->sync->incr_user_fd(c->sync, &incr_cmd, 1551 err = c->sync->incr_user_fd(c->sync, &incr_cmd,
1551 &c->last_submit_fence, 1552 &c->last_submit_fence,
1553 need_wfi,
1552 &fence->syncpt_id); 1554 &fence->syncpt_id);
1553 else if (flags & NVHOST_SUBMIT_GPFIFO_FLAGS_FENCE_GET) 1555 else if (flags & NVHOST_SUBMIT_GPFIFO_FLAGS_FENCE_GET)
1554 err = c->sync->incr_user_syncpt(c->sync, &incr_cmd, 1556 err = c->sync->incr_user_syncpt(c->sync, &incr_cmd,
1555 &c->last_submit_fence, 1557 &c->last_submit_fence,
1558 need_wfi,
1556 &fence->syncpt_id, 1559 &fence->syncpt_id,
1557 &fence->value); 1560 &fence->value);
1558 else 1561 else
@@ -1569,7 +1572,8 @@ static int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
1569 c->gpfifo.cpu_va[c->gpfifo.put].entry1 = 1572 c->gpfifo.cpu_va[c->gpfifo.put].entry1 =
1570 u64_hi32(wait_cmd->gva) | 1573 u64_hi32(wait_cmd->gva) |
1571 pbdma_gp_entry1_length_f(wait_cmd->size); 1574 pbdma_gp_entry1_length_f(wait_cmd->size);
1572 trace_write_pushbuffer(c, &c->gpfifo.cpu_va[c->gpfifo.put]); 1575 trace_gk20a_push_cmdbuf(c->g->dev->name,
1576 0, wait_cmd->size, 0, wait_cmd->ptr);
1573 1577
1574 c->gpfifo.put = (c->gpfifo.put + 1) & 1578 c->gpfifo.put = (c->gpfifo.put + 1) &
1575 (c->gpfifo.entry_num - 1); 1579 (c->gpfifo.entry_num - 1);
@@ -1594,7 +1598,8 @@ static int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
1594 c->gpfifo.cpu_va[c->gpfifo.put].entry1 = 1598 c->gpfifo.cpu_va[c->gpfifo.put].entry1 =
1595 u64_hi32(incr_cmd->gva) | 1599 u64_hi32(incr_cmd->gva) |
1596 pbdma_gp_entry1_length_f(incr_cmd->size); 1600 pbdma_gp_entry1_length_f(incr_cmd->size);
1597 trace_write_pushbuffer(c, &c->gpfifo.cpu_va[c->gpfifo.put]); 1601 trace_gk20a_push_cmdbuf(c->g->dev->name,
1602 0, incr_cmd->size, 0, incr_cmd->ptr);
1598 1603
1599 c->gpfifo.put = (c->gpfifo.put + 1) & 1604 c->gpfifo.put = (c->gpfifo.put + 1) &
1600 (c->gpfifo.entry_num - 1); 1605 (c->gpfifo.entry_num - 1);
diff --git a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c
index 10a1001e..f91dd52d 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c
@@ -279,6 +279,7 @@ int gk20a_channel_syncpt_incr(struct gk20a_channel_sync *s,
279int gk20a_channel_syncpt_incr_user_syncpt(struct gk20a_channel_sync *s, 279int gk20a_channel_syncpt_incr_user_syncpt(struct gk20a_channel_sync *s,
280 struct priv_cmd_entry **entry, 280 struct priv_cmd_entry **entry,
281 struct gk20a_channel_fence *fence, 281 struct gk20a_channel_fence *fence,
282 bool wfi,
282 u32 *id, u32 *thresh) 283 u32 *id, u32 *thresh)
283{ 284{
284 struct gk20a_channel_syncpt *sp = 285 struct gk20a_channel_syncpt *sp =
@@ -286,8 +287,10 @@ int gk20a_channel_syncpt_incr_user_syncpt(struct gk20a_channel_sync *s,
286 /* Need to do 'host incr + wfi' or 'gfx incr' since we return the fence 287 /* Need to do 'host incr + wfi' or 'gfx incr' since we return the fence
287 * to user space. */ 288 * to user space. */
288 int err = __gk20a_channel_syncpt_incr(s, 289 int err = __gk20a_channel_syncpt_incr(s,
289 sp->c->obj_class == KEPLER_C /* use gfx class? */, 290 wfi &&
290 sp->c->obj_class != KEPLER_C /* wfi if host class */, 291 sp->c->obj_class == KEPLER_C /* use gfx class? */,
292 wfi &&
293 sp->c->obj_class != KEPLER_C /* wfi if host class */,
291 true /* register irq */, 294 true /* register irq */,
292 entry, fence); 295 entry, fence);
293 if (err) 296 if (err)
@@ -300,6 +303,7 @@ int gk20a_channel_syncpt_incr_user_syncpt(struct gk20a_channel_sync *s,
300int gk20a_channel_syncpt_incr_user_fd(struct gk20a_channel_sync *s, 303int gk20a_channel_syncpt_incr_user_fd(struct gk20a_channel_sync *s,
301 struct priv_cmd_entry **entry, 304 struct priv_cmd_entry **entry,
302 struct gk20a_channel_fence *fence, 305 struct gk20a_channel_fence *fence,
306 bool wfi,
303 int *fd) 307 int *fd)
304{ 308{
305#ifdef CONFIG_SYNC 309#ifdef CONFIG_SYNC
@@ -307,7 +311,7 @@ int gk20a_channel_syncpt_incr_user_fd(struct gk20a_channel_sync *s,
307 struct nvhost_ctrl_sync_fence_info pt; 311 struct nvhost_ctrl_sync_fence_info pt;
308 struct gk20a_channel_syncpt *sp = 312 struct gk20a_channel_syncpt *sp =
309 container_of(s, struct gk20a_channel_syncpt, ops); 313 container_of(s, struct gk20a_channel_syncpt, ops);
310 err = gk20a_channel_syncpt_incr_user_syncpt(s, entry, fence, 314 err = gk20a_channel_syncpt_incr_user_syncpt(s, entry, fence, wfi,
311 &pt.id, &pt.thresh); 315 &pt.id, &pt.thresh);
312 if (err) 316 if (err)
313 return err; 317 return err;
diff --git a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.h b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.h
index 80f38b26..90b61bfd 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.h
@@ -77,6 +77,7 @@ struct gk20a_channel_sync {
77 int (*incr_user_syncpt)(struct gk20a_channel_sync *s, 77 int (*incr_user_syncpt)(struct gk20a_channel_sync *s,
78 struct priv_cmd_entry **entry, 78 struct priv_cmd_entry **entry,
79 struct gk20a_channel_fence *fence, 79 struct gk20a_channel_fence *fence,
80 bool wfi,
80 u32 *id, u32 *thresh); 81 u32 *id, u32 *thresh);
81 82
82 /* Increment syncpoint/semaphore, so that the returned fence represents 83 /* Increment syncpoint/semaphore, so that the returned fence represents
@@ -89,6 +90,7 @@ struct gk20a_channel_sync {
89 int (*incr_user_fd)(struct gk20a_channel_sync *s, 90 int (*incr_user_fd)(struct gk20a_channel_sync *s,
90 struct priv_cmd_entry **entry, 91 struct priv_cmd_entry **entry,
91 struct gk20a_channel_fence *fence, 92 struct gk20a_channel_fence *fence,
93 bool wfi,
92 int *fd); 94 int *fd);
93 95
94 /* Reset the channel syncpoint/semaphore. */ 96 /* Reset the channel syncpoint/semaphore. */