drm/amdgpu/userq: fix hardcoded uq functions
authorAlex Deucher <alexander.deucher@amd.com>
Thu, 20 Feb 2025 21:08:02 +0000 (16:08 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 8 Apr 2025 20:48:20 +0000 (16:48 -0400)
Use the IP type to look up the userq functions rather
than hardcoding it.

Reviewed-by: Saleemkhan Jamadar <saleemkhan.jamadar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c

index f1d4e29772a53d34daf4fb1f5242438e3359f5c5..0664e04828c071873777162532128dbce13de38e 100644 (file)
@@ -415,11 +415,11 @@ amdgpu_userqueue_resume_all(struct amdgpu_userq_mgr *uq_mgr)
        int queue_id;
        int ret = 0;
 
-       userq_funcs = adev->userq_funcs[AMDGPU_HW_IP_GFX];
-
        /* Resume all the queues for this process */
-       idr_for_each_entry(&uq_mgr->userq_idr, queue, queue_id)
+       idr_for_each_entry(&uq_mgr->userq_idr, queue, queue_id) {
+               userq_funcs = adev->userq_funcs[queue->queue_type];
                ret = userq_funcs->resume(uq_mgr, queue);
+       }
 
        if (ret)
                DRM_ERROR("Failed to resume all the queue\n");
@@ -570,11 +570,11 @@ amdgpu_userqueue_suspend_all(struct amdgpu_userq_mgr *uq_mgr)
        int queue_id;
        int ret = 0;
 
-       userq_funcs = adev->userq_funcs[AMDGPU_HW_IP_GFX];
-
        /* Try to suspend all the queues in this process ctx */
-       idr_for_each_entry(&uq_mgr->userq_idr, queue, queue_id)
+       idr_for_each_entry(&uq_mgr->userq_idr, queue, queue_id) {
+               userq_funcs = adev->userq_funcs[queue->queue_type];
                ret += userq_funcs->suspend(uq_mgr, queue);
+       }
 
        if (ret)
                DRM_ERROR("Couldn't suspend all the queues\n");