From 2a502bdd5f3c93b87286456ca901ad43b0f14906 Mon Sep 17 00:00:00 2001 From: David Nieto Date: Mon, 13 Mar 2017 18:45:37 -0700 Subject: 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 Reviewed-on: http://git-master/r/1320194 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: svccoveritychecker Reviewed-by: Terje Bergstrom GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c | 45 ++++++++++++++++----------------- 1 file changed, 22 insertions(+), 23 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c') diff --git a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c index fb70c88b..0efbcf06 100644 --- a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c @@ -766,14 +766,14 @@ static int nvgpu_dbg_gpu_ioctl_clear_single_sm_error_state( if (sm_id >= gr->no_of_sm) return -EINVAL; - err = gk20a_busy(g->dev); + err = gk20a_busy(g); if (err) return err; err = gr_gk20a_elpg_protected_call(g, g->ops.gr.clear_sm_error_state(g, ch, sm_id)); - gk20a_idle(g->dev); + gk20a_idle(g); return err; } @@ -819,7 +819,7 @@ static int nvgpu_dbg_gpu_ioctl_write_single_sm_error_state( } } - err = gk20a_busy(g->dev); + err = gk20a_busy(g); if (err) goto err_free; @@ -827,7 +827,7 @@ static int nvgpu_dbg_gpu_ioctl_write_single_sm_error_state( g->ops.gr.update_sm_error_state(g, ch, sm_id, sm_error_state)); - gk20a_idle(g->dev); + gk20a_idle(g); err_free: kfree(sm_error_state); @@ -843,7 +843,7 @@ nvgpu_dbg_gpu_ioctl_suspend_resume_contexts(struct dbg_session_gk20a *dbg_s, int err = 0; int ctx_resident_ch_fd = -1; - err = gk20a_busy(g->dev); + err = gk20a_busy(g); if (err) return err; @@ -866,7 +866,7 @@ nvgpu_dbg_gpu_ioctl_suspend_resume_contexts(struct dbg_session_gk20a *dbg_s, args->resident_context_fd = ctx_resident_ch_fd; } - gk20a_idle(g->dev); + gk20a_idle(g); return err; } @@ -905,7 +905,7 @@ static int nvgpu_dbg_gpu_ioctl_access_fb_memory(struct dbg_session_gk20a *dbg_s, size = args->size; offset = 0; - err = gk20a_busy(g->dev); + err = gk20a_busy(g); if (err) goto fail_free_buffer; @@ -940,7 +940,7 @@ static int nvgpu_dbg_gpu_ioctl_access_fb_memory(struct dbg_session_gk20a *dbg_s, } fail_idle: - gk20a_idle(g->dev); + gk20a_idle(g); fail_free_buffer: nvgpu_big_free(g, buffer); fail_dmabuf_put: @@ -972,11 +972,11 @@ long gk20a_dbg_gpu_dev_ioctl(struct file *filp, unsigned int cmd, } if (!g->gr.sw_ready) { - err = gk20a_busy(g->dev); + err = gk20a_busy(g); if (err) return err; - gk20a_idle(g->dev); + gk20a_idle(g); } /* protect from threaded user space calls */ @@ -1283,7 +1283,7 @@ static int dbg_set_powergate(struct dbg_session_gk20a *dbg_s, u32 powermode) (g->dbg_powergating_disabled_refcount++ == 0)) { gk20a_dbg(gpu_dbg_gpu_dbg | gpu_dbg_fn, "module busy"); - err = gk20a_busy(g->dev); + err = gk20a_busy(g); if (err) return err; @@ -1338,7 +1338,7 @@ static int dbg_set_powergate(struct dbg_session_gk20a *dbg_s, u32 powermode) gk20a_pmu_pg_global_enable(g, true); gk20a_dbg(gpu_dbg_gpu_dbg | gpu_dbg_fn, "module idle"); - gk20a_idle(g->dev); + gk20a_idle(g); } dbg_s->is_pg_disabled = false; @@ -1381,7 +1381,7 @@ static int nvgpu_dbg_gpu_ioctl_smpc_ctxsw_mode(struct dbg_session_gk20a *dbg_s, gk20a_dbg_fn("%s smpc ctxsw mode = %d", dev_name(dbg_s->dev), args->mode); - err = gk20a_busy(g->dev); + err = gk20a_busy(g); if (err) { gk20a_err(dev_from_gk20a(g), "failed to poweron"); return err; @@ -1409,7 +1409,7 @@ static int nvgpu_dbg_gpu_ioctl_smpc_ctxsw_mode(struct dbg_session_gk20a *dbg_s, err = g->ops.regops.apply_smpc_war(dbg_s); clean_up: nvgpu_mutex_release(&g->dbg_sessions_lock); - gk20a_idle(g->dev); + gk20a_idle(g); return err; } @@ -1433,8 +1433,7 @@ static int nvgpu_dbg_gpu_ioctl_hwpm_ctxsw_mode(struct dbg_session_gk20a *dbg_s, "session doesn't have a valid reservation"); } - - err = gk20a_busy(g->dev); + err = gk20a_busy(g); if (err) { gk20a_err(dev_from_gk20a(g), "failed to poweron"); return err; @@ -1462,7 +1461,7 @@ static int nvgpu_dbg_gpu_ioctl_hwpm_ctxsw_mode(struct dbg_session_gk20a *dbg_s, */ clean_up: nvgpu_mutex_release(&g->dbg_sessions_lock); - gk20a_idle(g->dev); + gk20a_idle(g); return err; } @@ -1480,7 +1479,7 @@ static int nvgpu_dbg_gpu_ioctl_suspend_resume_sm( if (!ch) return -EINVAL; - err = gk20a_busy(g->dev); + err = gk20a_busy(g); if (err) { gk20a_err(dev_from_gk20a(g), "failed to poweron"); return err; @@ -1512,7 +1511,7 @@ static int nvgpu_dbg_gpu_ioctl_suspend_resume_sm( clean_up: nvgpu_mutex_release(&g->dbg_sessions_lock); - gk20a_idle(g->dev); + gk20a_idle(g); return err; } @@ -1807,7 +1806,7 @@ static int gk20a_perfbuf_map(struct dbg_session_gk20a *dbg_s, goto fail_unmap; } - err = gk20a_busy(g->dev); + err = gk20a_busy(g); if (err) { gk20a_err(dev_from_gk20a(g), "failed to poweron"); goto fail_unmap; @@ -1830,7 +1829,7 @@ static int gk20a_perfbuf_map(struct dbg_session_gk20a *dbg_s, perf_pmasys_mem_block_valid_true_f() | perf_pmasys_mem_block_target_lfb_f()); - gk20a_idle(g->dev); + gk20a_idle(g); return 0; @@ -1848,7 +1847,7 @@ static int gk20a_perfbuf_unmap(struct dbg_session_gk20a *dbg_s, if (!g->allow_all) return -EACCES; - err = gk20a_busy(g->dev); + err = gk20a_busy(g); if (err) { gk20a_err(dev_from_gk20a(g), "failed to poweron"); return err; @@ -1864,7 +1863,7 @@ static int gk20a_perfbuf_unmap(struct dbg_session_gk20a *dbg_s, perf_pmasys_mem_block_valid_false_f() | perf_pmasys_mem_block_target_f(0)); - gk20a_idle(g->dev); + gk20a_idle(g); gk20a_vm_unmap_buffer(&g->mm.pmu.vm, args->offset, NULL); -- cgit v1.2.2