Merge tag 'amd-drm-next-5.19-2022-04-15' of https://gitlab.freedesktop.org/agd5f...
[linux-block.git] / drivers / gpu / drm / amd / amdgpu / amdgpu_ids.c
index 558f90e11d7861a7b21aeb0bf71a65a634def982..03d115d2b5edd25a65fb1b5dcfec0306bde382f3 100644 (file)
@@ -107,36 +107,19 @@ static void amdgpu_pasid_free_cb(struct dma_fence *fence,
 void amdgpu_pasid_free_delayed(struct dma_resv *resv,
                               u32 pasid)
 {
-       struct dma_fence *fence, **fences;
        struct amdgpu_pasid_cb *cb;
-       unsigned count;
+       struct dma_fence *fence;
        int r;
 
-       r = dma_resv_get_fences(resv, true, &count, &fences);
+       r = dma_resv_get_singleton(resv, DMA_RESV_USAGE_BOOKKEEP, &fence);
        if (r)
                goto fallback;
 
-       if (count == 0) {
+       if (!fence) {
                amdgpu_pasid_free(pasid);
                return;
        }
 
-       if (count == 1) {
-               fence = fences[0];
-               kfree(fences);
-       } else {
-               uint64_t context = dma_fence_context_alloc(1);
-               struct dma_fence_array *array;
-
-               array = dma_fence_array_create(count, fences, context,
-                                              1, false);
-               if (!array) {
-                       kfree(fences);
-                       goto fallback;
-               }
-               fence = &array->base;
-       }
-
        cb = kmalloc(sizeof(*cb), GFP_KERNEL);
        if (!cb) {
                /* Last resort when we are OOM */
@@ -156,7 +139,8 @@ fallback:
        /* Not enough memory for the delayed delete, as last resort
         * block for all the fences to complete.
         */
-       dma_resv_wait_timeout(resv, true, false, MAX_SCHEDULE_TIMEOUT);
+       dma_resv_wait_timeout(resv, DMA_RESV_USAGE_BOOKKEEP,
+                             false, MAX_SCHEDULE_TIMEOUT);
        amdgpu_pasid_free(pasid);
 }