[Public]

let me send another patch to unified error code to -EBUSY to distinguish the 
return value of runpm -EPERM.

Best Regards,
Kevin
-----Original Message-----
From: Lazar, Lijo <lijo.la...@amd.com>
Sent: Wednesday, September 3, 2025 3:08 PM
To: Wang, Yang(Kevin) <kevinyang.w...@amd.com>; amd-gfx@lists.freedesktop.org
Cc: Deucher, Alexander <alexander.deuc...@amd.com>; Zhang, Hawking 
<hawking.zh...@amd.com>
Subject: RE: [PATCH] drm/amd/pm: refine amdgpu pm sysfs node error code

[Public]

I don't think it requires two separate error codes. The error scenario is 
device cannot be accessed at this point of time (that's regardless of suspend 
or while device is undergoing reset).

Thanks,
Lijo
-----Original Message-----
From: Wang, Yang(Kevin) <kevinyang.w...@amd.com>
Sent: Wednesday, September 3, 2025 12:05 PM
To: amd-gfx@lists.freedesktop.org
Cc: Deucher, Alexander <alexander.deuc...@amd.com>; Zhang, Hawking 
<hawking.zh...@amd.com>; Lazar, Lijo <lijo.la...@amd.com>
Subject: [PATCH] drm/amd/pm: refine amdgpu pm sysfs node error code

Returns different error codes based on the scenario to help the user app 
understand the AMDGPU device status when an exception occurs.

Signed-off-by: Yang Wang <kevinyang.w...@amd.com>
---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c 
b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
index 0906bff864cb..6b1de23c26e3 100644
--- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
@@ -110,9 +110,10 @@ static int amdgpu_pm_dev_state_check(struct amdgpu_device 
*adev, bool runpm)
        bool runpm_check = runpm ? adev->in_runpm : false;

        if (amdgpu_in_reset(adev))
-               return -EPERM;
+               return -EBUSY;
+
        if (adev->in_suspend && !runpm_check)
-               return -EPERM;
+               return -ENODEV;

        return 0;
 }
--
2.34.1


Reply via email to