From 9d2e50de426ac6362d66f9ccb29a0415322e467f Mon Sep 17 00:00:00 2001 From: Kary Jin Date: Mon, 15 Oct 2018 15:57:52 +0800 Subject: 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 Reviewed-on: https://git-master.nvidia.com/r/1927018 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Vinayak Pane Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/include/nvgpu/enabled.h | 1 + drivers/gpu/nvgpu/include/nvgpu/gk20a.h | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'drivers/gpu/nvgpu/include') diff --git a/drivers/gpu/nvgpu/include/nvgpu/enabled.h b/drivers/gpu/nvgpu/include/nvgpu/enabled.h index 074be0c3..12acf353 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/enabled.h +++ b/drivers/gpu/nvgpu/include/nvgpu/enabled.h @@ -36,6 +36,7 @@ struct gk20a; #define NVGPU_GR_USE_DMA_FOR_FW_BOOTSTRAP 3 #define NVGPU_FECS_TRACE_VA 4 #define NVGPU_CAN_RAILGATE 5 +#define NVGPU_KERNEL_IS_DYING 6 /* * ECC flags diff --git a/drivers/gpu/nvgpu/include/nvgpu/gk20a.h b/drivers/gpu/nvgpu/include/nvgpu/gk20a.h index a256b01f..0424e74d 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/gk20a.h +++ b/drivers/gpu/nvgpu/include/nvgpu/gk20a.h @@ -49,6 +49,9 @@ struct nvgpu_gpu_ctxsw_trace_filter; struct priv_cmd_entry; struct nvgpu_gpfifo_args; +#ifdef __KERNEL__ +#include +#endif #include #include @@ -1411,6 +1414,10 @@ struct gk20a { */ unsigned long *enabled_flags; +#ifdef __KERNEL__ + struct notifier_block nvgpu_reboot_nb; +#endif + nvgpu_atomic_t usage_count; struct nvgpu_mutex ctxsw_disable_lock; @@ -1741,7 +1748,6 @@ void gk20a_idle(struct gk20a *g); int __gk20a_do_idle(struct gk20a *g, bool force_reset); int __gk20a_do_unidle(struct gk20a *g); -int gk20a_can_busy(struct gk20a *g); int gk20a_wait_for_idle(struct gk20a *g); #define NVGPU_GPU_ARCHITECTURE_SHIFT 4 -- cgit v1.2.2