Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: enable eviction fence

This patch enables attachment and detachment of eviction fences.
This is just a fork of eviction fence enabling code from the first
patch of the series so that the CI testing can happen on fully
fledged code.

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian Koenig <christian.koenig@amd.com>
Reviewed-by: Christian Koenig <christian.koenig@amd.com>
Signed-off-by: Shashank Sharma <shashank.sharma@amd.com>
Signed-off-by: Arvind Yadav <arvind.yadav@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Shashank Sharma and committed by
Alex Deucher
31f7efcd a242a3e4

+12
+2
drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c
··· 177 177 if (!ev_fence) 178 178 return; 179 179 180 + dma_fence_wait(&ev_fence->base, false); 181 + 180 182 /* Last unref of ev_fence */ 181 183 dma_fence_put(&evf_mgr->ev_fence->base); 182 184 }
+10
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
··· 294 294 else 295 295 ++bo_va->ref_count; 296 296 297 + /* attach gfx eviction fence */ 298 + r = amdgpu_eviction_fence_attach(&fpriv->evf_mgr, abo); 299 + if (r) { 300 + DRM_DEBUG_DRIVER("Failed to attach eviction fence to BO\n"); 301 + return r; 302 + } 303 + 297 304 amdgpu_bo_unreserve(abo); 298 305 299 306 /* Validate and add eviction fence to DMABuf imports with dynamic ··· 350 343 struct amdgpu_bo_va *bo_va; 351 344 struct drm_exec exec; 352 345 long r; 346 + 347 + if (!amdgpu_vm_is_bo_always_valid(vm, bo)) 348 + amdgpu_eviction_fence_detach(&fpriv->evf_mgr, bo); 353 349 354 350 drm_exec_init(&exec, DRM_EXEC_IGNORE_DUPLICATES, 0); 355 351 drm_exec_until_all_locked(&exec) {