diff --git a/drivers/gpu/nvgpu/common/grmgr/grmgr.c b/drivers/gpu/nvgpu/common/grmgr/grmgr.c index cee070818..65174314a 100644 --- a/drivers/gpu/nvgpu/common/grmgr/grmgr.c +++ b/drivers/gpu/nvgpu/common/grmgr/grmgr.c @@ -60,11 +60,23 @@ int nvgpu_init_gr_manager(struct gk20a *g) 1U); } - /* In Legacy mode, Local GPC Id = physical GPC Id = Logical GPC Id */ - for (gpc_id = 0U; gpc_id < gr_syspipe->num_gpc; gpc_id++) { - gr_syspipe->gpcs[gpc_id].logical_id = - gr_syspipe->gpcs[gpc_id].physical_id = gpc_id; - gr_syspipe->gpcs[gpc_id].gpcgrp_id = 0U; + if (g->ops.grmgr.discover_gpc_ids != NULL) { + if (g->ops.grmgr.discover_gpc_ids(g, + gr_syspipe->num_gpc, + gr_syspipe->gpcs) != 0) { + nvgpu_err(g, "discover_gpc_ids -failed"); + return -EINVAL; + } + } else { + /* + * For Legacy gpu, + * Local GPC Id = physical GPC Id = Logical GPC Id. + */ + for (gpc_id = 0U; gpc_id < gr_syspipe->num_gpc; gpc_id++) { + gr_syspipe->gpcs[gpc_id].logical_id = + gr_syspipe->gpcs[gpc_id].physical_id = gpc_id; + gr_syspipe->gpcs[gpc_id].gpcgrp_id = 0U; + } } gr_syspipe->max_veid_count_per_tsg = g->fifo.max_subctx_count; gr_syspipe->veid_start_offset = 0U; diff --git a/drivers/gpu/nvgpu/include/nvgpu/gops/grmgr.h b/drivers/gpu/nvgpu/include/nvgpu/gops/grmgr.h index e779488d5..e42eef68a 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/gops/grmgr.h +++ b/drivers/gpu/nvgpu/include/nvgpu/gops/grmgr.h @@ -47,6 +47,18 @@ struct gops_grmgr { */ int (*init_gr_manager)(struct gk20a *g); + /** + * @brief Query GPU physical->logical gpc ids. + * + * @param g [in] Pointer to GPU driver struct. + * @param num_gpc [in] Number of GPCs. + * @param gpcs [out] Pointer to GPC Id information struct. + * + * @return 0 in case of success, < 0 in case of failure. + */ + int (*discover_gpc_ids)(struct gk20a *g, u32 num_gpc, + struct nvgpu_gpc *gpcs); + /** * @brief Remove GR Manager unit. *