mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
gpu: nvgpu: add support for powering off gpu
Add support for powering off IGPU for switching between legacy to SMC mode/vice-versa or changing SMC configuration. The power off can be issued as follows echo 0 > /dev/nvgpu/igpu0/power The following steps are done during a poweroff. 1) Deterministic channel idle 2) Acquire write_lock on l->busy semaphore. 3) Wait till power_usage decrements to indicate 0 active jobs. 4) Invoke pm_runtime_put_sync_suspend() 5) Invoke nvgpu_gr_remove_support() to clear existing GR memory. 6) Release write_lock on l->busy 7) Deterministic channel unidle. Part of the sequence matches that of the gk20a_do_idle code. The common parts are extracted into new functions gk20a_block_new_jobs_and_idle() and gk20a_unblock_jobs() For joint-rail case, the current implementation, does a railgate and then sets pm_runtime_set_autosuspend_delay(-1) to disable regular runtime resume/suspend. Remove clearing of NVGPU_SUPPORT_MIG status during state change ias it leads to inconsistencies. Jira NVGPU-6920 Change-Id: I0b3eb3278176122ac061c1e8a94ebfb3c17c3925 Signed-off-by: Debarshi Dutta <ddutta@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2578501 Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com> Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: Antony Clince Alex <aalex@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit
This commit is contained in:
committed by
mobile promotions
parent
2e3c3aada6
commit
608decf1e6
@@ -34,8 +34,10 @@
|
||||
|
||||
#include "platform_gk20a.h"
|
||||
#include "os_linux.h"
|
||||
#include "module.h"
|
||||
|
||||
#define NVGPU_DRIVER_POWER_ON_NEEDED 1
|
||||
#define NVGPU_DRIVER_POWER_OFF_NEEDED 0
|
||||
|
||||
int gk20a_power_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
@@ -117,9 +119,8 @@ int gk20a_power_write(struct file *filp, const char __user *buf,
|
||||
}
|
||||
|
||||
if (power_status == NVGPU_DRIVER_POWER_ON_NEEDED) {
|
||||
if ((g->power_on_state == NVGPU_STATE_POWERING_ON) ||
|
||||
(g->power_on_state == NVGPU_STATE_POWERED_ON)) {
|
||||
goto free_input;
|
||||
if (nvgpu_poweron_started(g)) {
|
||||
goto free_input;
|
||||
}
|
||||
|
||||
err = gk20a_busy(g);
|
||||
@@ -130,8 +131,15 @@ int gk20a_power_write(struct file *filp, const char __user *buf,
|
||||
}
|
||||
|
||||
gk20a_idle(g);
|
||||
} else if (power_status == NVGPU_DRIVER_POWER_OFF_NEEDED) {
|
||||
err = gk20a_driver_force_power_off(g);
|
||||
if (err) {
|
||||
nvgpu_err(g, "power_node_write failed at busy");
|
||||
kfree(userinput);
|
||||
return -EINVAL;
|
||||
}
|
||||
} else {
|
||||
nvgpu_err(g, "1 is the valid value to power-on the GPU");
|
||||
nvgpu_err(g, "1/0 are the valid values to power-on the GPU");
|
||||
kfree(userinput);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user