diff options
author | Richard Zhao <rizhao@nvidia.com> | 2018-09-12 13:21:58 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-09-13 15:05:00 -0400 |
commit | bf14c2a0faf922073eaf72d490bf8bde8df1a5c7 (patch) | |
tree | 639bd6498e8a33424976fca67f02077761a297c4 /drivers/gpu/nvgpu/os | |
parent | f4040bae95d2df86c6d15534f502a21dd860d33c (diff) |
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 <rizhao@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1821663
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
Reviewed-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/os')
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/module.c | 19 |
1 files changed, 12 insertions, 7 deletions
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) | |||
766 | int ret = 0; | 766 | int ret = 0; |
767 | struct gk20a *g = get_gk20a(dev); | 767 | struct gk20a *g = get_gk20a(dev); |
768 | 768 | ||
769 | /* return early if platform didn't implement railgate */ | ||
770 | if (!platform->railgate) | ||
771 | return 0; | ||
772 | |||
769 | /* if platform is already railgated, then just return */ | 773 | /* if platform is already railgated, then just return */ |
770 | if (platform->is_railgated && platform->is_railgated(dev)) | 774 | if (platform->is_railgated && platform->is_railgated(dev)) |
771 | return ret; | 775 | return ret; |
@@ -780,8 +784,7 @@ static int gk20a_pm_railgate(struct device *dev) | |||
780 | g->pstats.last_rail_ungate_complete); | 784 | g->pstats.last_rail_ungate_complete); |
781 | #endif | 785 | #endif |
782 | 786 | ||
783 | if (platform->railgate) | 787 | ret = platform->railgate(dev); |
784 | ret = platform->railgate(dev); | ||
785 | if (ret) { | 788 | if (ret) { |
786 | nvgpu_err(g, "failed to railgate platform, err=%d", ret); | 789 | nvgpu_err(g, "failed to railgate platform, err=%d", ret); |
787 | return ret; | 790 | return ret; |
@@ -803,6 +806,10 @@ static int gk20a_pm_unrailgate(struct device *dev) | |||
803 | int ret = 0; | 806 | int ret = 0; |
804 | struct gk20a *g = get_gk20a(dev); | 807 | struct gk20a *g = get_gk20a(dev); |
805 | 808 | ||
809 | /* return early if platform didn't implement unrailgate */ | ||
810 | if (!platform->unrailgate) | ||
811 | return 0; | ||
812 | |||
806 | ret = tegra_fuse_clock_enable(); | 813 | ret = tegra_fuse_clock_enable(); |
807 | if (ret) { | 814 | if (ret) { |
808 | nvgpu_err(g, "failed to enable tegra fuse clock, err=%d", ret); | 815 | nvgpu_err(g, "failed to enable tegra fuse clock, err=%d", ret); |
@@ -821,11 +828,9 @@ static int gk20a_pm_unrailgate(struct device *dev) | |||
821 | 828 | ||
822 | trace_gk20a_pm_unrailgate(dev_name(dev)); | 829 | trace_gk20a_pm_unrailgate(dev_name(dev)); |
823 | 830 | ||
824 | if (platform->unrailgate) { | 831 | nvgpu_mutex_acquire(&platform->railgate_lock); |
825 | nvgpu_mutex_acquire(&platform->railgate_lock); | 832 | ret = platform->unrailgate(dev); |
826 | ret = platform->unrailgate(dev); | 833 | nvgpu_mutex_release(&platform->railgate_lock); |
827 | nvgpu_mutex_release(&platform->railgate_lock); | ||
828 | } | ||
829 | 834 | ||
830 | #ifdef CONFIG_DEBUG_FS | 835 | #ifdef CONFIG_DEBUG_FS |
831 | g->pstats.last_rail_ungate_complete = jiffies; | 836 | g->pstats.last_rail_ungate_complete = jiffies; |