It requires validating the userq VA whether is mapped before
trying to resume the queue.

Signed-off-by: Prike Liang <prike.li...@amd.com>
Reviewed-by: Christian König <christian.koe...@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
index 3f8343599deb..771f57d09060 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
@@ -816,11 +816,18 @@ static int
 amdgpu_userq_restore_all(struct amdgpu_userq_mgr *uq_mgr)
 {
        struct amdgpu_usermode_queue *queue;
+       struct amdgpu_fpriv *fpriv = uq_mgr_to_fpriv(uq_mgr);
        int queue_id;
        int ret = 0, r;
 
        /* Resume all the queues for this process */
        idr_for_each_entry(&uq_mgr->userq_idr, queue, queue_id) {
+
+               if (!amdgpu_userq_buffer_vas_mapped(&fpriv->vm, queue)) {
+                       drm_file_err(uq_mgr->file, "trying restore queue 
without va mappping\n");
+                       continue;
+               }
+
                r = amdgpu_userq_map_helper(uq_mgr, queue);
                if (r)
                        ret = r;
-- 
2.34.1

Reply via email to