Skip to content

Commit 90ca78d

Browse files
fxkamdalexdeucher
authored andcommitted
drm/amdgpu: Sync with VM root BO when switching VM to CPU update mode
This fixes an intermittent bug where a root PD clear operation still in progress could overwrite a PDE update done by the CPU, resulting in a VM fault. Fixes: 108b4d9 ("drm/amd/amdgpu: Update VM function pointer") Reported-by: Jay Cornwall <[email protected]> Tested-by: Jay Cornwall <[email protected]> Signed-off-by: Felix Kuehling <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent cdaae83 commit 90ca78d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3000,10 +3000,17 @@ int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm,
30003000
!amdgpu_gmc_vram_full_visible(&adev->gmc)),
30013001
"CPU update of VM recommended only for large BAR system\n");
30023002

3003-
if (vm->use_cpu_for_update)
3003+
if (vm->use_cpu_for_update) {
3004+
/* Sync with last SDMA update/clear before switching to CPU */
3005+
r = amdgpu_bo_sync_wait(vm->root.base.bo,
3006+
AMDGPU_FENCE_OWNER_UNDEFINED, true);
3007+
if (r)
3008+
goto free_idr;
3009+
30043010
vm->update_funcs = &amdgpu_vm_cpu_funcs;
3005-
else
3011+
} else {
30063012
vm->update_funcs = &amdgpu_vm_sdma_funcs;
3013+
}
30073014
dma_fence_put(vm->last_update);
30083015
vm->last_update = NULL;
30093016
vm->is_compute_context = true;

0 commit comments

Comments
 (0)