diff options
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 24 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_gk20a.h | 11 |
2 files changed, 25 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 | ||
61 | static void channel_gk20a_bind(struct channel_gk20a *ch_gk20a); | 61 | static void channel_gk20a_bind(struct channel_gk20a *ch_gk20a); |
62 | static void channel_gk20a_unbind(struct channel_gk20a *ch_gk20a); | ||
63 | 62 | ||
64 | static int channel_gk20a_alloc_inst(struct gk20a *g, | 63 | static 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 | ||
326 | static void channel_gk20a_unbind(struct channel_gk20a *ch_gk20a) | 325 | void 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 | ||
679 | unbind: | 681 | unbind: |
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 | ||
726 | static struct channel_gk20a *gk20a_open_new_channel(struct gk20a *g) | 728 | struct 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 | ||
1091 | static int gk20a_alloc_channel_gpfifo(struct channel_gk20a *c, | 1093 | int 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 | ||
1475 | static int gk20a_submit_channel_gpfifo(struct channel_gk20a *c, | 1477 | int 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); |
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h index 08bc06c2..161d2b83 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h | |||
@@ -178,5 +178,16 @@ void gk20a_channel_update(struct channel_gk20a *c, int nr_completed); | |||
178 | void gk20a_init_channel(struct gpu_ops *gops); | 178 | void gk20a_init_channel(struct gpu_ops *gops); |
179 | 179 | ||
180 | int gk20a_wait_channel_idle(struct channel_gk20a *ch); | 180 | int gk20a_wait_channel_idle(struct channel_gk20a *ch); |
181 | struct channel_gk20a *gk20a_open_new_channel(struct gk20a *g); | ||
182 | void channel_gk20a_unbind(struct channel_gk20a *ch_gk20a); | ||
183 | |||
184 | int gk20a_submit_channel_gpfifo(struct channel_gk20a *c, | ||
185 | struct nvhost_gpfifo *gpfifo, | ||
186 | u32 num_entries, | ||
187 | struct nvhost_fence *fence, | ||
188 | u32 flags); | ||
189 | |||
190 | int gk20a_alloc_channel_gpfifo(struct channel_gk20a *c, | ||
191 | struct nvhost_alloc_gpfifo_args *args); | ||
181 | 192 | ||
182 | #endif /*__CHANNEL_GK20A_H__*/ | 193 | #endif /*__CHANNEL_GK20A_H__*/ |