summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/linux/module.c
diff options
context:
space:
mode:
authorThomas Fleury <tfleury@nvidia.com>2017-08-31 18:08:43 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-10-29 14:00:05 -0400
commitca92c1f400f26703643251bc0052d9a23f60bd03 (patch)
tree5a197a8c7fafcce986c4a6cb41a8455072292a05 /drivers/gpu/nvgpu/common/linux/module.c
parent6b3b2b9c08a745288efcd1e608c0fa95da966c4e (diff)
gpu: nvgpu: allow suspend when jobs are pending
We currently check that no job is pending before proceeding with suspend. This prevents suspend, when we could simply disable and preempt all channels. Moreover, pending jobs accounting is done using pm_runtime usage count, which is not updated for GPUs with pm_runtime disabled (e.g. vgpu). Replaced the check on pm_runtime usage count, with a check on gk20a handle usage count. Suspend is allowed when there is no task inside a busy/idle sequence. JIRA EVLR-1852 Change-Id: I79e71c8112182622dbd1c7c46cd84befa61a5c4d Signed-off-by: Thomas Fleury <tfleury@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1552348 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit 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/common/linux/module.c')
-rw-r--r--drivers/gpu/nvgpu/common/linux/module.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/module.c b/drivers/gpu/nvgpu/common/linux/module.c
index 51336c51..e7e79949 100644
--- a/drivers/gpu/nvgpu/common/linux/module.c
+++ b/drivers/gpu/nvgpu/common/linux/module.c
@@ -869,21 +869,17 @@ static int gk20a_pm_suspend(struct device *dev)
869 struct gk20a_platform *platform = dev_get_drvdata(dev); 869 struct gk20a_platform *platform = dev_get_drvdata(dev);
870 struct gk20a *g = get_gk20a(dev); 870 struct gk20a *g = get_gk20a(dev);
871 int ret = 0; 871 int ret = 0;
872 872 int idle_usage_count = g->user_railgate_disabled ? 1 : 0;
873 if (g->user_railgate_disabled)
874 gk20a_idle_nosuspend(g);
875
876 if (atomic_read(&dev->power.usage_count) > 1) {
877 ret = -EBUSY;
878 goto fail;
879 }
880 873
881 if (!g->power_on) 874 if (!g->power_on)
882 return 0; 875 return 0;
883 876
877 if (nvgpu_atomic_read(&g->usage_count) > idle_usage_count)
878 return -EBUSY;
879
884 ret = gk20a_pm_runtime_suspend(dev); 880 ret = gk20a_pm_runtime_suspend(dev);
885 if (ret) 881 if (ret)
886 goto fail; 882 return ret;
887 883
888 if (platform->suspend) 884 if (platform->suspend)
889 platform->suspend(dev); 885 platform->suspend(dev);
@@ -891,12 +887,6 @@ static int gk20a_pm_suspend(struct device *dev)
891 g->suspended = true; 887 g->suspended = true;
892 888
893 return 0; 889 return 0;
894
895fail:
896 if (g->user_railgate_disabled)
897 gk20a_busy_noresume(g);
898
899 return ret;
900} 890}
901 891
902static int gk20a_pm_resume(struct device *dev) 892static int gk20a_pm_resume(struct device *dev)
@@ -904,9 +894,6 @@ static int gk20a_pm_resume(struct device *dev)
904 struct gk20a *g = get_gk20a(dev); 894 struct gk20a *g = get_gk20a(dev);
905 int ret = 0; 895 int ret = 0;
906 896
907 if (g->user_railgate_disabled)
908 gk20a_busy_noresume(g);
909
910 if (!g->suspended) 897 if (!g->suspended)
911 return 0; 898 return 0;
912 899