gpu: nvgpu: enable runtime PM before secure_alloc init during probe

With genpd based runtime PM, the device railgating is managed by the PM
core and the nvgpu manages the clocks. To suspend/resume the device for
idling/unidling while initializing secure alloc, runtime PM is to be
enabled during probe.

nvgpu platform railgate handlers will be only managing the clocks.
During probe, the nvgpu driver poweroff/poweron are not to be
invoked as part of driver runtime suspend/resume hence probe
state is added.

After platform probe initializes the clock, explicit runtime resume of
the device is required to sanely suspend it during gk20a_do_idle.

Runtime PM configuration differs based on the NVGPU_CAN_RAILGATE
capability, hence the runtime PM is enabled ("truly") only for
the duration of nvgpu_probe and then the state is reverted at
the beginning of gk20a_pm_late_init.

Bug 200602747
JIRA NVGPU-5356

Change-Id: I1fbd03d3f49da07ccbee9714387e00ffc688864e
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2375939
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Sagar Kamble
2020-07-15 13:07:30 +05:30
committed by Alex Waterman
parent 5a5f082d24
commit 4012a97640
3 changed files with 85 additions and 5 deletions

View File

@@ -18,6 +18,7 @@
#include <linux/dma-mapping.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/pm_runtime.h>
#include <uapi/linux/nvgpu.h>
#include <nvgpu/defaults.h>
@@ -292,6 +293,13 @@ int nvgpu_probe(struct gk20a *g,
if (err)
return err;
/*
* Note that for runtime suspend to work the clocks have to be setup
* which happens in the probe call above. Hence the driver resume
* is done here and not in gk20a_pm_init.
*/
pm_runtime_get_sync(dev);
if (platform->late_probe) {
err = platform->late_probe(dev);
if (err) {
@@ -300,6 +308,8 @@ int nvgpu_probe(struct gk20a *g,
}
}
pm_runtime_put_sync_autosuspend(dev);
nvgpu_create_sysfs(dev);
gk20a_debug_init(g, debugfs_symlink);
@@ -324,6 +334,8 @@ static void nvgpu_free_gk20a(struct gk20a *g)
{
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
g->probe_done = false;
kfree(l);
}