drm/amdgpu: add svm_bo eviction to enable_signal cb
authorAlex Sierra <alex.sierra@amd.com>
Tue, 28 Jul 2020 21:03:05 +0000 (16:03 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 21 Apr 2021 01:49:56 +0000 (21:49 -0400)
Add to amdgpu_amdkfd_fence.enable_signal callback, support
for svm_bo fence eviction.

Signed-off-by: Alex Sierra <alex.sierra@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c

index 5355964..1fe233c 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/slab.h>
 #include <linux/sched/mm.h>
 #include "amdgpu_amdkfd.h"
+#include "kfd_svm.h"
 
 static const struct dma_fence_ops amdkfd_fence_ops;
 static atomic_t fence_seq = ATOMIC_INIT(0);
@@ -123,9 +124,13 @@ static bool amdkfd_fence_enable_signaling(struct dma_fence *f)
        if (dma_fence_is_signaled(f))
                return true;
 
-       if (!kgd2kfd_schedule_evict_and_restore_process(fence->mm, f))
-               return true;
-
+       if (!fence->svm_bo) {
+               if (!kgd2kfd_schedule_evict_and_restore_process(fence->mm, f))
+                       return true;
+       } else {
+               if (!svm_range_schedule_evict_svm_bo(fence))
+                       return true;
+       }
        return false;
 }