gpu: nvgpu: Remove dependency on DGPU CONFIG

The error injection code was enabled only when CONFIG_NVGPU_DGPU = n
so that the dGPUs do not attempt any error injection callback
function registration. But, this introduced dependency on DGPU
config when needs to be explicitly set to n for error injection to
be enabled.
Remove the dependency by moving the error injection callback
registration and deregistration to a HAL which is enabled only
on GA10b.

Bug 3819160

Change-Id: I4f4eb99189b1af3502d719536a91cc5e5d866bce
Signed-off-by: Tejal Kudav <tkudav@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2787202
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Tejal Kudav
2022-10-05 11:10:48 +00:00
committed by mobile promotions
parent 30e7a5e5ed
commit 724f49f6eb
4 changed files with 45 additions and 22 deletions

View File

@@ -199,11 +199,9 @@ endif
ifeq ($(CONFIG_TEGRA_HSIERRRPTINJ),y) ifeq ($(CONFIG_TEGRA_HSIERRRPTINJ),y)
ifeq ($(CONFIG_NVGPU_ENABLE_MISC_EC),y) ifeq ($(CONFIG_NVGPU_ENABLE_MISC_EC),y)
ifeq ($(CONFIG_NVGPU_DGPU),n)
CONFIG_NVGPU_FSI_ERR_INJECTION := y CONFIG_NVGPU_FSI_ERR_INJECTION := y
endif endif
endif endif
endif
ifeq ($(CONFIG_GK20A_PMU),y) ifeq ($(CONFIG_GK20A_PMU),y)
ccflags-y += -DCONFIG_GK20A_PMU ccflags-y += -DCONFIG_GK20A_PMU

View File

@@ -46,7 +46,8 @@ int nvgpu_cic_mon_setup(struct gk20a *g)
g->cic_mon = cic_mon; g->cic_mon = cic_mon;
#ifdef CONFIG_NVGPU_FSI_ERR_INJECTION #ifdef CONFIG_NVGPU_FSI_ERR_INJECTION
err = nvgpu_cic_mon_reg_errinj_cb(g); if (g->ops.cic_mon.reg_errinj_cb != NULL) {
err = g->ops.cic_mon.reg_errinj_cb(g);
if (err != 0) { if (err != 0) {
nvgpu_err(g, nvgpu_err(g,
"Err inj callback registration failed: %d", "Err inj callback registration failed: %d",
@@ -57,6 +58,7 @@ int nvgpu_cic_mon_setup(struct gk20a *g)
*/ */
err = 0; err = 0;
} }
}
#endif #endif
cic_dbg(g, "CIC_MON unit initialization done."); cic_dbg(g, "CIC_MON unit initialization done.");
@@ -100,8 +102,8 @@ int nvgpu_cic_mon_remove(struct gk20a *g)
struct nvgpu_cic_mon *cic_mon; struct nvgpu_cic_mon *cic_mon;
#ifdef CONFIG_NVGPU_FSI_ERR_INJECTION #ifdef CONFIG_NVGPU_FSI_ERR_INJECTION
int err = nvgpu_cic_mon_dereg_errinj_cb(); if (g->ops.cic_mon.dereg_errinj_cb != NULL) {
int err = g->ops.cic_mon.dereg_errinj_cb();
if (err != 0) { if (err != 0) {
nvgpu_err(g, nvgpu_err(g,
"Err inj callback de-registration failed: %d", "Err inj callback de-registration failed: %d",
@@ -111,6 +113,7 @@ int nvgpu_cic_mon_remove(struct gk20a *g)
* is meant only for debug purposes. * is meant only for debug purposes.
*/ */
} }
}
#endif #endif
cic_mon = g->cic_mon; cic_mon = g->cic_mon;

View File

@@ -1757,6 +1757,10 @@ static const struct gops_mssnvlink ga10b_ops_mssnvlink = {
#endif #endif
static const struct gops_cic_mon ga10b_ops_cic_mon = { 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, .init = ga10b_cic_mon_init,
.report_err = nvgpu_cic_mon_report_err_safety_services .report_err = nvgpu_cic_mon_report_err_safety_services
}; };

View File

@@ -58,6 +58,24 @@ struct gops_cic_mon {
* @return 0 in case of success, < 0 in case of failure. * @return 0 in case of success, < 0 in case of failure.
*/ */
int (*report_err)(struct gk20a *g, u32 err_id); 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*/ #endif/*NVGPU_GOPS_CIC_MON_H*/