summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
diff options
context:
space:
mode:
authorArto Merilainen <amerilainen@nvidia.com>2014-07-21 03:13:26 -0400
committerDan Willemsen <dwillemsen@nvidia.com>2015-03-18 15:10:32 -0400
commit61e918910326e84ca652649ee3b5036949d36fc3 (patch)
tree20b1473d21ffc3901a9788880195044d19d76d38 /drivers/gpu/nvgpu/gk20a/channel_gk20a.c
parenta84dc62b5ef54d6f714172359a4e0fe68f8802ca (diff)
gpu: nvgpu: gk20a: Allow in-kernel channel alloc
This patch modifies channel interfaces to allow allocating the channel for kernel use. This is needed if we want to run a shader from kernel space. Bug 1409151 Change-Id: I3544186bb1541120f85e01a19de106ef011c1b11 Signed-off-by: Arto Merilainen <amerilainen@nvidia.com> Reviewed-on: http://git-master/r/440261 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Lauri Peltonen <lpeltonen@nvidia.com> GVS: Gerrit_Virtual_Submit
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/channel_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_gk20a.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
index c43798b5..ef3d8729 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
@@ -59,7 +59,6 @@ static int channel_gk20a_setup_ramfc(struct channel_gk20a *c,
59 u64 gpfifo_base, u32 gpfifo_entries); 59 u64 gpfifo_base, u32 gpfifo_entries);
60 60
61static void channel_gk20a_bind(struct channel_gk20a *ch_gk20a); 61static void channel_gk20a_bind(struct channel_gk20a *ch_gk20a);
62static void channel_gk20a_unbind(struct channel_gk20a *ch_gk20a);
63 62
64static int channel_gk20a_alloc_inst(struct gk20a *g, 63static int channel_gk20a_alloc_inst(struct gk20a *g,
65 struct channel_gk20a *ch); 64 struct channel_gk20a *ch);
@@ -323,7 +322,7 @@ static void channel_gk20a_bind(struct channel_gk20a *ch_gk20a)
323 ccsr_channel_enable_set_true_f()); 322 ccsr_channel_enable_set_true_f());
324} 323}
325 324
326static void channel_gk20a_unbind(struct channel_gk20a *ch_gk20a) 325void channel_gk20a_unbind(struct channel_gk20a *ch_gk20a)
327{ 326{
328 struct gk20a *g = ch_gk20a->g; 327 struct gk20a *g = ch_gk20a->g;
329 328
@@ -632,7 +631,7 @@ void gk20a_free_channel(struct channel_gk20a *ch, bool finish)
632 if (!ch->bound) 631 if (!ch->bound)
633 return; 632 return;
634 633
635 if (!gk20a_channel_as_bound(ch)) 634 if (!gk20a_channel_as_bound(ch) && !ch->vm)
636 goto unbind; 635 goto unbind;
637 636
638 gk20a_dbg_info("freeing bound channel context, timeout=%ld", 637 gk20a_dbg_info("freeing bound channel context, timeout=%ld",
@@ -674,7 +673,10 @@ void gk20a_free_channel(struct channel_gk20a *ch, bool finish)
674 } 673 }
675 674
676 /* release channel binding to the as_share */ 675 /* release channel binding to the as_share */
677 gk20a_as_release_share(ch_vm->as_share); 676 if (ch_vm->as_share)
677 gk20a_as_release_share(ch_vm->as_share);
678 else
679 gk20a_vm_put(ch_vm);
678 680
679unbind: 681unbind:
680 channel_gk20a_unbind(ch); 682 channel_gk20a_unbind(ch);
@@ -723,7 +725,7 @@ int gk20a_channel_release(struct inode *inode, struct file *filp)
723 return 0; 725 return 0;
724} 726}
725 727
726static struct channel_gk20a *gk20a_open_new_channel(struct gk20a *g) 728struct channel_gk20a *gk20a_open_new_channel(struct gk20a *g)
727{ 729{
728 struct fifo_gk20a *f = &g->fifo; 730 struct fifo_gk20a *f = &g->fifo;
729 struct channel_gk20a *ch; 731 struct channel_gk20a *ch;
@@ -1088,8 +1090,8 @@ static void recycle_priv_cmdbuf(struct channel_gk20a *c)
1088} 1090}
1089 1091
1090 1092
1091static int gk20a_alloc_channel_gpfifo(struct channel_gk20a *c, 1093int gk20a_alloc_channel_gpfifo(struct channel_gk20a *c,
1092 struct nvhost_alloc_gpfifo_args *args) 1094 struct nvhost_alloc_gpfifo_args *args)
1093{ 1095{
1094 struct gk20a *g = c->g; 1096 struct gk20a *g = c->g;
1095 struct device *d = dev_from_gk20a(g); 1097 struct device *d = dev_from_gk20a(g);
@@ -1472,7 +1474,7 @@ void add_wait_cmd(u32 *ptr, u32 id, u32 thresh)
1472 ptr[3] = (id << 8) | 0x10; 1474 ptr[3] = (id << 8) | 0x10;
1473} 1475}
1474 1476
1475static int gk20a_submit_channel_gpfifo(struct channel_gk20a *c, 1477int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
1476 struct nvhost_gpfifo *gpfifo, 1478 struct nvhost_gpfifo *gpfifo,
1477 u32 num_entries, 1479 u32 num_entries,
1478 struct nvhost_fence *fence, 1480 struct nvhost_fence *fence,
@@ -1519,7 +1521,8 @@ static int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
1519 c->hw_chid, 1521 c->hw_chid,
1520 num_entries, 1522 num_entries,
1521 flags, 1523 flags,
1522 fence->syncpt_id, fence->value); 1524 fence ? fence->syncpt_id : 0,
1525 fence ? fence->value : 0);
1523 check_gp_put(g, c); 1526 check_gp_put(g, c);
1524 update_gp_get(g, c); 1527 update_gp_get(g, c);
1525 1528
@@ -1669,7 +1672,8 @@ static int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
1669 c->hw_chid, 1672 c->hw_chid,
1670 num_entries, 1673 num_entries,
1671 flags, 1674 flags,
1672 fence->syncpt_id, fence->value); 1675 fence ? fence->syncpt_id : 0,
1676 fence ? fence->value : 0);
1673 1677
1674 gk20a_dbg_info("post-submit put %d, get %d, size %d", 1678 gk20a_dbg_info("post-submit put %d, get %d, size %d",
1675 c->gpfifo.put, c->gpfifo.get, c->gpfifo.entry_num); 1679 c->gpfifo.put, c->gpfifo.get, c->gpfifo.entry_num);