From 4a7e5056a55da300ef26975f3355293b153b145f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konsta=20H=C3=B6ltt=C3=A4?= Date: Thu, 2 Dec 2021 13:42:31 +0200 Subject: [PATCH] gpu: nvgpu: disable gsp isr on suspend MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit nvgpu_gsp_sw_deinit() is called so late that the GPU HW is not expected to be available, so it must not call nvgpu_gsp_isr_support(). Move that call to nvgpu_prepare_poweroff(). The gsp isr is still enabled in gsp bootstrap as before. Change-Id: I84276ad377158a5fdb11931bd188e6d82bafc3df Signed-off-by: Konsta Hölttä Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2635681 Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: svc-mobile-cert Reviewed-by: Ramesh Mylavarapu Reviewed-by: Alex Waterman Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/gsp/gsp_init.c | 7 +++++-- drivers/gpu/nvgpu/common/init/nvgpu_init.c | 6 +++++- drivers/gpu/nvgpu/include/nvgpu/gsp.h | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/nvgpu/common/gsp/gsp_init.c b/drivers/gpu/nvgpu/common/gsp/gsp_init.c index b698ecb12..3cd95cf3c 100644 --- a/drivers/gpu/nvgpu/common/gsp/gsp_init.c +++ b/drivers/gpu/nvgpu/common/gsp/gsp_init.c @@ -47,12 +47,15 @@ void nvgpu_gsp_isr_support(struct gk20a *g, bool enable) nvgpu_mutex_release(&g->gsp->isr_mutex); } +void nvgpu_gsp_suspend(struct gk20a *g) +{ + nvgpu_gsp_isr_support(g, false); +} + void nvgpu_gsp_sw_deinit(struct gk20a *g) { if (g->gsp != NULL) { - nvgpu_gsp_isr_support(g, false); - nvgpu_mutex_destroy(&g->gsp->isr_mutex); #ifdef CONFIG_NVGPU_FALCON_DEBUG nvgpu_falcon_dbg_buf_destroy(g->gsp->gsp_flcn); diff --git a/drivers/gpu/nvgpu/common/init/nvgpu_init.c b/drivers/gpu/nvgpu/common/init/nvgpu_init.c index bfc70e800..a7c39dcb9 100644 --- a/drivers/gpu/nvgpu/common/init/nvgpu_init.c +++ b/drivers/gpu/nvgpu/common/init/nvgpu_init.c @@ -341,8 +341,12 @@ int nvgpu_prepare_poweroff(struct gk20a *g) #ifdef CONFIG_NVGPU_GSP_STRESS_TEST ret = nvgpu_gsp_stress_test_halt(g, true); - if (ret != 0) + if (ret != 0) { nvgpu_err(g, "Failed to halt GSP stress test"); + } +#endif +#if defined(CONFIG_NVGPU_GSP_SCHEDULER) + nvgpu_gsp_suspend(g); #endif nvgpu_falcons_sw_free(g); diff --git a/drivers/gpu/nvgpu/include/nvgpu/gsp.h b/drivers/gpu/nvgpu/include/nvgpu/gsp.h index 0fb837e81..e172edcfb 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/gsp.h +++ b/drivers/gpu/nvgpu/include/nvgpu/gsp.h @@ -27,6 +27,7 @@ struct nvgpu_gsp; int nvgpu_gsp_sw_init(struct gk20a *g); int nvgpu_gsp_bootstrap(struct gk20a *g); +void nvgpu_gsp_suspend(struct gk20a *g); void nvgpu_gsp_sw_deinit(struct gk20a *g); void nvgpu_gsp_isr_support(struct gk20a *g, bool enable); void nvgpu_gsp_isr_mutex_aquire(struct gk20a *g);