[PATCH] amd/amdgpu: force to trigger a no-retry-fault after a retry-fault

Alex Sierra alex.sierra at amd.com
Fri Nov 15 17:43:14 UTC 2019


After a retry-fault happens, the fault handler will modify the UTCL2 to
set PTE bits to force a no-retry-fault. This will cause the wave to
enter the trap handler.

Change-Id: I177102891f715068f15605957ff23b0cab862603
Signed-off-by: Alex Sierra <alex.sierra at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 3c0bd6472a46..e4d1a8fc97d5 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -3167,7 +3167,8 @@ bool amdgpu_vm_handle_fault(struct amdgpu_device *adev, unsigned int pasid,
 			    uint64_t addr)
 {
 	struct amdgpu_bo *root;
-	uint64_t value, flags;
+	uint64_t value = 0;
+	uint64_t flags;
 	struct amdgpu_vm *vm;
 	long r;
 
@@ -3200,13 +3201,9 @@ bool amdgpu_vm_handle_fault(struct amdgpu_device *adev, unsigned int pasid,
 		AMDGPU_PTE_SYSTEM;
 
 	if (amdgpu_vm_fault_stop == AMDGPU_VM_FAULT_STOP_NEVER) {
-		/* Redirect the access to the dummy page */
-		value = adev->dummy_page_addr;
-		flags |= AMDGPU_PTE_EXECUTABLE | AMDGPU_PTE_READABLE |
-			AMDGPU_PTE_WRITEABLE;
-	} else {
-		/* Let the hw retry silently on the PTE */
-		value = 0;
+		/* Setting PTE flags to trigger a no-retry-fault  */
+		flags = AMDGPU_PTE_EXECUTABLE | AMDGPU_PDE_PTE |
+			AMDGPU_PTE_TF;
 	}
 
 	r = amdgpu_vm_bo_update_mapping(adev, vm, true, NULL, addr, addr + 1,
-- 
2.17.1



More information about the amd-gfx mailing list