diff --git a/drivers/gpu/nvgpu/Makefile.linux.configs b/drivers/gpu/nvgpu/Makefile.linux.configs index 4c15d36d9..0f3c38fc2 100644 --- a/drivers/gpu/nvgpu/Makefile.linux.configs +++ b/drivers/gpu/nvgpu/Makefile.linux.configs @@ -199,11 +199,9 @@ endif ifeq ($(CONFIG_TEGRA_HSIERRRPTINJ),y) ifeq ($(CONFIG_NVGPU_ENABLE_MISC_EC),y) -ifeq ($(CONFIG_NVGPU_DGPU),n) CONFIG_NVGPU_FSI_ERR_INJECTION := y endif endif -endif ifeq ($(CONFIG_GK20A_PMU),y) ccflags-y += -DCONFIG_GK20A_PMU diff --git a/drivers/gpu/nvgpu/common/cic/mon/mon_init.c b/drivers/gpu/nvgpu/common/cic/mon/mon_init.c index 05553559d..a3560871f 100644 --- a/drivers/gpu/nvgpu/common/cic/mon/mon_init.c +++ b/drivers/gpu/nvgpu/common/cic/mon/mon_init.c @@ -46,16 +46,18 @@ int nvgpu_cic_mon_setup(struct gk20a *g) g->cic_mon = cic_mon; #ifdef CONFIG_NVGPU_FSI_ERR_INJECTION - err = nvgpu_cic_mon_reg_errinj_cb(g); - if (err != 0) { - nvgpu_err(g, - "Err inj callback registration failed: %d", - err); - /* Continue CIC init despite err inj utility - * registration failure, as the err inj support - * is meant only for debug purposes. - */ - err = 0; + if (g->ops.cic_mon.reg_errinj_cb != NULL) { + err = g->ops.cic_mon.reg_errinj_cb(g); + if (err != 0) { + nvgpu_err(g, + "Err inj callback registration failed: %d", + err); + /* Continue CIC init despite err inj utility + * registration failure, as the err inj support + * is meant only for debug purposes. + */ + err = 0; + } } #endif @@ -100,16 +102,17 @@ int nvgpu_cic_mon_remove(struct gk20a *g) struct nvgpu_cic_mon *cic_mon; #ifdef CONFIG_NVGPU_FSI_ERR_INJECTION - int err = nvgpu_cic_mon_dereg_errinj_cb(); - - if (err != 0) { - nvgpu_err(g, - "Err inj callback de-registration failed: %d", - err); - /* Continue CIC remove despite err inj utility - * de-registration failure, as the err inj support - * is meant only for debug purposes. - */ + if (g->ops.cic_mon.dereg_errinj_cb != NULL) { + int err = g->ops.cic_mon.dereg_errinj_cb(); + if (err != 0) { + nvgpu_err(g, + "Err inj callback de-registration failed: %d", + err); + /* Continue CIC remove despite err inj utility + * de-registration failure, as the err inj support + * is meant only for debug purposes. + */ + } } #endif diff --git a/drivers/gpu/nvgpu/hal/init/hal_ga10b.c b/drivers/gpu/nvgpu/hal/init/hal_ga10b.c index 4f3a8d333..92c5417dd 100644 --- a/drivers/gpu/nvgpu/hal/init/hal_ga10b.c +++ b/drivers/gpu/nvgpu/hal/init/hal_ga10b.c @@ -1757,6 +1757,10 @@ static const struct gops_mssnvlink ga10b_ops_mssnvlink = { #endif static const struct gops_cic_mon ga10b_ops_cic_mon = { +#ifdef CONFIG_NVGPU_FSI_ERR_INJECTION + .reg_errinj_cb = nvgpu_cic_mon_reg_errinj_cb, + .dereg_errinj_cb = nvgpu_cic_mon_dereg_errinj_cb, +#endif .init = ga10b_cic_mon_init, .report_err = nvgpu_cic_mon_report_err_safety_services }; diff --git a/drivers/gpu/nvgpu/include/nvgpu/gops/cic_mon.h b/drivers/gpu/nvgpu/include/nvgpu/gops/cic_mon.h index 1387a9b73..71154a41d 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/gops/cic_mon.h +++ b/drivers/gpu/nvgpu/include/nvgpu/gops/cic_mon.h @@ -58,6 +58,24 @@ struct gops_cic_mon { * @return 0 in case of success, < 0 in case of failure. */ int (*report_err)(struct gk20a *g, u32 err_id); + + /** + * @brief Register error injection callback with error + * injection utility. + * + * @param g [in] Pointer to GPU driver struct. + * + * @return 0 in case of success, < 0 in case of failure. + */ + int (*reg_errinj_cb)(struct gk20a *g); + + /** + * @brief Unregister error injection callback from error + * injection utility. + * + * @return 0 in case of success, < 0 in case of failure. + */ + int (*dereg_errinj_cb)(void); }; #endif/*NVGPU_GOPS_CIC_MON_H*/