gpu: nvgpu: Fix error injection HAL init

Currently, the registeration with error injection utility is done
only for GA10b using HAL. But HALs are not initialized during the
probe stage when we try to register the error injection utility.
So, the callback registration does not happen HAL is set to NULL.
Move the callback registration from probe to poweron stage when HAL
is initialized.
Update the nvgpu_cic_mon_init_lut() API name as it is no longer
doing only LUT initialization.

Bug 3828050

Change-Id: Ide718029e9317124749b4a51c423ae70dc8227c8
Signed-off-by: Tejal Kudav <tkudav@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2790269
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Tejal Kudav
2022-10-11 16:09:15 +00:00
committed by mobile promotions
parent f29ed3a474
commit 41c874a2d9
16 changed files with 58 additions and 56 deletions

View File

@@ -45,6 +45,21 @@ int nvgpu_cic_mon_setup(struct gk20a *g)
g->cic_mon = cic_mon; g->cic_mon = cic_mon;
cic_dbg(g, "CIC_MON unit initialization done.");
return err;
}
int nvgpu_cic_mon_init(struct gk20a *g)
{
struct nvgpu_cic_mon *cic_mon;
int err = 0;
cic_mon = g->cic_mon;
if (cic_mon == NULL) {
nvgpu_err(g, "CIC_MON setup pending");
return -EINVAL;
}
#ifdef CONFIG_NVGPU_FSI_ERR_INJECTION #ifdef CONFIG_NVGPU_FSI_ERR_INJECTION
if (g->ops.cic_mon.reg_errinj_cb != NULL) { if (g->ops.cic_mon.reg_errinj_cb != NULL) {
err = g->ops.cic_mon.reg_errinj_cb(g); err = g->ops.cic_mon.reg_errinj_cb(g);
@@ -61,21 +76,6 @@ int nvgpu_cic_mon_setup(struct gk20a *g)
} }
#endif #endif
cic_dbg(g, "CIC_MON unit initialization done.");
return err;
}
int nvgpu_cic_mon_init_lut(struct gk20a *g)
{
struct nvgpu_cic_mon *cic_mon;
int err = 0;
cic_mon = g->cic_mon;
if (cic_mon == NULL) {
nvgpu_err(g, "CIC_MON setup pending");
return -EINVAL;
}
if (g->ops.cic_mon.init != NULL) { if (g->ops.cic_mon.init != NULL) {
err = g->ops.cic_mon.init(g, cic_mon); err = g->ops.cic_mon.init(g, cic_mon);
if (err != 0) { if (err != 0) {
@@ -101,21 +101,6 @@ 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
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
cic_mon = g->cic_mon; cic_mon = g->cic_mon;
if (cic_mon == NULL) { if (cic_mon == NULL) {
@@ -148,6 +133,21 @@ int nvgpu_cic_mon_deinit_lut(struct gk20a *g)
int nvgpu_cic_mon_deinit(struct gk20a *g) int nvgpu_cic_mon_deinit(struct gk20a *g)
{ {
#ifdef CONFIG_NVGPU_FSI_ERR_INJECTION
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 mon deinit despite err inj utility
* de-registration failure, as the err inj support
* is meant only for debug purposes.
*/
}
}
#endif
/** More deinit calls might get added here as CIC grows. */ /** More deinit calls might get added here as CIC grows. */
return nvgpu_cic_mon_deinit_lut(g); return nvgpu_cic_mon_deinit_lut(g);
} }

View File

@@ -849,9 +849,9 @@ int nvgpu_early_poweron(struct gk20a *g)
/* Initialize CIC early on before the interrupts are /* Initialize CIC early on before the interrupts are
* enabled. * enabled.
*/ */
err = nvgpu_cic_mon_init_lut(g); err = nvgpu_cic_mon_init(g);
if (err != 0) { if (err != 0) {
nvgpu_err(g, "CIC LUT Initialization failed[%d]", err); nvgpu_err(g, "CIC Mon Initialization failed[%d]", err);
goto done; goto done;
} }
done: done:

View File

@@ -274,7 +274,7 @@ struct nvgpu_err_desc;
*/ */
int nvgpu_cic_mon_setup(struct gk20a *g); int nvgpu_cic_mon_setup(struct gk20a *g);
int nvgpu_cic_mon_init_lut(struct gk20a *g); int nvgpu_cic_mon_init(struct gk20a *g);
/** /**
* @brief De-initialize the CIC unit's data structures * @brief De-initialize the CIC unit's data structures

View File

@@ -59,6 +59,7 @@ struct gops_cic_mon {
*/ */
int (*report_err)(struct gk20a *g, u32 err_id); int (*report_err)(struct gk20a *g, u32 err_id);
#ifdef CONFIG_NVGPU_FSI_ERR_INJECTION
/** /**
* @brief Register error injection callback with error * @brief Register error injection callback with error
* injection utility. * injection utility.
@@ -76,6 +77,7 @@ 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 (*dereg_errinj_cb)(void); int (*dereg_errinj_cb)(void);
#endif
}; };
#endif/*NVGPU_GOPS_CIC_MON_H*/ #endif/*NVGPU_GOPS_CIC_MON_H*/

View File

@@ -796,7 +796,7 @@ gk20a_bus_set_bar0_window
nvgpu_pramin_ops_init nvgpu_pramin_ops_init
nvgpu_dma_alloc_vid_at nvgpu_dma_alloc_vid_at
nvgpu_cic_mon_setup nvgpu_cic_mon_setup
nvgpu_cic_mon_init_lut nvgpu_cic_mon_init
nvgpu_cic_mon_deinit nvgpu_cic_mon_deinit
nvgpu_cic_mon_bound_check_hw_unit_id nvgpu_cic_mon_bound_check_hw_unit_id
nvgpu_cic_mon_bound_check_err_id nvgpu_cic_mon_bound_check_err_id

View File

@@ -823,7 +823,7 @@ nvgpu_rc_ce_fault
gp10b_priv_ring_isr_handle_0 gp10b_priv_ring_isr_handle_0
gp10b_priv_ring_isr_handle_1 gp10b_priv_ring_isr_handle_1
nvgpu_cic_mon_setup nvgpu_cic_mon_setup
nvgpu_cic_mon_init_lut nvgpu_cic_mon_init
nvgpu_cic_mon_deinit nvgpu_cic_mon_deinit
nvgpu_cic_mon_bound_check_hw_unit_id nvgpu_cic_mon_bound_check_hw_unit_id
nvgpu_cic_mon_bound_check_err_id nvgpu_cic_mon_bound_check_err_id

View File

@@ -224,9 +224,9 @@ static int init_acr_falcon_test_env(struct unit_module *m, struct gk20a *g)
unit_return_fail(m, "CIC init failed\n"); unit_return_fail(m, "CIC init failed\n");
} }
err = nvgpu_cic_mon_init_lut(g); err = nvgpu_cic_mon_init(g);
if (err != 0) { if (err != 0) {
unit_return_fail(m, "CIC LUT init failed\n"); unit_return_fail(m, "CIC Mon init failed\n");
} }
/* /*

View File

@@ -163,8 +163,8 @@ int test_bus_setup(struct unit_module *m, struct gk20a *g, void *args)
return UNIT_FAIL; return UNIT_FAIL;
} }
if (nvgpu_cic_mon_init_lut(g) != 0) { if (nvgpu_cic_mon_init(g) != 0) {
unit_err(m, "%s: Failed to initialize CIC LUT\n", unit_err(m, "%s: Failed to initialize CIC Mon\n",
__func__); __func__);
return UNIT_FAIL; return UNIT_FAIL;
} }

View File

@@ -137,8 +137,8 @@ int test_ce_setup_env(struct unit_module *m,
return UNIT_FAIL; return UNIT_FAIL;
} }
if (nvgpu_cic_mon_init_lut(g) != 0) { if (nvgpu_cic_mon_init(g) != 0) {
unit_err(m, "%s: failed to initialize CIC LUT\n", unit_err(m, "%s: failed to initialize CIC Mon\n",
__func__); __func__);
return UNIT_FAIL; return UNIT_FAIL;
} }

View File

@@ -81,8 +81,8 @@ int fb_gv11b_init_test(struct unit_module *m, struct gk20a *g, void *args)
unit_return_fail(m, "CIC init failed\n"); unit_return_fail(m, "CIC init failed\n");
} }
if (nvgpu_cic_mon_init_lut(g) != 0) { if (nvgpu_cic_mon_init(g) != 0) {
unit_return_fail(m, "CIC LUT init failed\n"); unit_return_fail(m, "CIC Mon init failed\n");
} }
g->ops.ecc.ecc_init_support(g); g->ops.ecc.ecc_init_support(g);

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -195,9 +195,9 @@ int test_fifo_init_support(struct unit_module *m, struct gk20a *g, void *args)
return UNIT_FAIL; return UNIT_FAIL;
} }
err = nvgpu_cic_mon_init_lut(g); err = nvgpu_cic_mon_init(g);
if (err != 0) { if (err != 0) {
unit_return_fail(m, "CIC LUT init failed\n"); unit_return_fail(m, "CIC mon init failed\n");
} }
err = nvgpu_cic_rm_setup(g); err = nvgpu_cic_rm_setup(g);

View File

@@ -175,9 +175,9 @@ int test_gr_init_setup_ready(struct unit_module *m,
unit_return_fail(m, "CIC init failed\n"); unit_return_fail(m, "CIC init failed\n");
} }
err = nvgpu_cic_mon_init_lut(g); err = nvgpu_cic_mon_init(g);
if (err != 0) { if (err != 0) {
unit_return_fail(m, "CIC LUT init failed\n"); unit_return_fail(m, "CIC Mon init failed\n");
} }
err = nvgpu_cic_rm_setup(g); err = nvgpu_cic_rm_setup(g);

View File

@@ -142,9 +142,9 @@ int test_ltc_init_support(struct unit_module *m,
unit_return_fail(m, "CIC init failed\n"); unit_return_fail(m, "CIC init failed\n");
} }
err = nvgpu_cic_mon_init_lut(g); err = nvgpu_cic_mon_init(g);
if (err != 0) { if (err != 0) {
unit_return_fail(m, "CIC LUT init failed\n"); unit_return_fail(m, "CIC Mon init failed\n");
} }
/* /*

View File

@@ -228,8 +228,8 @@ int test_env_init_mm_mmu_fault_gv11b_fusa(struct unit_module *m,
unit_return_fail(m, "Failed to initialize CIC\n"); unit_return_fail(m, "Failed to initialize CIC\n");
} }
if (nvgpu_cic_mon_init_lut(g) != 0) { if (nvgpu_cic_mon_init(g) != 0) {
unit_return_fail(m, "Failed to initialize CIC LUT\n"); unit_return_fail(m, "Failed to initialize CIC Mon\n");
} }
return UNIT_SUCCESS; return UNIT_SUCCESS;

View File

@@ -166,8 +166,8 @@ int test_priv_ring_setup(struct unit_module *m, struct gk20a *g, void *args)
return UNIT_FAIL; return UNIT_FAIL;
} }
if (nvgpu_cic_mon_init_lut(g) != 0) { if (nvgpu_cic_mon_init(g) != 0) {
unit_err(m, "%s: Failed to initialize CIC LUT\n", unit_err(m, "%s: Failed to initialize CIC Mon\n",
__func__); __func__);
return UNIT_FAIL; return UNIT_FAIL;
} }

View File

@@ -106,8 +106,8 @@ int ptimer_test_setup_env(struct unit_module *m,
return UNIT_FAIL; return UNIT_FAIL;
} }
if (nvgpu_cic_mon_init_lut(g) != 0) { if (nvgpu_cic_mon_init(g) != 0) {
unit_err(m, "%s: failed to initialize CIC LUT\n", unit_err(m, "%s: failed to initialize CIC Mon\n",
__func__); __func__);
return UNIT_FAIL; return UNIT_FAIL;
} }