gpu: nvgpu: move bind/unbind from fifo to tsg

Moved the following HALs from fifo to tsg:
- tsg.bind_channel
- tsg.unbind_channel
- tsg.unbind_channel_check_hw_state
- tsg.unbind_channel_check_ctx_reload
- tsg.unbind_channel_check_eng_faulted

bind_channel and unbind_channel HALs are optional,
and only implemented for vgpu:
- vgpu_tsg_bind_channel
- vgpu_tsg_unbind_channel

Moved the following code from fifo to tsg:
- nvgpu_tsg_bind_channel
- nvgpu_tsg_unbind_channel
- nvgpu_tsg_unbind_channel_check_hw_state
- nvgpu_tsg_unbind_channel_check_ctx_reload
- gv11b_tsg_unbind_channel_check_eng_faulted

tsg is now explictly passed to bind/unbind operations,
along with ch

Jira NVGPU-2979

Change-Id: I337a3d73ceef5ff320b036b14739ef0e831a28ee
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2084029
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Thomas Fleury
2019-03-27 16:54:04 -07:00
committed by mobile promotions
parent ad0a7e77be
commit 75963b47f1
25 changed files with 265 additions and 254 deletions

View File

@@ -41,7 +41,7 @@ struct tsg_private {
struct tsg_gk20a *tsg;
};
static int gk20a_tsg_bind_channel_fd(struct tsg_gk20a *tsg, int ch_fd)
static int nvgpu_tsg_bind_channel_fd(struct tsg_gk20a *tsg, int ch_fd)
{
struct channel_gk20a *ch;
int err;
@@ -50,7 +50,7 @@ static int gk20a_tsg_bind_channel_fd(struct tsg_gk20a *tsg, int ch_fd)
if (!ch)
return -EINVAL;
err = ch->g->ops.fifo.tsg_bind_channel(tsg, ch);
err = nvgpu_tsg_bind_channel(tsg, ch);
gk20a_channel_put(ch);
return err;
@@ -113,7 +113,7 @@ static int gk20a_tsg_ioctl_bind_channel_ex(struct gk20a *g,
if (ch->subctx_id > CHANNEL_INFO_VEID0)
ch->runqueue_sel = 1;
err = ch->g->ops.fifo.tsg_bind_channel(tsg, ch);
err = nvgpu_tsg_bind_channel(tsg, ch);
ch_put:
gk20a_channel_put(ch);
idle:
@@ -123,21 +123,22 @@ mutex_release:
return err;
}
static int gk20a_tsg_unbind_channel_fd(struct tsg_gk20a *tsg, int ch_fd)
static int nvgpu_tsg_unbind_channel_fd(struct tsg_gk20a *tsg, int ch_fd)
{
struct channel_gk20a *ch;
int err = 0;
ch = gk20a_get_channel_from_file(ch_fd);
if (!ch)
if (!ch) {
return -EINVAL;
}
if (ch->tsgid != tsg->tsgid) {
if (tsg != tsg_gk20a_from_ch(ch)) {
err = -EINVAL;
goto out;
}
err = gk20a_tsg_unbind_channel(ch);
err = nvgpu_tsg_unbind_channel(tsg, ch);
/*
* Mark the channel unserviceable since channel unbound from TSG
@@ -644,7 +645,7 @@ long nvgpu_ioctl_tsg_dev_ioctl(struct file *filp, unsigned int cmd,
err = -EINVAL;
break;
}
err = gk20a_tsg_bind_channel_fd(tsg, ch_fd);
err = nvgpu_tsg_bind_channel_fd(tsg, ch_fd);
break;
}
@@ -669,7 +670,7 @@ long nvgpu_ioctl_tsg_dev_ioctl(struct file *filp, unsigned int cmd,
"failed to host gk20a for ioctl cmd: 0x%x", cmd);
break;
}
err = gk20a_tsg_unbind_channel_fd(tsg, ch_fd);
err = nvgpu_tsg_unbind_channel_fd(tsg, ch_fd);
gk20a_idle(g);
break;
}