mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
gpu: nvgpu: add interface to power on-off gpu
The power rail of dGPU is managed with help of a set of GPIOs. Using those GPIOs add an interface to power off and power on dGPU. Before dGPU is powered off, new work is blocked by setting NVGPU_DRIVER_IS_DYING and current jobs are allowed to finish by waiting for gpu to be idle. The tegra PCIe controller driver provided APIs tegra_pcie_attach_controller() and tegra_pcie_detach_controller() are used to manage PCIe link shutdown, PCIe refclk management and PCIe rescan. JIRA NVGPU-1100 Change-Id: Ifae5b81535f40dceca5292a987d3daf6984f3210 Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1749847 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
Abdul Salam
parent
334f5869c9
commit
237af3ef86
@@ -1100,6 +1100,38 @@ static int gk20a_pm_deinit(struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int nvgpu_start_gpu_idle(struct gk20a *g)
|
||||
{
|
||||
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
|
||||
|
||||
down_write(&l->busy_lock);
|
||||
|
||||
/*
|
||||
* Set NVGPU_DRIVER_IS_DYING to avoid gpu being marked
|
||||
* busy to submit new work to gpu.
|
||||
*/
|
||||
__nvgpu_set_enabled(g, NVGPU_DRIVER_IS_DYING, true);
|
||||
|
||||
up_write(&l->busy_lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int nvgpu_wait_for_gpu_idle(struct gk20a *g)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
ret = gk20a_wait_for_idle(g);
|
||||
if (ret) {
|
||||
nvgpu_err(g, "failed in wait for idle");
|
||||
goto out;
|
||||
}
|
||||
|
||||
nvgpu_wait_for_deferred_interrupts(g);
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Start the process for unloading the driver. Set NVGPU_DRIVER_IS_DYING.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user