summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/os/linux/module.c
diff options
context:
space:
mode:
authorNitin Kumbhar <nkumbhar@nvidia.com>2018-07-04 13:29:36 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-07-12 17:04:43 -0400
commit97c6a10928cc463825479911c3a6518ade34ebc0 (patch)
treee3a935b6dcf3099070bf30cc83718079458106ae /drivers/gpu/nvgpu/os/linux/module.c
parent0b7fbc1ff457580cf8ae3f7a8a55f5ab36bfd8e7 (diff)
gpu: nvgpu: add pm_rumtime fixes
Runtime PM is enabled only for iGPU and not for dGPU. For dGPU, the .probe() of driver pm_runtime_disable()s, if rail-gating is not enabled. With nvgpu kernel module load/unload, .probe() is called multiple times for same struct device *. This results in an overflow of disable_depth (3 bit refcount) and enables runtime PM on 8th iteration and calls RTPM routines even if it's disabled. To effectively manage pm_runtime_disable(), move it from common nvgpu_remove() to iGPU/dGPU specific routines. Also, add restore pm_runtime state of device on driver .remove(). Bug 1987855 Change-Id: I781278da546ef9c9ef7d7da7dbea0757df32716f Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1770804 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/os/linux/module.c')
-rw-r--r--drivers/gpu/nvgpu/os/linux/module.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/os/linux/module.c b/drivers/gpu/nvgpu/os/linux/module.c
index a59ac1f1..e3667947 100644
--- a/drivers/gpu/nvgpu/os/linux/module.c
+++ b/drivers/gpu/nvgpu/os/linux/module.c
@@ -1060,6 +1060,13 @@ static int gk20a_pm_init(struct device *dev)
1060 return err; 1060 return err;
1061} 1061}
1062 1062
1063static int gk20a_pm_deinit(struct device *dev)
1064{
1065 pm_runtime_dont_use_autosuspend(dev);
1066 pm_runtime_disable(dev);
1067 return 0;
1068}
1069
1063/* 1070/*
1064 * Start the process for unloading the driver. Set NVGPU_DRIVER_IS_DYING. 1071 * Start the process for unloading the driver. Set NVGPU_DRIVER_IS_DYING.
1065 */ 1072 */
@@ -1309,9 +1316,6 @@ int nvgpu_remove(struct device *dev, struct class *class)
1309 platform->secure_buffer.destroy(g, 1316 platform->secure_buffer.destroy(g,
1310 &platform->secure_buffer); 1317 &platform->secure_buffer);
1311 1318
1312 if (pm_runtime_enabled(dev))
1313 pm_runtime_disable(dev);
1314
1315 if (platform->remove) 1319 if (platform->remove)
1316 platform->remove(dev); 1320 platform->remove(dev);
1317 1321
@@ -1332,8 +1336,11 @@ static int __exit gk20a_remove(struct platform_device *pdev)
1332 err = nvgpu_remove(dev, &nvgpu_class); 1336 err = nvgpu_remove(dev, &nvgpu_class);
1333 1337
1334 set_gk20a(pdev, NULL); 1338 set_gk20a(pdev, NULL);
1339
1335 gk20a_put(g); 1340 gk20a_put(g);
1336 1341
1342 gk20a_pm_deinit(dev);
1343
1337 return err; 1344 return err;
1338} 1345}
1339 1346