From afe12a49f7c61b5725113e2b9d2a5121d7913383 Mon Sep 17 00:00:00 2001 From: Konsta Holtta Date: Wed, 12 Apr 2017 15:29:37 +0300 Subject: gpu: nvgpu: add missing busy calls for ctrl ioctls The following ioctls: - NVGPU_GPU_IOCTL_WAIT_FOR_PAUSE - NVGPU_GPU_IOCTL_RESUME_FROM_PAUSE - NVGPU_GPU_IOCTL_TRIGGER_SUSPEND - NVGPU_GPU_IOCTL_CLEAR_SM_ERRORS access hardware registers, so they should make sure that the gpu is powered on first. Add gk20a_{busy,idle}() pairs for them. Bug 1849661 Change-Id: I7deabf4a2c1c7d069a6134233f8e86df0a2722c8 Signed-off-by: Konsta Holtta Reviewed-on: http://git-master/r/1461449 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c | 39 ++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) (limited to 'drivers/gpu/nvgpu') diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c b/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c index b5a79ecd..0546658d 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c @@ -393,16 +393,23 @@ static int nvgpu_gpu_ioctl_trigger_suspend(struct gk20a *g) { int err; + err = gk20a_busy(g); + if (err) + return err; + nvgpu_mutex_acquire(&g->dbg_sessions_lock); err = g->ops.gr.trigger_suspend(g); nvgpu_mutex_release(&g->dbg_sessions_lock); + + gk20a_idle(g); + return err; } static int nvgpu_gpu_ioctl_wait_for_pause(struct gk20a *g, struct nvgpu_gpu_wait_pause_args *args) { - int err = 0; + int err; struct warpstate *w_state; u32 sm_count, size; @@ -412,6 +419,10 @@ static int nvgpu_gpu_ioctl_wait_for_pause(struct gk20a *g, if (!w_state) return -ENOMEM; + err = gk20a_busy(g); + if (err) + goto out_free; + nvgpu_mutex_acquire(&g->dbg_sessions_lock); g->ops.gr.wait_for_pause(g, w_state); @@ -422,23 +433,45 @@ static int nvgpu_gpu_ioctl_wait_for_pause(struct gk20a *g, } nvgpu_mutex_release(&g->dbg_sessions_lock); + + gk20a_idle(g); + +out_free: nvgpu_kfree(g, w_state); + return err; } static int nvgpu_gpu_ioctl_resume_from_pause(struct gk20a *g) { - int err = 0; + int err; + + err = gk20a_busy(g); + if (err) + return err; nvgpu_mutex_acquire(&g->dbg_sessions_lock); err = g->ops.gr.resume_from_pause(g); nvgpu_mutex_release(&g->dbg_sessions_lock); + + gk20a_idle(g); + return err; } static int nvgpu_gpu_ioctl_clear_sm_errors(struct gk20a *g) { - return g->ops.gr.clear_sm_errors(g); + int err; + + err = gk20a_busy(g); + if (err) + return err; + + err = g->ops.gr.clear_sm_errors(g); + + gk20a_idle(g); + + return err; } static int nvgpu_gpu_ioctl_has_any_exception( -- cgit v1.2.2