drm/amdgpu: use doorbell mgr for kfd process doorbells
[linux-2.6-microblaze.git] / drivers / gpu / drm / amd / amdkfd / kfd_chardev.c
index aef8e12..f3a0efb 100644 (file)
@@ -333,10 +333,12 @@ static int kfd_ioctl_create_queue(struct file *filep, struct kfd_process *p,
                goto err_bind_process;
        }
 
-       if (!pdd->doorbell_index &&
-           kfd_alloc_process_doorbells(dev->kfd, &pdd->doorbell_index) < 0) {
-               err = -ENOMEM;
-               goto err_alloc_doorbells;
+       if (!pdd->qpd.proc_doorbells) {
+               err = kfd_alloc_process_doorbells(dev->kfd, pdd);
+               if (err) {
+                       pr_debug("failed to allocate process doorbells\n");
+                       goto err_bind_process;
+               }
        }
 
        /* Starting with GFX11, wptr BOs must be mapped to GART for MES to determine work
@@ -417,7 +419,6 @@ err_create_queue:
        if (wptr_bo)
                amdgpu_amdkfd_free_gtt_mem(dev->adev, wptr_bo);
 err_wptr_map_gart:
-err_alloc_doorbells:
 err_bind_process:
 err_pdd:
        mutex_unlock(&p->mutex);
@@ -2266,10 +2267,10 @@ static int criu_restore_devices(struct kfd_process *p,
                        goto exit;
                }
 
-               if (!pdd->doorbell_index &&
-                   kfd_alloc_process_doorbells(pdd->dev->kfd, &pdd->doorbell_index) < 0) {
-                       ret = -ENOMEM;
-                       goto exit;
+               if (!pdd->qpd.proc_doorbells) {
+                       ret = kfd_alloc_process_doorbells(dev->kfd, pdd);
+                       if (ret)
+                               goto exit;
                }
        }