Don't wake the GPU if the SYNCOBJ_CREATE/DESTROY/WAIT ioctls are used
to detect syncobj features before the GPU is powered up.

Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/2295
Signed-off-by: Philipp Zabel <philipp.za...@gmail.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 79d31ac6a7b37..b12342e917193 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -2981,6 +2981,14 @@ long amdgpu_drm_ioctl(struct file *filp,
                }
        }
 
+       if (wake && unlikely(!fpriv->initialized)) {
+               /* Allow syncobj feature detection before GPU wakeup */
+               if (cmd == DRM_IOCTL_SYNCOBJ_CREATE ||
+                   cmd == DRM_IOCTL_SYNCOBJ_DESTROY ||
+                   cmd == DRM_IOCTL_SYNCOBJ_WAIT)
+                       wake = false;
+       }
+
        dev = file_priv->minor->dev;
        if (wake) {
                ret = pm_runtime_get_sync(dev->dev);

-- 
2.50.1

Reply via email to