If the dGPU is off, then reading the sysfs files with a sensor monitoring
application will wake it. Change the behavior to return an error when the
dGPU is in runtime PM.  Leave the behavior the same for debugfs files.

Signed-off-by: Mario Limonciello <mario.limoncie...@amd.com>
---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c 
b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
index bbd6f3e617358..cca08eea0e26a 100644
--- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
@@ -101,14 +101,18 @@ static bool amdgpu_sysfs_attr_accessible(struct 
amdgpu_device *adev)
 {
        if (amdgpu_in_reset(adev))
                return false;
-       if (adev->in_suspend && !adev->in_runpm)
+       if (adev->in_suspend || adev->in_runpm)
                return false;
        return true;
 }
 
 static bool amdgpu_debugfs_attr_accessible(struct amdgpu_device *adev)
 {
-       return amdgpu_sysfs_attr_accessible(adev);
+       if (amdgpu_in_reset(adev))
+               return false;
+       if (adev->in_suspend && !adev->in_runpm)
+               return false;
+       return true;
 }
 
 /**
-- 
2.43.0

Reply via email to