From 85cfd9888490e18d9aa98622efc540a96c6bc879 Mon Sep 17 00:00:00 2001 From: Lakshmanan M Date: Fri, 18 Sep 2020 17:33:00 +0530 Subject: [PATCH] gpu: nvgpu: add grmgr gops to query gpc id info Added grmgr gops to query logical->physical gpc id information. JIRA NVGPU-5647 Change-Id: I24b56873ea0906028b8fbece8b83fea24b0d861b Signed-off-by: Lakshmanan M Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2416163 Reviewed-by: automaticguardword Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: svc-mobile-cert Reviewed-by: Shashank Singh Reviewed-by: Vaibhav Kachore Reviewed-by: mobile promotions Tested-by: Shashank Singh Tested-by: mobile promotions GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/common/grmgr/grmgr.c | 22 +++++++++++++++----- drivers/gpu/nvgpu/include/nvgpu/gops/grmgr.h | 12 +++++++++++ 2 files changed, 29 insertions(+), 5 deletions(-) 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. *