From d2bb5df3c7aaae68708346edb212702f4c88c15e Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Wed, 23 Sep 2020 12:29:57 +0530 Subject: [PATCH] gpu: nvgpu: remove NVGPU_GR_NUM_INSTANCES common.gr defined a temporary macro NVGPU_GR_NUM_INSTANCES to enable or disable multiple GR instances from common.gr unit. Multiple GR instance boot is now verified, so we can remove this temporary solution. Note that nvgpu_grmgr_get_num_gr_instances() will return more than 1 instance only if NVGPU_SUPPORT_MIG is enabled. Update unit tests to set number of syspipes to 1 to allow enumeration of GR instance by grmgr. Jira NVGPU-5648 Change-Id: I795901ae516843ae7b6c1794dae0f023a213ab1d Signed-off-by: Deepak Nibade Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2418377 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: Lakshmanan M Reviewed-by: Vaibhav Kachore Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/gr/gr.c | 13 +------------ userspace/units/acr/nvgpu-acr.c | 1 + userspace/units/gr/nvgpu-gr.c | 1 + userspace/units/ltc/nvgpu-ltc.c | 1 + userspace/units/pmu/nvgpu-pmu.c | 1 + 5 files changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/nvgpu/common/gr/gr.c b/drivers/gpu/nvgpu/common/gr/gr.c index 47a51ad05..d624abd60 100644 --- a/drivers/gpu/nvgpu/common/gr/gr.c +++ b/drivers/gpu/nvgpu/common/gr/gr.c @@ -53,14 +53,6 @@ #include "gr_priv.h" -/* - * Use this until common.gr is completely updated to support multiple - * GR instances. Once that is supported, nvgpu_grmgr_get_num_gr_instances() - * should be used to get number of GR instances. - * Set this to 0 for local MIG testing. - */ -#define NVGPU_GR_NUM_INSTANCES 1 - static int gr_alloc_global_ctx_buffers(struct gk20a *g, struct nvgpu_gr *gr) { int err; @@ -875,10 +867,7 @@ int nvgpu_gr_alloc(struct gk20a *g) return 0; } - g->num_gr_instances = NVGPU_GR_NUM_INSTANCES; - if (g->num_gr_instances == 0U) { - g->num_gr_instances = nvgpu_grmgr_get_num_gr_instances(g); - } + g->num_gr_instances = nvgpu_grmgr_get_num_gr_instances(g); if (g->num_gr_instances == 0U) { nvgpu_err(g, "No GR engine enumerated"); return -EINVAL; diff --git a/userspace/units/acr/nvgpu-acr.c b/userspace/units/acr/nvgpu-acr.c index fce6e3fa1..edeb8a6d9 100644 --- a/userspace/units/acr/nvgpu-acr.c +++ b/userspace/units/acr/nvgpu-acr.c @@ -180,6 +180,7 @@ static void nvgpu_init_gr_manager(struct gk20a *g) struct nvgpu_gr_syspipe *gr_syspipe = &gpu_instance->gr_syspipe; g->mig.num_gpu_instances = 1; + g->mig.num_gr_sys_pipes_enabled = 1; gr_syspipe->gr_instance_id = 0U; gr_syspipe->gr_syspipe_id = 0U; } diff --git a/userspace/units/gr/nvgpu-gr.c b/userspace/units/gr/nvgpu-gr.c index 77d2a8dd4..2f1de6383 100644 --- a/userspace/units/gr/nvgpu-gr.c +++ b/userspace/units/gr/nvgpu-gr.c @@ -47,6 +47,7 @@ static void nvgpu_init_gr_manager(struct gk20a *g) struct nvgpu_gr_syspipe *gr_syspipe = &gpu_instance->gr_syspipe; g->mig.num_gpu_instances = 1; + g->mig.num_gr_sys_pipes_enabled = 1; gr_syspipe->gr_instance_id = 0U; gr_syspipe->gr_syspipe_id = 0U; } diff --git a/userspace/units/ltc/nvgpu-ltc.c b/userspace/units/ltc/nvgpu-ltc.c index 52d48e85c..b5dc04090 100644 --- a/userspace/units/ltc/nvgpu-ltc.c +++ b/userspace/units/ltc/nvgpu-ltc.c @@ -248,6 +248,7 @@ static void nvgpu_init_gr_manager(struct gk20a *g) struct nvgpu_gr_syspipe *gr_syspipe = &gpu_instance->gr_syspipe; g->mig.num_gpu_instances = 1; + g->mig.num_gr_sys_pipes_enabled = 1; gr_syspipe->gr_instance_id = 0U; gr_syspipe->gr_syspipe_id = 0U; } diff --git a/userspace/units/pmu/nvgpu-pmu.c b/userspace/units/pmu/nvgpu-pmu.c index ce2456cdd..f99c81d10 100644 --- a/userspace/units/pmu/nvgpu-pmu.c +++ b/userspace/units/pmu/nvgpu-pmu.c @@ -168,6 +168,7 @@ static void nvgpu_init_gr_manager(struct gk20a *g) struct nvgpu_gr_syspipe *gr_syspipe = &gpu_instance->gr_syspipe; g->mig.num_gpu_instances = 1; + g->mig.num_gr_sys_pipes_enabled = 1; gr_syspipe->gr_instance_id = 0U; gr_syspipe->gr_syspipe_id = 0U; }