From 7fb33cf87b3079a37d8f0a8a0f6349cc826d2203 Mon Sep 17 00:00:00 2001 From: Antony Clince Alex Date: Wed, 12 Dec 2018 15:22:40 +0530 Subject: [PATCH] gpu: nvgpu: Defer pstate deinit to driver remove The PMU pstate deinit was invoked part of gpu power off. This frees and clears the pmgr_pmu struct which causes the pmu remove support to crash when it tries to access the pmgr_pmu object for freeing up the pmu board objects. Deferred pstate deinit to nvgpu driver removal as there is no reason for it be invoked part of prepare poweroff sequence. JIRA NVGPU-1618 Change-Id: I2eb52000f0732d0abed54946e0843367b119d443 Signed-off-by: Antony Clince Alex Reviewed-on: https://git-master.nvidia.com/r/1971225 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/init/nvgpu_init.c | 5 ----- drivers/gpu/nvgpu/os/linux/module.c | 4 ++++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/nvgpu/common/init/nvgpu_init.c b/drivers/gpu/nvgpu/common/init/nvgpu_init.c index 29bfe113f..1502e7eaf 100644 --- a/drivers/gpu/nvgpu/common/init/nvgpu_init.c +++ b/drivers/gpu/nvgpu/common/init/nvgpu_init.c @@ -107,11 +107,6 @@ int gk20a_prepare_poweroff(struct gk20a *g) if (g->ops.clk.suspend_clk_support != NULL) { ret |= g->ops.clk.suspend_clk_support(g); } - - if (nvgpu_is_enabled(g, NVGPU_PMU_PSTATE)) { - gk20a_deinit_pstate_support(g); - } - gk20a_mask_interrupts(g); g->power_on = false; diff --git a/drivers/gpu/nvgpu/os/linux/module.c b/drivers/gpu/nvgpu/os/linux/module.c index 940ba1b43..37c918444 100644 --- a/drivers/gpu/nvgpu/os/linux/module.c +++ b/drivers/gpu/nvgpu/os/linux/module.c @@ -733,6 +733,10 @@ void gk20a_remove_support(struct gk20a *g) if (g->pmu.remove_support) g->pmu.remove_support(&g->pmu); + if (nvgpu_is_enabled(g, NVGPU_PMU_PSTATE)) { + gk20a_deinit_pstate_support(g); + } + if (g->sec2.remove_support != NULL) { g->sec2.remove_support(&g->sec2); }