diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2020-06-22 10:11:56 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2020-06-22 10:11:56 +0000 |
commit | c0ff2f6a40ff4a540e07a8278d8ee2c8a511d62a (patch) | |
tree | f673b8485d371869b87f56f8f2f04e8e10c15cb6 /sys | |
parent | e1e535e0229b21b1e1e89e7e2099b15ba001d4b0 (diff) |
drm/amdgpu: Sync with VM root BO when switching VM to CPU update mode
From Felix Kuehling
8db9696c1fdfa3d80e29ee80d002f315e4e344a9 in linux 5.7.y/5.7.5
90ca78deb004abe75b5024968a199acb96bb70f9 in mainline linux
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/drm/amd/amdgpu/amdgpu_vm.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_vm.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_vm.c index e57591a4572..c8a62754c92 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_vm.c +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_vm.c @@ -3074,10 +3074,17 @@ int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm, !amdgpu_gmc_vram_full_visible(&adev->gmc)), "CPU update of VM recommended only for large BAR system\n"); - if (vm->use_cpu_for_update) + if (vm->use_cpu_for_update) { + /* Sync with last SDMA update/clear before switching to CPU */ + r = amdgpu_bo_sync_wait(vm->root.base.bo, + AMDGPU_FENCE_OWNER_UNDEFINED, true); + if (r) + goto free_idr; + vm->update_funcs = &amdgpu_vm_cpu_funcs; - else + } else { vm->update_funcs = &amdgpu_vm_sdma_funcs; + } dma_fence_put(vm->last_update); vm->last_update = NULL; vm->is_compute_context = true; |