From 3adaca97f58aabe554bb87a2a99307d41871caed Mon Sep 17 00:00:00 2001 From: jsg Date: Thu, 2 Feb 2023 03:56:28 +0000 Subject: [PATCH] drm/amdkfd: Add sync after creating vram bo From Eric Huang 92af2d3b57a1afdfdcafb1c6a07ffd89cf3e98fb in linux-6.1.y/6.1.9 ba029e9991d9be90a28b6a0ceb25e9a6fb348829 in mainline linux --- sys/dev/pci/drm/amd/amdkfd/kfd_svm.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/dev/pci/drm/amd/amdkfd/kfd_svm.c b/sys/dev/pci/drm/amd/amdkfd/kfd_svm.c index 64fdf63093a..63feea08904 100644 --- a/sys/dev/pci/drm/amd/amdkfd/kfd_svm.c +++ b/sys/dev/pci/drm/amd/amdkfd/kfd_svm.c @@ -570,6 +570,15 @@ svm_range_vram_node_new(struct amdgpu_device *adev, struct svm_range *prange, goto reserve_bo_failed; } + if (clear) { + r = amdgpu_bo_sync_wait(bo, AMDGPU_FENCE_OWNER_KFD, false); + if (r) { + pr_debug("failed %d to sync bo\n", r); + amdgpu_bo_unreserve(bo); + goto reserve_bo_failed; + } + } + r = dma_resv_reserve_fences(bo->tbo.base.resv, 1); if (r) { pr_debug("failed %d to reserve bo\n", r); -- 2.20.1