From 5c5b52dce54fa09d16ae38a232a0e17b4729b472 Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Fri, 13 Oct 2017 08:13:45 -0700 Subject: gpu: nvgpu: Use internal nvgpu_warpstate Replace use of ioctl structure warpstate with internal nvgpu_warptate. JIRA NVGPU-259 Change-Id: I5170364d0443235cee471b87fa332fc09588f5d3 Signed-off-by: Terje Bergstrom Reviewed-on: https://git-master.nvidia.com/r/1578684 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c | 37 ++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 6 deletions(-) (limited to 'drivers/gpu/nvgpu/common') diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c b/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c index 88c8debf..4bb79375 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c @@ -429,15 +429,24 @@ static int nvgpu_gpu_ioctl_wait_for_pause(struct gk20a *g, struct nvgpu_gpu_wait_pause_args *args) { int err; - struct warpstate *w_state; - u32 sm_count, size; + struct warpstate *ioctl_w_state; + struct nvgpu_warpstate *w_state = NULL; + u32 sm_count, ioctl_size, size, sm_id; sm_count = g->gr.gpc_count * g->gr.tpc_count; - size = sm_count * sizeof(struct warpstate); - w_state = nvgpu_kzalloc(g, size); - if (!w_state) + + ioctl_size = sm_count * sizeof(struct warpstate); + ioctl_w_state = nvgpu_kzalloc(g, ioctl_size); + if (!ioctl_w_state) return -ENOMEM; + size = sm_count * sizeof(struct nvgpu_warpstate); + w_state = nvgpu_kzalloc(g, size); + if (!w_state) { + err = -ENOMEM; + goto out_free; + } + err = gk20a_busy(g); if (err) goto out_free; @@ -445,8 +454,23 @@ static int nvgpu_gpu_ioctl_wait_for_pause(struct gk20a *g, nvgpu_mutex_acquire(&g->dbg_sessions_lock); g->ops.gr.wait_for_pause(g, w_state); + for (sm_id = 0; sm_id < g->gr.no_of_sm; sm_id++) { + ioctl_w_state[sm_id].valid_warps[0] = + w_state[sm_id].valid_warps[0]; + ioctl_w_state[sm_id].valid_warps[1] = + w_state[sm_id].valid_warps[1]; + ioctl_w_state[sm_id].trapped_warps[0] = + w_state[sm_id].trapped_warps[0]; + ioctl_w_state[sm_id].trapped_warps[1] = + w_state[sm_id].trapped_warps[1]; + ioctl_w_state[sm_id].paused_warps[0] = + w_state[sm_id].paused_warps[0]; + ioctl_w_state[sm_id].paused_warps[1] = + w_state[sm_id].paused_warps[1]; + } /* Copy to user space - pointed by "args->pwarpstate" */ - if (copy_to_user((void __user *)(uintptr_t)args->pwarpstate, w_state, size)) { + if (copy_to_user((void __user *)(uintptr_t)args->pwarpstate, + w_state, ioctl_size)) { gk20a_dbg_fn("copy_to_user failed!"); err = -EFAULT; } @@ -457,6 +481,7 @@ static int nvgpu_gpu_ioctl_wait_for_pause(struct gk20a *g, out_free: nvgpu_kfree(g, w_state); + nvgpu_kfree(g, ioctl_w_state); return err; } -- cgit v1.2.2