From 7306f2b13106a2464fcc83493554368d31ba2d44 Mon Sep 17 00:00:00 2001 From: Preetham Chandru Ramchandra Date: Mon, 13 Aug 2018 02:37:26 -0700 Subject: gpu: nvpgu: unpowergate GPU in ioctl_tsg_open() The nvgpu_ioctl_tsg_open() does not make sure that GPU is unpowergated. Due to this it leads to kernel panic when GPU registers are accessed when powergated. __gk20a_warn_on_no_regs+0x38/0x58 [nvgpu] __nvgpu_readl+0x74/0xc8 [nvgpu] nvgpu_readl+0x28/0x60 [nvgpu] xxxxx_ce_get_num_pce+0x28/0x70 [nvgpu] xxxxx_fifo_init_eng_method_buffers+0x64/0x1c0 [nvgpu] gk20a_tsg_open+0x110/0x1e0 [nvgpu] nvgpu_ioctl_tsg_open+0x88/0x100 [nvgpu] gk20a_ctrl_dev_ioctl+0x734/0x2388 [nvgpu] do_vfs_ioctl+0xc4/0x918 SyS_ioctl+0x94/0xa8 This change fixes this issue by calling gk20a_busy()/gk20a_idle() in nvgpu_ioctl_tsg_open() Bug 2268533 JIRA NVGPU-1016 Change-Id: I578289e7eb60295d6b6169b754a5cc60f7546fd5 Signed-off-by: Preetham Chandru Ramchandra Reviewed-on: https://git-master.nvidia.com/r/1794324 Reviewed-by: Seshendra Gadagottu GVS: Gerrit_Virtual_Submit Reviewed-by: Deepak Nibade Reviewed-by: Vijayakumar Subbu Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/os/linux/ioctl_tsg.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'drivers/gpu/nvgpu/os/linux/ioctl_tsg.c') diff --git a/drivers/gpu/nvgpu/os/linux/ioctl_tsg.c b/drivers/gpu/nvgpu/os/linux/ioctl_tsg.c index 4ef99ded..5d22d082 100644 --- a/drivers/gpu/nvgpu/os/linux/ioctl_tsg.c +++ b/drivers/gpu/nvgpu/os/linux/ioctl_tsg.c @@ -399,7 +399,14 @@ int nvgpu_ioctl_tsg_open(struct gk20a *g, struct file *filp) goto free_ref; } + err = gk20a_busy(g); + if (err) { + nvgpu_err(g, "failed to power on, %d", err); + goto free_ref; + } + tsg = gk20a_tsg_open(g, nvgpu_current_pid(g)); + gk20a_idle(g); if (!tsg) { nvgpu_kfree(g, priv); err = -ENOMEM; -- cgit v1.2.2