diff --git a/drivers/gpu/nvgpu/common/cic/mon/mon_intr.c b/drivers/gpu/nvgpu/common/cic/mon/mon_intr.c index 79f24381c..7b7eb8e99 100644 --- a/drivers/gpu/nvgpu/common/cic/mon/mon_intr.c +++ b/drivers/gpu/nvgpu/common/cic/mon/mon_intr.c @@ -153,6 +153,18 @@ void nvgpu_cic_mon_intr_nonstall_handle(struct gk20a *g) (void)nvgpu_cic_rm_broadcast_last_irq_nonstall(g); } #endif +#ifdef CONFIG_NVGPU_MON_PRESENT +int nvgpu_cic_mon_handle_fatal_intr(struct gk20a *g) +{ + if (nvgpu_is_powered_off(g)) { + nvgpu_err(g, "GPU is already powered off"); + return -ENODEV; + } + g->ops.mc.isr_stall(g); + + return 0U; +} +#endif u32 nvgpu_cic_mon_intr_stall_isr(struct gk20a *g) { diff --git a/drivers/gpu/nvgpu/include/nvgpu/cic_mon.h b/drivers/gpu/nvgpu/include/nvgpu/cic_mon.h index e2e79a18d..cea989145 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/cic_mon.h +++ b/drivers/gpu/nvgpu/include/nvgpu/cic_mon.h @@ -409,6 +409,22 @@ int nvgpu_cic_mon_report_err_safety_services(struct gk20a *g, */ int nvgpu_cic_mon_get_num_hw_modules(struct gk20a *g); +#ifdef CONFIG_NVGPU_MON_PRESENT +/** + * @brief Fatal error interrupt handler for safety. + * + * @param g [in] The GPU driver struct. + * + * This function is invoked by NVGPU_MON_DEVCTL_NOTIFY_INTR devctl raised by nvgpu-mon. + * It is called to parse the interrupt tree and determine exact error. + * The unit ISR functions are invoked based on triggered interrupts. + * + * @retval -ENODEV if GPU is already powered off. + * @retval 0U if Fatal interrupt handling was performed succcessfully. + */ +int nvgpu_cic_mon_handle_fatal_intr(struct gk20a *g); +#endif + /** * @brief Top half of stall interrupt ISR. *