mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-25 11:04:51 +03:00
gpu: nvgpu: pass gk20a struct to gk20a_busy
After driver remove, the device structure passed in gk20a_busy can be
invalid. To solve this the prototype of the function is modified to pass
the gk20a struct instead of the device pointer.
bug 200277762
JIRA: EVLR-1023
Change-Id: I08eb74bd3578834d45115098ed9936ebbb436fdf
Signed-off-by: David Nieto <dmartineznie@nvidia.com>
Reviewed-on: http://git-master/r/1320194
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
GVS: Gerrit_Virtual_Submit
(cherry picked from commit 2a502bdd5f)
Reviewed-on: http://git-master/r/1327754
Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
ecd71ed447
commit
83721dfab9
@@ -1231,7 +1231,7 @@ int gk20a_channel_release(struct inode *inode, struct file *filp)
|
||||
|
||||
int err;
|
||||
|
||||
err = gk20a_busy(g->dev);
|
||||
err = gk20a_busy(g);
|
||||
if (err) {
|
||||
gk20a_err(dev_from_gk20a(g), "failed to release a channel!");
|
||||
goto channel_release;
|
||||
@@ -1240,7 +1240,7 @@ int gk20a_channel_release(struct inode *inode, struct file *filp)
|
||||
trace_gk20a_channel_release(dev_name(g->dev));
|
||||
|
||||
gk20a_channel_close(ch);
|
||||
gk20a_idle(g->dev);
|
||||
gk20a_idle(g);
|
||||
|
||||
channel_release:
|
||||
gk20a_put(g);
|
||||
@@ -1396,14 +1396,14 @@ static int __gk20a_channel_open(struct gk20a *g, struct file *filp, s32 runlist_
|
||||
goto free_ref;
|
||||
}
|
||||
|
||||
err = gk20a_busy(g->dev);
|
||||
err = gk20a_busy(g);
|
||||
if (err) {
|
||||
gk20a_err(dev_from_gk20a(g), "failed to power on, %d", err);
|
||||
goto fail_busy;
|
||||
}
|
||||
/* All the user space channel should be non privilege */
|
||||
ch = gk20a_open_new_channel(g, runlist_id, false);
|
||||
gk20a_idle(g->dev);
|
||||
gk20a_idle(g);
|
||||
if (!ch) {
|
||||
gk20a_err(dev_from_gk20a(g),
|
||||
"failed to get f");
|
||||
@@ -2698,7 +2698,7 @@ static void gk20a_channel_clean_up_jobs(struct channel_gk20a *c,
|
||||
|
||||
channel_gk20a_free_job(c, job);
|
||||
job_finished = 1;
|
||||
gk20a_idle(g->dev);
|
||||
gk20a_idle(g);
|
||||
|
||||
if (!clean_all) {
|
||||
/* Timeout isn't supported here so don't touch it. */
|
||||
@@ -3126,7 +3126,7 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
|
||||
return -EINVAL;
|
||||
|
||||
/* released by job cleanup via syncpt or sema interrupt */
|
||||
err = gk20a_busy(g->dev);
|
||||
err = gk20a_busy(g);
|
||||
if (err) {
|
||||
gk20a_err(d, "failed to host gk20a to submit gpfifo, process %s",
|
||||
current->comm);
|
||||
@@ -3233,7 +3233,7 @@ clean_up:
|
||||
gk20a_fence_put(pre_fence);
|
||||
gk20a_fence_put(post_fence);
|
||||
if (need_deferred_cleanup)
|
||||
gk20a_idle(g->dev);
|
||||
gk20a_idle(g);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -3890,7 +3890,8 @@ long gk20a_channel_ioctl(struct file *filp,
|
||||
{
|
||||
struct channel_priv *priv = filp->private_data;
|
||||
struct channel_gk20a *ch = priv->c;
|
||||
struct device *dev = ch->g->dev;
|
||||
struct gk20a *g = ch->g;
|
||||
struct device *dev = g->dev;
|
||||
u8 buf[NVGPU_IOCTL_CHANNEL_MAX_ARG_SIZE] = {0};
|
||||
int err = 0;
|
||||
|
||||
@@ -3927,7 +3928,7 @@ long gk20a_channel_ioctl(struct file *filp,
|
||||
case NVGPU_IOCTL_CHANNEL_SET_NVMAP_FD:
|
||||
break;
|
||||
case NVGPU_IOCTL_CHANNEL_ALLOC_OBJ_CTX:
|
||||
err = gk20a_busy(dev);
|
||||
err = gk20a_busy(g);
|
||||
if (err) {
|
||||
dev_err(dev,
|
||||
"%s: failed to host gk20a for ioctl cmd: 0x%x",
|
||||
@@ -3936,14 +3937,14 @@ long gk20a_channel_ioctl(struct file *filp,
|
||||
}
|
||||
err = ch->g->ops.gr.alloc_obj_ctx(ch,
|
||||
(struct nvgpu_alloc_obj_ctx_args *)buf);
|
||||
gk20a_idle(dev);
|
||||
gk20a_idle(g);
|
||||
break;
|
||||
case NVGPU_IOCTL_CHANNEL_ALLOC_GPFIFO_EX:
|
||||
{
|
||||
struct nvgpu_alloc_gpfifo_ex_args *alloc_gpfifo_ex_args =
|
||||
(struct nvgpu_alloc_gpfifo_ex_args *)buf;
|
||||
|
||||
err = gk20a_busy(dev);
|
||||
err = gk20a_busy(g);
|
||||
if (err) {
|
||||
dev_err(dev,
|
||||
"%s: failed to host gk20a for ioctl cmd: 0x%x",
|
||||
@@ -3953,11 +3954,11 @@ long gk20a_channel_ioctl(struct file *filp,
|
||||
|
||||
if (!is_power_of_2(alloc_gpfifo_ex_args->num_entries)) {
|
||||
err = -EINVAL;
|
||||
gk20a_idle(dev);
|
||||
gk20a_idle(g);
|
||||
break;
|
||||
}
|
||||
err = gk20a_alloc_channel_gpfifo(ch, alloc_gpfifo_ex_args);
|
||||
gk20a_idle(dev);
|
||||
gk20a_idle(g);
|
||||
break;
|
||||
}
|
||||
case NVGPU_IOCTL_CHANNEL_ALLOC_GPFIFO:
|
||||
@@ -3966,7 +3967,7 @@ long gk20a_channel_ioctl(struct file *filp,
|
||||
struct nvgpu_alloc_gpfifo_args *alloc_gpfifo_args =
|
||||
(struct nvgpu_alloc_gpfifo_args *)buf;
|
||||
|
||||
err = gk20a_busy(dev);
|
||||
err = gk20a_busy(g);
|
||||
if (err) {
|
||||
dev_err(dev,
|
||||
"%s: failed to host gk20a for ioctl cmd: 0x%x",
|
||||
@@ -3987,7 +3988,7 @@ long gk20a_channel_ioctl(struct file *filp,
|
||||
alloc_gpfifo_ex_args.flags = alloc_gpfifo_args->flags;
|
||||
|
||||
err = gk20a_alloc_channel_gpfifo(ch, &alloc_gpfifo_ex_args);
|
||||
gk20a_idle(dev);
|
||||
gk20a_idle(g);
|
||||
break;
|
||||
}
|
||||
case NVGPU_IOCTL_CHANNEL_SUBMIT_GPFIFO:
|
||||
@@ -3995,7 +3996,7 @@ long gk20a_channel_ioctl(struct file *filp,
|
||||
(struct nvgpu_submit_gpfifo_args *)buf);
|
||||
break;
|
||||
case NVGPU_IOCTL_CHANNEL_WAIT:
|
||||
err = gk20a_busy(dev);
|
||||
err = gk20a_busy(g);
|
||||
if (err) {
|
||||
dev_err(dev,
|
||||
"%s: failed to host gk20a for ioctl cmd: 0x%x",
|
||||
@@ -4012,10 +4013,10 @@ long gk20a_channel_ioctl(struct file *filp,
|
||||
|
||||
nvgpu_mutex_acquire(&ch->ioctl_lock);
|
||||
|
||||
gk20a_idle(dev);
|
||||
gk20a_idle(g);
|
||||
break;
|
||||
case NVGPU_IOCTL_CHANNEL_ZCULL_BIND:
|
||||
err = gk20a_busy(dev);
|
||||
err = gk20a_busy(g);
|
||||
if (err) {
|
||||
dev_err(dev,
|
||||
"%s: failed to host gk20a for ioctl cmd: 0x%x",
|
||||
@@ -4024,10 +4025,10 @@ long gk20a_channel_ioctl(struct file *filp,
|
||||
}
|
||||
err = gk20a_channel_zcull_bind(ch,
|
||||
(struct nvgpu_zcull_bind_args *)buf);
|
||||
gk20a_idle(dev);
|
||||
gk20a_idle(g);
|
||||
break;
|
||||
case NVGPU_IOCTL_CHANNEL_SET_ERROR_NOTIFIER:
|
||||
err = gk20a_busy(dev);
|
||||
err = gk20a_busy(g);
|
||||
if (err) {
|
||||
dev_err(dev,
|
||||
"%s: failed to host gk20a for ioctl cmd: 0x%x",
|
||||
@@ -4036,11 +4037,11 @@ long gk20a_channel_ioctl(struct file *filp,
|
||||
}
|
||||
err = gk20a_init_error_notifier(ch,
|
||||
(struct nvgpu_set_error_notifier *)buf);
|
||||
gk20a_idle(dev);
|
||||
gk20a_idle(g);
|
||||
break;
|
||||
#ifdef CONFIG_GK20A_CYCLE_STATS
|
||||
case NVGPU_IOCTL_CHANNEL_CYCLE_STATS:
|
||||
err = gk20a_busy(dev);
|
||||
err = gk20a_busy(g);
|
||||
if (err) {
|
||||
dev_err(dev,
|
||||
"%s: failed to host gk20a for ioctl cmd: 0x%x",
|
||||
@@ -4049,7 +4050,7 @@ long gk20a_channel_ioctl(struct file *filp,
|
||||
}
|
||||
err = gk20a_channel_cycle_stats(ch,
|
||||
(struct nvgpu_cycle_stats_args *)buf);
|
||||
gk20a_idle(dev);
|
||||
gk20a_idle(g);
|
||||
break;
|
||||
#endif
|
||||
case NVGPU_IOCTL_CHANNEL_SET_TIMEOUT:
|
||||
@@ -4083,7 +4084,7 @@ long gk20a_channel_ioctl(struct file *filp,
|
||||
ch->has_timedout;
|
||||
break;
|
||||
case NVGPU_IOCTL_CHANNEL_SET_PRIORITY:
|
||||
err = gk20a_busy(dev);
|
||||
err = gk20a_busy(g);
|
||||
if (err) {
|
||||
dev_err(dev,
|
||||
"%s: failed to host gk20a for ioctl cmd: 0x%x",
|
||||
@@ -4093,12 +4094,12 @@ long gk20a_channel_ioctl(struct file *filp,
|
||||
err = ch->g->ops.fifo.channel_set_priority(ch,
|
||||
((struct nvgpu_set_priority_args *)buf)->priority);
|
||||
|
||||
gk20a_idle(dev);
|
||||
gk20a_idle(g);
|
||||
gk20a_channel_trace_sched_param(
|
||||
trace_gk20a_channel_set_priority, ch);
|
||||
break;
|
||||
case NVGPU_IOCTL_CHANNEL_ENABLE:
|
||||
err = gk20a_busy(dev);
|
||||
err = gk20a_busy(g);
|
||||
if (err) {
|
||||
dev_err(dev,
|
||||
"%s: failed to host gk20a for ioctl cmd: 0x%x",
|
||||
@@ -4109,10 +4110,10 @@ long gk20a_channel_ioctl(struct file *filp,
|
||||
ch->g->ops.fifo.enable_channel(ch);
|
||||
else
|
||||
err = -ENOSYS;
|
||||
gk20a_idle(dev);
|
||||
gk20a_idle(g);
|
||||
break;
|
||||
case NVGPU_IOCTL_CHANNEL_DISABLE:
|
||||
err = gk20a_busy(dev);
|
||||
err = gk20a_busy(g);
|
||||
if (err) {
|
||||
dev_err(dev,
|
||||
"%s: failed to host gk20a for ioctl cmd: 0x%x",
|
||||
@@ -4123,10 +4124,10 @@ long gk20a_channel_ioctl(struct file *filp,
|
||||
ch->g->ops.fifo.disable_channel(ch);
|
||||
else
|
||||
err = -ENOSYS;
|
||||
gk20a_idle(dev);
|
||||
gk20a_idle(g);
|
||||
break;
|
||||
case NVGPU_IOCTL_CHANNEL_PREEMPT:
|
||||
err = gk20a_busy(dev);
|
||||
err = gk20a_busy(g);
|
||||
if (err) {
|
||||
dev_err(dev,
|
||||
"%s: failed to host gk20a for ioctl cmd: 0x%x",
|
||||
@@ -4134,10 +4135,10 @@ long gk20a_channel_ioctl(struct file *filp,
|
||||
break;
|
||||
}
|
||||
err = gk20a_fifo_preempt(ch->g, ch);
|
||||
gk20a_idle(dev);
|
||||
gk20a_idle(g);
|
||||
break;
|
||||
case NVGPU_IOCTL_CHANNEL_FORCE_RESET:
|
||||
err = gk20a_busy(dev);
|
||||
err = gk20a_busy(g);
|
||||
if (err) {
|
||||
dev_err(dev,
|
||||
"%s: failed to host gk20a for ioctl cmd: 0x%x",
|
||||
@@ -4146,7 +4147,7 @@ long gk20a_channel_ioctl(struct file *filp,
|
||||
}
|
||||
err = ch->g->ops.fifo.force_reset_ch(ch,
|
||||
NVGPU_CHANNEL_RESETCHANNEL_VERIF_ERROR, true);
|
||||
gk20a_idle(dev);
|
||||
gk20a_idle(g);
|
||||
break;
|
||||
case NVGPU_IOCTL_CHANNEL_EVENT_ID_CTRL:
|
||||
err = gk20a_channel_event_id_ctrl(ch,
|
||||
@@ -4154,7 +4155,7 @@ long gk20a_channel_ioctl(struct file *filp,
|
||||
break;
|
||||
#ifdef CONFIG_GK20A_CYCLE_STATS
|
||||
case NVGPU_IOCTL_CHANNEL_CYCLE_STATS_SNAPSHOT:
|
||||
err = gk20a_busy(dev);
|
||||
err = gk20a_busy(g);
|
||||
if (err) {
|
||||
dev_err(dev,
|
||||
"%s: failed to host gk20a for ioctl cmd: 0x%x",
|
||||
@@ -4163,7 +4164,7 @@ long gk20a_channel_ioctl(struct file *filp,
|
||||
}
|
||||
err = gk20a_channel_cycle_stats_snapshot(ch,
|
||||
(struct nvgpu_cycle_stats_snapshot_args *)buf);
|
||||
gk20a_idle(dev);
|
||||
gk20a_idle(g);
|
||||
break;
|
||||
#endif
|
||||
case NVGPU_IOCTL_CHANNEL_WDT:
|
||||
@@ -4171,7 +4172,7 @@ long gk20a_channel_ioctl(struct file *filp,
|
||||
(struct nvgpu_channel_wdt_args *)buf);
|
||||
break;
|
||||
case NVGPU_IOCTL_CHANNEL_SET_RUNLIST_INTERLEAVE:
|
||||
err = gk20a_busy(dev);
|
||||
err = gk20a_busy(g);
|
||||
if (err) {
|
||||
dev_err(dev,
|
||||
"%s: failed to host gk20a for ioctl cmd: 0x%x",
|
||||
@@ -4181,12 +4182,12 @@ long gk20a_channel_ioctl(struct file *filp,
|
||||
err = gk20a_channel_set_runlist_interleave(ch,
|
||||
((struct nvgpu_runlist_interleave_args *)buf)->level);
|
||||
|
||||
gk20a_idle(dev);
|
||||
gk20a_idle(g);
|
||||
gk20a_channel_trace_sched_param(
|
||||
trace_gk20a_channel_set_runlist_interleave, ch);
|
||||
break;
|
||||
case NVGPU_IOCTL_CHANNEL_SET_TIMESLICE:
|
||||
err = gk20a_busy(dev);
|
||||
err = gk20a_busy(g);
|
||||
if (err) {
|
||||
dev_err(dev,
|
||||
"%s: failed to host gk20a for ioctl cmd: 0x%x",
|
||||
@@ -4196,13 +4197,13 @@ long gk20a_channel_ioctl(struct file *filp,
|
||||
err = ch->g->ops.fifo.channel_set_timeslice(ch,
|
||||
((struct nvgpu_timeslice_args *)buf)->timeslice_us);
|
||||
|
||||
gk20a_idle(dev);
|
||||
gk20a_idle(g);
|
||||
gk20a_channel_trace_sched_param(
|
||||
trace_gk20a_channel_set_timeslice, ch);
|
||||
break;
|
||||
case NVGPU_IOCTL_CHANNEL_SET_PREEMPTION_MODE:
|
||||
if (ch->g->ops.gr.set_preemption_mode) {
|
||||
err = gk20a_busy(dev);
|
||||
err = gk20a_busy(g);
|
||||
if (err) {
|
||||
dev_err(dev,
|
||||
"%s: failed to host gk20a for ioctl cmd: 0x%x",
|
||||
@@ -4212,7 +4213,7 @@ long gk20a_channel_ioctl(struct file *filp,
|
||||
err = ch->g->ops.gr.set_preemption_mode(ch,
|
||||
((struct nvgpu_preemption_mode_args *)buf)->graphics_preempt_mode,
|
||||
((struct nvgpu_preemption_mode_args *)buf)->compute_preempt_mode);
|
||||
gk20a_idle(dev);
|
||||
gk20a_idle(g);
|
||||
} else {
|
||||
err = -EINVAL;
|
||||
}
|
||||
@@ -4222,7 +4223,7 @@ long gk20a_channel_ioctl(struct file *filp,
|
||||
bool boost =
|
||||
((struct nvgpu_boosted_ctx_args *)buf)->boost;
|
||||
|
||||
err = gk20a_busy(dev);
|
||||
err = gk20a_busy(g);
|
||||
if (err) {
|
||||
dev_err(dev,
|
||||
"%s: failed to host gk20a for ioctl cmd: 0x%x",
|
||||
@@ -4230,7 +4231,7 @@ long gk20a_channel_ioctl(struct file *filp,
|
||||
break;
|
||||
}
|
||||
err = ch->g->ops.gr.set_boosted_ctx(ch, boost);
|
||||
gk20a_idle(dev);
|
||||
gk20a_idle(g);
|
||||
} else {
|
||||
err = -EINVAL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user