gpu: nvgpu: Add reboot handler

Add a reboot handler to make sure that nvgpu does not try to busy
the GPU if the system is going down. If the system is going down
then any number of subsystems nvgpu depends on may already have
been deinitialized.

Bug 200333709
Bug 200454316

Change-Id: I2ceaf7ca4fb88643310874b5b26937ef44c6e3dd
Signed-off-by: Kary Jin <karyj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1927018
(cherry picked from commit 9d2e50de42)
Reviewed-on: https://git-master.nvidia.com/r/1927030
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Kary Jin
2018-10-15 15:57:52 +08:00
committed by mobile promotions
parent 0188b93e30
commit 5b1b9eeab1
5 changed files with 37 additions and 6 deletions

View File

@@ -438,12 +438,17 @@ done:
* Check if the device can go busy. Basically if the driver is currently
* in the process of dying then do not let new places make the driver busy.
*/
int gk20a_can_busy(struct gk20a *g)
int nvgpu_can_busy(struct gk20a *g)
{
if (nvgpu_is_enabled(g, NVGPU_DRIVER_IS_DYING)) {
/* Can't do anything if the system is rebooting/shutting down
* or the driver is restarting
*/
if (nvgpu_is_enabled(g, NVGPU_KERNEL_IS_DYING) ||
nvgpu_is_enabled(g, NVGPU_DRIVER_IS_DYING)) {
return 0;
} else {
return 1;
}
return 1;
}
int gk20a_wait_for_idle(struct gk20a *g)