When a privilege fault occurs in a user queue context, the GPU may be left in a 
hang state.
To handle this gracefully and recover the GPU, schedule a user queue reset via 
amdgpu_reset_domain_schedule.

Signed-off-by: Jesse Zhang <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
index 6cd16f016c37..4162d30947ed 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
@@ -46,6 +46,7 @@
 #include "mes_v12_0.h"
 #include "mes_userqueue.h"
 #include "amdgpu_userq_fence.h"
+#include "amdgpu_reset.h"
 
 #define GFX12_NUM_GFX_RINGS    1
 #define GFX12_MEC_HPD_SIZE     2048
@@ -5030,6 +5031,10 @@ static void gfx_v12_0_handle_priv_fault(struct 
amdgpu_device *adev,
                        BUG();
                        break;
                }
+       } else  {
+               /*TODO: schedule a user queue reset work */
+               amdgpu_reset_domain_schedule(adev->reset_domain,
+                                               &adev->userq_reset_work);
        }
 }
 
-- 
2.49.0

Reply via email to