Queue scratch/runtime error records into the WAIT_EVENT path.

The INVALID_VA queue state is set when user queue restore finds that
required VA mappings are no longer present. Reuse this point to emit
a WAIT_EVENT scratch record.

The queue doorbell index is used as the queue identifier.

Cc: Alex Deucher <[email protected]>
Cc: Christian König <[email protected]>
Signed-off-by: Srinivasan Shanmugam <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
index 1fe025785300..0f70728f3166 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
@@ -1024,9 +1024,9 @@ amdgpu_userq_restore_all(struct amdgpu_userq_mgr *uq_mgr)
        unsigned long queue_id;
        int ret = 0, r;
 
-
-       if (amdgpu_bo_reserve(vm->root.bo, false))
-               return false;
+       r = amdgpu_bo_reserve(vm->root.bo, false);
+       if (r)
+               return r;
 
        mutex_lock(&uq_mgr->userq_mutex);
        /* Resume all the queues for this process */
@@ -1044,6 +1044,16 @@ amdgpu_userq_restore_all(struct amdgpu_userq_mgr *uq_mgr)
                                        DRM_AMDGPU_EVENT_TYPE_SCRATCH,
                                        queue->doorbell_index);
 
+                       if (queue->userq_mgr &&
+                           queue->userq_mgr->wait_event_mgr)
+                               amdgpu_wait_event_push_scratch(
+                                       queue->userq_mgr->wait_event_mgr,
+                                       queue->doorbell_index,
+                                       0, /* error_code */
+                                       0, /* requested_bytes */
+                                       0  /* available_bytes */
+                               );
+
                        continue;
                }
 
-- 
2.34.1

Reply via email to