gpu: nvgpu: remove golden_image_initialized flag from gr_gk20a struct

struct gr_gk20a defines boolean flag golden_image_initialized to
indicate if golden_image is initialized or not
common.gr.obj_ctx also added a flag of its own to check if golden_image
is ready

Add new API nvgpu_gr_obj_ctx_is_golden_image_ready() in
common.gr.obj_ctx unit to get status of golden_image

Use this new API everywhere to check if golden image is ready
Remove g->gr.ctx_vars.golden_image_initialized

Also remove ctx_mutex from struct gr_gk20a

Add new flag golden_image_initialized to struct nvgpu_pmu_pg and set it
when golden image is initialized. This is needed to avoid circular
dependency between GR and PMU

Jira NVGPU-3112

Change-Id: Id391294cede6424e15a9a9de29c40d013b509534
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2099400
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Deepak Nibade
2019-04-23 19:18:31 +05:30
committed by mobile promotions
parent 8e96d56cee
commit 45c56fd633
12 changed files with 76 additions and 74 deletions

View File

@@ -280,7 +280,6 @@ static void gr_remove_support(struct gk20a *g)
nvgpu_gr_zbc_deinit(g, gr->zbc);
nvgpu_gr_zcull_deinit(g, gr->zcull);
nvgpu_gr_obj_ctx_deinit(g, gr->golden_image);
gr->ctx_vars.golden_image_initialized = false;
}
static int gr_init_access_map(struct gk20a *g, struct nvgpu_gr *gr)
@@ -368,6 +367,16 @@ clean_up:
return -ENOMEM;
}
static int nvgpu_gr_init_ctx_state(struct gk20a *g)
{
if (g->gr->golden_image != NULL &&
nvgpu_gr_obj_ctx_is_golden_image_ready(g->gr->golden_image)) {
return 0;
}
return nvgpu_gr_falcon_init_ctx_state(g);
}
static int gr_init_setup_sw(struct gk20a *g)
{
struct nvgpu_gr *gr = g->gr;
@@ -451,12 +460,6 @@ static int gr_init_setup_sw(struct gk20a *g)
goto clean_up;
}
err = nvgpu_mutex_init(&gr->ctx_mutex);
if (err != 0) {
nvgpu_err(g, "Error in gr.ctx_mutex initialization");
goto clean_up;
}
nvgpu_spinlock_init(&gr->ch_tlb_lock);
gr->remove_support = gr_remove_support;
@@ -603,7 +606,7 @@ int nvgpu_gr_reset(struct gk20a *g)
/* this appears query for sw states but fecs actually init
ramchain, etc so this is hw init */
err = nvgpu_gr_falcon_init_ctx_state(g);
err = nvgpu_gr_init_ctx_state(g);
if (err != 0) {
return err;
}
@@ -640,7 +643,7 @@ int nvgpu_gr_init_support(struct gk20a *g)
/* this appears query for sw states but fecs actually init
ramchain, etc so this is hw init */
err = nvgpu_gr_falcon_init_ctx_state(g);
err = nvgpu_gr_init_ctx_state(g);
if (err != 0) {
return err;
}