gpu: nvgpu: use API to get golden image size

Use API nvgpu_gr_obj_ctx_get/set_golden_image_size() exposed by
gr.obj_ctx unit to get/set size of golden image

Call nvgpu_gr_obj_ctx_init() from vgpu_gr_init_gr_setup_sw() to
initialize golden image size in gr.obj_ctx unit even on vGPU

Move g->ops.gr.falcon.init_ctx_state() call early in
vgpu_gr_init_gr_setup_sw() so that gr.ctx_vars struct is prepared
before fields in it accessed during rest of GR initialization

Jira NVGPU-3112

Change-Id: Ie827ad6f30cc3d931519a1f9a709861d26f8da26
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2096162
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-11 19:34:46 +05:30
committed by mobile promotions
parent 6f0455a1c7
commit 0c297ce752
4 changed files with 26 additions and 12 deletions

View File

@@ -846,7 +846,7 @@ static ssize_t tpc_pg_mask_store(struct device *dev,
goto exit;
}
if (gr->ctx_vars.golden_image_size) {
if (nvgpu_gr_obj_ctx_get_golden_image_size(gr->golden_image) != 0) {
nvgpu_err(g, "golden image size already initialized");
nvgpu_mutex_release(&g->tpc_pg_lock);
return -ENODEV;
@@ -890,7 +890,7 @@ static ssize_t tpc_fs_mask_store(struct device *dev,
nvgpu_gr_obj_ctx_deinit(g, g->gr.golden_image);
g->gr.ctx_vars.golden_image_initialized = false;
g->gr.ctx_vars.golden_image_size = 0;
nvgpu_gr_obj_ctx_set_golden_image_size(g->gr.golden_image, 0);
nvgpu_gr_config_deinit(g, g->gr.config);
/* Cause next poweron to reinit just gr */