From 3f81f1952dcd462d7d9d3f234e2fed7655ce76d0 Mon Sep 17 00:00:00 2001 From: Richard Zhao Date: Thu, 6 Aug 2020 22:09:33 -0700 Subject: [PATCH] gpu: nvgpu: vgpu: fix NVGPU_GPU_IOCTL_CLEAR_SM_ERRORS crash vgpu currently does not support suspend gpu context and stall the whole gpu, because of safety concerns. So vgpu does not set HALs that are related to on-gpu context. This change unset gops.gr.clear_sm_errors. And the ioctl NVGPU_GPU_IOCTL_CLEAR_SM_ERRORS will return -ENOSYS. Bug 200469468 Signed-off-by: Richard Zhao Change-Id: Ie578495e175ad898994fe1c4184a0243d5541cd3 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2395598 Tested-by: mobile promotions Reviewed-by: automaticguardword Reviewed-by: Deepak Nibade Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: svc-mobile-cert Reviewed-by: Alex Waterman Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/hal/vgpu/init/vgpu_hal_gp10b.c | 2 +- drivers/gpu/nvgpu/hal/vgpu/init/vgpu_hal_gv11b.c | 2 +- drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/nvgpu/hal/vgpu/init/vgpu_hal_gp10b.c b/drivers/gpu/nvgpu/hal/vgpu/init/vgpu_hal_gp10b.c index 69139afcb..4ec286dfc 100644 --- a/drivers/gpu/nvgpu/hal/vgpu/init/vgpu_hal_gp10b.c +++ b/drivers/gpu/nvgpu/hal/vgpu/init/vgpu_hal_gp10b.c @@ -201,7 +201,7 @@ static const struct gpu_ops vgpu_gp10b_ops = { .trigger_suspend = NULL, .wait_for_pause = gr_gk20a_wait_for_pause, .resume_from_pause = NULL, - .clear_sm_errors = gr_gk20a_clear_sm_errors, + .clear_sm_errors = NULL, .sm_debugger_attached = NULL, .suspend_single_sm = NULL, .suspend_all_sms = NULL, diff --git a/drivers/gpu/nvgpu/hal/vgpu/init/vgpu_hal_gv11b.c b/drivers/gpu/nvgpu/hal/vgpu/init/vgpu_hal_gv11b.c index bb5c27984..4aab163f1 100644 --- a/drivers/gpu/nvgpu/hal/vgpu/init/vgpu_hal_gv11b.c +++ b/drivers/gpu/nvgpu/hal/vgpu/init/vgpu_hal_gv11b.c @@ -260,7 +260,7 @@ static const struct gpu_ops vgpu_gv11b_ops = { .trigger_suspend = NULL, .wait_for_pause = gr_gk20a_wait_for_pause, .resume_from_pause = NULL, - .clear_sm_errors = gr_gk20a_clear_sm_errors, + .clear_sm_errors = NULL, .sm_debugger_attached = NULL, .suspend_single_sm = NULL, .suspend_all_sms = NULL, diff --git a/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c b/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c index a445acd6c..bad8490e7 100644 --- a/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c +++ b/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c @@ -875,6 +875,10 @@ static int nvgpu_gpu_ioctl_clear_sm_errors(struct gk20a *g) { int err; + if (g->ops.gr.clear_sm_errors == NULL) { + return -ENOSYS; + } + err = gk20a_busy(g); if (err) return err;