]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/amdgpu: do not set nil entry in compute_prio_sched
authorNirmoy Das <nirmoy.das@amd.com>
Tue, 10 Mar 2020 12:15:56 +0000 (13:15 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 10 Mar 2020 19:54:07 +0000 (15:54 -0400)
If there are no high priority compute queues available then set normal
priority sched array to compute_prio_sched[AMDGPU_GFX_PIPE_PRIO_HIGH]

Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c

index 3b2370ad1e47f1e1ca6a3ef2593edfe090a93d62..fa575bdc03c862e64dba0f5d80a890e9663efa24 100644 (file)
@@ -686,10 +686,17 @@ static void amdgpu_ctx_init_compute_sched(struct amdgpu_device *adev)
        adev->gfx.num_compute_sched[i] = num_compute_sched_normal;
 
        i = AMDGPU_GFX_PIPE_PRIO_HIGH;
-       adev->gfx.compute_prio_sched[i] =
-               &adev->gfx.compute_sched[num_compute_sched_high - 1];
-       adev->gfx.num_compute_sched[i] =
-               adev->gfx.num_compute_rings - num_compute_sched_normal;
+       if (num_compute_sched_high == (AMDGPU_MAX_COMPUTE_RINGS - 1)) {
+               /* When compute has no high priority rings then use */
+               /* normal priority sched array */
+               adev->gfx.compute_prio_sched[i] = &adev->gfx.compute_sched[0];
+               adev->gfx.num_compute_sched[i] = num_compute_sched_normal;
+       } else {
+               adev->gfx.compute_prio_sched[i] =
+                       &adev->gfx.compute_sched[num_compute_sched_high - 1];
+               adev->gfx.num_compute_sched[i] =
+                       adev->gfx.num_compute_rings - num_compute_sched_normal;
+       }
 }
 
 void amdgpu_ctx_init_sched(struct amdgpu_device *adev)