diff options
author | Felix Kuehling <Felix.Kuehling@amd.com> | 2019-02-04 17:46:35 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2019-02-13 17:50:32 -0500 |
commit | e8e32426b1271d3387208c3a6eaf7c166bea9975 (patch) | |
tree | 3b5e4047acc9f3f7e679472f000e448deeb9c6e5 /drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |
parent | 2c11ee6ae5533821cf2c64972d6cb5aa4ab4a46e (diff) |
drm/amdgpu: Add helper to wait for BO fences using a sync object
Creates a temporary sync object to wait for the BO reservation. This
generalizes amdgpu_vm_wait_pd.
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 75481cf3348f..3f33286c3cd5 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |||
@@ -1332,31 +1332,6 @@ static void amdgpu_vm_cpu_set_ptes(struct amdgpu_pte_update_params *params, | |||
1332 | } | 1332 | } |
1333 | } | 1333 | } |
1334 | 1334 | ||
1335 | |||
1336 | /** | ||
1337 | * amdgpu_vm_wait_pd - Wait for PT BOs to be free. | ||
1338 | * | ||
1339 | * @adev: amdgpu_device pointer | ||
1340 | * @vm: related vm | ||
1341 | * @owner: fence owner | ||
1342 | * | ||
1343 | * Returns: | ||
1344 | * 0 on success, errno otherwise. | ||
1345 | */ | ||
1346 | static int amdgpu_vm_wait_pd(struct amdgpu_device *adev, struct amdgpu_vm *vm, | ||
1347 | void *owner) | ||
1348 | { | ||
1349 | struct amdgpu_sync sync; | ||
1350 | int r; | ||
1351 | |||
1352 | amdgpu_sync_create(&sync); | ||
1353 | amdgpu_sync_resv(adev, &sync, vm->root.base.bo->tbo.resv, owner, false); | ||
1354 | r = amdgpu_sync_wait(&sync, true); | ||
1355 | amdgpu_sync_free(&sync); | ||
1356 | |||
1357 | return r; | ||
1358 | } | ||
1359 | |||
1360 | /** | 1335 | /** |
1361 | * amdgpu_vm_update_func - helper to call update function | 1336 | * amdgpu_vm_update_func - helper to call update function |
1362 | * | 1337 | * |
@@ -1451,7 +1426,8 @@ restart: | |||
1451 | params.adev = adev; | 1426 | params.adev = adev; |
1452 | 1427 | ||
1453 | if (vm->use_cpu_for_update) { | 1428 | if (vm->use_cpu_for_update) { |
1454 | r = amdgpu_vm_wait_pd(adev, vm, AMDGPU_FENCE_OWNER_VM); | 1429 | r = amdgpu_bo_sync_wait(vm->root.base.bo, |
1430 | AMDGPU_FENCE_OWNER_VM, true); | ||
1455 | if (unlikely(r)) | 1431 | if (unlikely(r)) |
1456 | return r; | 1432 | return r; |
1457 | 1433 | ||
@@ -1784,7 +1760,7 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev, | |||
1784 | /* Wait for PT BOs to be idle. PTs share the same resv. object | 1760 | /* Wait for PT BOs to be idle. PTs share the same resv. object |
1785 | * as the root PD BO | 1761 | * as the root PD BO |
1786 | */ | 1762 | */ |
1787 | r = amdgpu_vm_wait_pd(adev, vm, owner); | 1763 | r = amdgpu_bo_sync_wait(vm->root.base.bo, owner, true); |
1788 | if (unlikely(r)) | 1764 | if (unlikely(r)) |
1789 | return r; | 1765 | return r; |
1790 | 1766 | ||