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

Submitting a cs ioctl will now wake up the GPU. The guard will
automatically drop the rpm ref when the cs ioctl goes out of scope.

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_cs.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index 87ccef153073..e2a715c04208 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -29,6 +29,7 @@
 #include <linux/pagemap.h>
 #include <linux/sync_file.h>
 #include <linux/dma-buf.h>
+#include <linux/pm_runtime.h>
 
 #include <drm/amdgpu_drm.h>
 #include <drm/drm_syncobj.h>
@@ -1445,6 +1446,12 @@ int amdgpu_cs_ioctl(struct drm_device *dev, void *data, 
struct drm_file *filp)
        if (!adev->accel_working)
                return -EBUSY;
 
+       PM_RUNTIME_ACQUIRE_IF_ENABLED_AUTOSUSPEND(dev->dev, lock);
+
+       r = PM_RUNTIME_ACQUIRE_ERR(&lock);
+       if (r)
+               return r;
+
        r = amdgpu_cs_parser_init(&parser, adev, filp, data);
        if (r) {
                drm_err_ratelimited(dev, "Failed to initialize parser %d!\n", 
r);
-- 
2.55.0

Reply via email to