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

For now use the same logic as the existing one, but it's not 100%
correct since:
1) most operations don't need the GPUs
2) some operations that need it are actually deferred

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

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
index 4e4814caf61a..5d2802009cd9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
@@ -929,6 +929,12 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,
                abo = NULL;
        }
 
+       PM_RUNTIME_ACQUIRE_IF_ENABLED_AUTOSUSPEND(dev->dev, lock);
+
+       r = PM_RUNTIME_ACQUIRE_ERR(&lock);
+       if (r)
+               goto error_put_gobj;
+
        /* Add input syncobj fences (if any) for synchronization. */
        r = amdgpu_gem_add_input_fence(filp,
                                       args->input_fence_syncobj_handles,
-- 
2.55.0

Reply via email to