[PATCH 2/2] drm/amdgpu: Use last_unlocked fence for unlocked update

Philip Yang Philip.Yang at amd.com
Sat Mar 26 00:56:41 UTC 2022


MMU callback update page table set unlocked flag, add callback tlb_cb to
vm->last_unlocked fence, and pass it back to upper layer to wait for
page table update done.

Signed-off-by: Philip Yang <Philip.Yang at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 48f326609976..aac1b625194f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -927,7 +927,10 @@ int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
 
 	r = vm->update_funcs->commit(&params, fence);
 
-	if (!unlocked && (!(flags & AMDGPU_PTE_VALID) || params.table_freed)) {
+	if (!(flags & AMDGPU_PTE_VALID) || params.table_freed) {
+		if (unlocked && fence)
+			*fence = dma_fence_get(vm->last_unlocked);
+
 		tlb_cb->vm = vm;
 		if (!fence || !*fence ||
 		    dma_fence_add_callback(*fence, &tlb_cb->cb,
-- 
2.35.1



More information about the amd-gfx mailing list