drm/amdkfd: Enable GWS on GFX9.4.3
authorMukul Joshi <mukul.joshi@amd.com>
Thu, 15 Jun 2023 18:43:36 +0000 (14:43 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 30 Jun 2023 17:06:49 +0000 (13:06 -0400)
Enable GWS capable queue creation for forward
progress gaurantee on GFX 9.4.3.

Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdkfd/kfd_device.c
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c

index 9d4abfd..226d2dd 100644 (file)
@@ -518,6 +518,7 @@ static int kfd_gws_init(struct kfd_node *node)
                        && kfd->mec2_fw_version >= 0x30)   ||
                (KFD_GC_VERSION(node) == IP_VERSION(9, 4, 2)
                        && kfd->mec2_fw_version >= 0x28) ||
+               (KFD_GC_VERSION(node) == IP_VERSION(9, 4, 3)) ||
                (KFD_GC_VERSION(node) >= IP_VERSION(10, 3, 0)
                        && KFD_GC_VERSION(node) < IP_VERSION(11, 0, 0)
                        && kfd->mec2_fw_version >= 0x6b))))
index 9ad1a21..ba9d690 100644 (file)
@@ -123,16 +123,24 @@ int pqm_set_gws(struct process_queue_manager *pqm, unsigned int qid,
        if (!gws && pdd->qpd.num_gws == 0)
                return -EINVAL;
 
-       if (gws)
-               ret = amdgpu_amdkfd_add_gws_to_process(pdd->process->kgd_process_info,
-                       gws, &mem);
-       else
-               ret = amdgpu_amdkfd_remove_gws_from_process(pdd->process->kgd_process_info,
-                       pqn->q->gws);
-       if (unlikely(ret))
-               return ret;
+       if (KFD_GC_VERSION(dev) != IP_VERSION(9, 4, 3)) {
+               if (gws)
+                       ret = amdgpu_amdkfd_add_gws_to_process(pdd->process->kgd_process_info,
+                               gws, &mem);
+               else
+                       ret = amdgpu_amdkfd_remove_gws_from_process(pdd->process->kgd_process_info,
+                               pqn->q->gws);
+               if (unlikely(ret))
+                       return ret;
+               pqn->q->gws = mem;
+       } else {
+               /*
+                * Intentionally set GWS to a non-NULL value
+                * for GFX 9.4.3.
+                */
+               pqn->q->gws = gws ? ERR_PTR(-ENOMEM) : NULL;
+       }
 
-       pqn->q->gws = mem;
        pdd->qpd.num_gws = gws ? dev->adev->gds.gws_size : 0;
 
        return pqn->q->device->dqm->ops.update_queue(pqn->q->device->dqm,
@@ -164,7 +172,8 @@ void pqm_uninit(struct process_queue_manager *pqm)
        struct process_queue_node *pqn, *next;
 
        list_for_each_entry_safe(pqn, next, &pqm->queues, process_queue_list) {
-               if (pqn->q && pqn->q->gws)
+               if (pqn->q && pqn->q->gws &&
+                   KFD_GC_VERSION(pqn->q->device) != IP_VERSION(9, 4, 3))
                        amdgpu_amdkfd_remove_gws_from_process(pqm->process->kgd_process_info,
                                pqn->q->gws);
                kfd_procfs_del_queue(pqn->q);
@@ -446,8 +455,10 @@ int pqm_destroy_queue(struct process_queue_manager *pqm, unsigned int qid)
                }
 
                if (pqn->q->gws) {
-                       amdgpu_amdkfd_remove_gws_from_process(pqm->process->kgd_process_info,
-                               pqn->q->gws);
+                       if (KFD_GC_VERSION(pqn->q->device) != IP_VERSION(9, 4, 3))
+                               amdgpu_amdkfd_remove_gws_from_process(
+                                               pqm->process->kgd_process_info,
+                                               pqn->q->gws);
                        pdd->qpd.num_gws = 0;
                }