From: Pierre-Eric Pelloux-Prayer <[email protected]>

Wake up the GPU while setting up user pages and validating the buffer.

Signed-off-by: Pierre-Eric Pelloux-Prayer <[email protected]>
v2 (Shahyan): Added commit description
Signed-off-by: Shahyan Soltani <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
index 6edd03647c2d..e54d30f75b2e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
@@ -594,11 +594,18 @@ int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void 
*data,
                if (r)
                        goto user_pages_done;
 
+               r = pm_runtime_resume_and_get(adev->dev);
+               if (r < 0)
+                       goto user_pages_done;
+
                amdgpu_ttm_tt_set_user_pages(bo->tbo.ttm, range);
 
                amdgpu_bo_placement_from_domain(bo, AMDGPU_GEM_DOMAIN_GTT);
                r = ttm_bo_validate(&bo->tbo, &bo->placement, &ctx);
                amdgpu_bo_unreserve(bo);
+
+               pm_runtime_put_autosuspend(adev->dev);
+
                if (r)
                        goto user_pages_done;
        }
-- 
2.55.0

Reply via email to