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

@@ -24,6 +24,7 @@
#include <nvgpu/log.h>
#include <nvgpu/io.h>
#include <nvgpu/mm.h>
#include <nvgpu/pmu/pmu_pg.h>
#include <nvgpu/gr/ctx.h>
#include <nvgpu/gr/subctx.h>
#include <nvgpu/gr/global_ctx.h>
@@ -524,8 +525,8 @@ restore_fe_go_idle:
}
golden_image->ready = true;
g->gr->ctx_vars.golden_image_initialized = true;
nvgpu_pmu_set_golden_image_initialized(g, true);
g->ops.gr.falcon.set_current_ctx_invalid(g);
clean_up:
@@ -678,6 +679,18 @@ u32 *nvgpu_gr_obj_ctx_get_local_golden_image_ptr(
golden_image->local_golden_image);
}
bool nvgpu_gr_obj_ctx_is_golden_image_ready(
struct nvgpu_gr_obj_ctx_golden_image *golden_image)
{
bool ready;
nvgpu_mutex_acquire(&golden_image->ctx_mutex);
ready = golden_image->ready;
nvgpu_mutex_release(&golden_image->ctx_mutex);
return ready;
}
int nvgpu_gr_obj_ctx_init(struct gk20a *g,
struct nvgpu_gr_obj_ctx_golden_image **gr_golden_image, u32 size)
{
@@ -711,6 +724,7 @@ void nvgpu_gr_obj_ctx_deinit(struct gk20a *g,
golden_image->local_golden_image = NULL;
}
nvgpu_pmu_set_golden_image_initialized(g, false);
golden_image->ready = false;
nvgpu_kfree(g, golden_image);
}