gpu: nvgpu: initialize per GR instance config

Expose below two new APIs from common.grmgr unit
nvgpu_grmgr_get_gr_num_gpcs() - get per instance number of GPCs
nvgpu_grmgr_get_gr_gpc_phys_id() - get physical GPC id for MIG engine
local id in corresponding instance

Execute gr_init_config() for each GR instance.
Add gr_config_init_mig_gpcs() to initialize GPC data in case MIG is
enabled. Separate out gr_config_init_gpcs() for legacy GPC data
initialization.

These functions will inititialize below data in struct nvgpu_gr_config:
max_gpc_count
gpc_count
gpc_mask
gpc_tpc_mask[gpc_count]
max_tpc_per_gpc_count

Rest of the values in struct nvgpu_gr_config are either based on above
values, or read from HW after setting GPC PRI window.

In gr_config_alloc_struct_mem(), rename total_gpc_cnt to total_tpc_cnt
since it represents total TPC count and not GPC. Remove use of temp3
variable since it does not give any idea on usage.

Jira NVGPU-5648

Change-Id: I646cac2ddc312e72b241b1b2a0e51a5cce141535
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2406390
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Lakshmanan M <lm@nvidia.com>
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Deepak Nibade
2020-08-31 13:47:58 +05:30
committed by Alex Waterman
parent 002edb782a
commit fc12a284bf
4 changed files with 124 additions and 25 deletions

View File

@@ -373,8 +373,10 @@ static int gr_init_access_map(struct gk20a *g, struct nvgpu_gr *gr)
return 0;
}
static int gr_init_config(struct gk20a *g, struct nvgpu_gr *gr)
static int gr_init_config(struct gk20a *g)
{
struct nvgpu_gr *gr = &g->gr[g->mig.cur_gr_instance];
gr->config = nvgpu_gr_config_init(g);
if (gr->config == NULL) {
return -ENOMEM;
@@ -755,7 +757,7 @@ int nvgpu_gr_init_support(struct gk20a *g)
/* This is prerequisite for calling sm_id_config_early hal. */
if (!g->gr->sw_ready) {
err = gr_init_config(g, g->gr);
err = nvgpu_gr_exec_with_ret_for_each_instance(g, gr_init_config(g));
if (err != 0) {
return err;
}