[AMD Public Use]

Series is:
Tested-by: Aaron Liu <aaron....@amd.com>

--
Best Regards
Aaron Liu

-----Original Message-----
From: Das, Nirmoy <nirmoy....@amd.com> 
Sent: Wednesday, October 14, 2020 9:53 PM
To: amd-gfx@lists.freedesktop.org
Cc: Deucher, Alexander <alexander.deuc...@amd.com>; Koenig, Christian 
<christian.koe...@amd.com>; Chen, Guchun <guchun.c...@amd.com>; Liu, Aaron 
<aaron....@amd.com>; Das, Nirmoy <nirmoy....@amd.com>
Subject: [PATCH 1/2] drm:amdgpu: check before setting hw priority

Check validity of drm_gpu_scheduler before setting hw priority.
Also fix a minor indentation issue.

Signed-off-by: Nirmoy Das <nirmoy....@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
index a03398c87344..c8da0978d4f6 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
@@ -504,9 +504,9 @@ struct dma_fence *amdgpu_ctx_get_fence(struct amdgpu_ctx 
*ctx,  }
 
 static void amdgpu_ctx_set_entity_priority(struct amdgpu_ctx *ctx,
-                                           struct amdgpu_ctx_entity *aentity,
-                                           int hw_ip,
-                                           enum drm_sched_priority priority)
+                                          struct amdgpu_ctx_entity *aentity,
+                                          int hw_ip,
+                                          enum drm_sched_priority priority)
 {
        struct amdgpu_device *adev = ctx->adev;
        unsigned int hw_prio;
@@ -523,6 +523,9 @@ static void amdgpu_ctx_set_entity_priority(struct 
amdgpu_ctx *ctx,
                hw_prio = array_index_nospec(hw_prio, AMDGPU_RING_PRIO_MAX);
                scheds = adev->gpu_sched[hw_ip][hw_prio].sched;
                num_scheds = adev->gpu_sched[hw_ip][hw_prio].num_scheds;
+               if (!scheds || !num_scheds)
+                       return;
+
                drm_sched_entity_modify_sched(&aentity->entity, scheds,
                                              num_scheds);
        }
--
2.28.0
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to