From bf14c2a0faf922073eaf72d490bf8bde8df1a5c7 Mon Sep 17 00:00:00 2001 From: Richard Zhao Date: Wed, 12 Sep 2018 10:21:58 -0700 Subject: gpu: nvgpu: railgate returns early if no platform implementation If platform didn't set railgate/unrailgate callbacks, it means it does not support railgate. It avoids vgpu calling tegra_fuse_clock_disable/enable. Bug 200436689 Jira EVLR-2983 Change-Id: I759dc23145429a59f40cec6e9c1de9536dcf43c4 Signed-off-by: Richard Zhao Reviewed-on: https://git-master.nvidia.com/r/1821663 Reviewed-by: svc-misra-checker Reviewed-by: Seshendra Gadagottu GVS: Gerrit_Virtual_Submit Reviewed-by: Vinod Gopalakrishnakurup Reviewed-by: Terje Bergstrom Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/os/linux/module.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'drivers/gpu/nvgpu/os') diff --git a/drivers/gpu/nvgpu/os/linux/module.c b/drivers/gpu/nvgpu/os/linux/module.c index ff4d9a4c..0d4cd7f1 100644 --- a/drivers/gpu/nvgpu/os/linux/module.c +++ b/drivers/gpu/nvgpu/os/linux/module.c @@ -766,6 +766,10 @@ static int gk20a_pm_railgate(struct device *dev) int ret = 0; struct gk20a *g = get_gk20a(dev); + /* return early if platform didn't implement railgate */ + if (!platform->railgate) + return 0; + /* if platform is already railgated, then just return */ if (platform->is_railgated && platform->is_railgated(dev)) return ret; @@ -780,8 +784,7 @@ static int gk20a_pm_railgate(struct device *dev) g->pstats.last_rail_ungate_complete); #endif - if (platform->railgate) - ret = platform->railgate(dev); + ret = platform->railgate(dev); if (ret) { nvgpu_err(g, "failed to railgate platform, err=%d", ret); return ret; @@ -803,6 +806,10 @@ static int gk20a_pm_unrailgate(struct device *dev) int ret = 0; struct gk20a *g = get_gk20a(dev); + /* return early if platform didn't implement unrailgate */ + if (!platform->unrailgate) + return 0; + ret = tegra_fuse_clock_enable(); if (ret) { nvgpu_err(g, "failed to enable tegra fuse clock, err=%d", ret); @@ -821,11 +828,9 @@ static int gk20a_pm_unrailgate(struct device *dev) trace_gk20a_pm_unrailgate(dev_name(dev)); - if (platform->unrailgate) { - nvgpu_mutex_acquire(&platform->railgate_lock); - ret = platform->unrailgate(dev); - nvgpu_mutex_release(&platform->railgate_lock); - } + nvgpu_mutex_acquire(&platform->railgate_lock); + ret = platform->unrailgate(dev); + nvgpu_mutex_release(&platform->railgate_lock); #ifdef CONFIG_DEBUG_FS g->pstats.last_rail_ungate_complete = jiffies; -- cgit v1.2.2