• Felix Kuehling's avatar
    drm/amdgpu: Auto-validate DMABuf imports in compute VMs · 50661eb1
    Felix Kuehling authored
    DMABuf imports in compute VMs are not wrapped in a kgd_mem object on the
    process_info->kfd_bo_list. There is no explicit KFD API call to validate
    them or add eviction fences to them.
    
    This patch automatically validates and fences dymanic DMABuf imports when
    they are added to a compute VM. Revalidation after evictions is handled
    in the VM code.
    
    v2:
    * Renamed amdgpu_vm_validate_evicted_bos to amdgpu_vm_validate
    * Eliminated evicted_user state, use evicted state for VM BOs and user BOs
    * Fixed and simplified amdgpu_vm_fence_imports, depends on reserved BOs
    * Moved dma_resv_reserve_fences for amdgpu_vm_fence_imports into
      amdgpu_vm_validate, outside the vm->status_lock
    * Added dummy version of amdgpu_amdkfd_bo_validate_and_fence for builds
      without KFD
    
    v4: Eliminate amdgpu_vm_fence_imports. It's not needed because the
    reservation with its fences is shared with the export, as long as all
    imports are from KFD, with the exports already reserved, validated and
    fenced by the KFD restore worker.
    
    v5: Reintroduced separate evicted_user state to simplify the state machine
    and CS error handling when amdgpu_vm_validate is called without a ticket.
    Signed-off-by: default avatarFelix Kuehling <felix.kuehling@amd.com>
    Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
    Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
    50661eb1
amdgpu_vm.c 74.4 KB