mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 09:12:24 +03:00
gpu: nvgpu: allocate struct nvgpu_gr based on enumerated gr count
Add new API nvgpu_grmgr_get_num_gr_instances() that returns number of GR instance enumerated by GR manager. This just returns number of sys pipes enabled since it is same as number of GR instances. For consistency until common.gr supports multiple GR instances completely, add a temporary macro NVGPU_GR_NUM_INSTANCES and set it to 1. If this macro is changed to 0 (for local MIG testing), fall back to use nvgpu_grmgr_get_num_gr_instances() to get enumerated number of GR instances. Use a for loop to initialize other variables of struct nvgpu_gr. Remove unnecessary NULL check in nvgpu_gr_alloc() since struct gk20a pointer can never be NULL in this path. Also remove corresponding unit test code. Jira NVGPU-5648 Change-Id: Id151d634a23235381229044f2a9af89e390886f2 Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2400151 Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
Alex Waterman
parent
625d6520b8
commit
cfa360f5b8
@@ -273,12 +273,6 @@ static int test_gr_alloc_errors(struct gk20a *g)
|
||||
nvgpu_kmem_get_fault_injection();
|
||||
struct nvgpu_gr *local_gr = g->gr;
|
||||
|
||||
/*Set g to NULL */
|
||||
err = nvgpu_gr_alloc(NULL);
|
||||
if (err == 0) {
|
||||
return UNIT_FAIL;
|
||||
}
|
||||
|
||||
/* Free NULL gr */
|
||||
g->gr = NULL;
|
||||
nvgpu_gr_free(g);
|
||||
|
||||
Reference in New Issue
Block a user