Skip to contentSkip to conversation

drm/amd/pm: refine amdgpu pm sysfs node error code

PATCH Superseded Yang Wang 2 participants 3 messages Sep 3, 2025

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Yang Wang

author
#0 lore raw

PATCH 1/1 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.

---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3 -2
index 0906bff864cb..6b1de23c26e3 100644
@@ -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;
 }
Signature · 1 line
2.34.1
#1 lore raw

[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) <[email protected]>
Sent: Wednesday, September 3, 2025 12:05 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Lazar, Lijo <[email protected]>
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.

---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3 -2
index 0906bff864cb..6b1de23c26e3 100644
@@ -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

#2 lore raw

[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 <[email protected]>
Sent: Wednesday, September 3, 2025 3:08 PM
To: Wang, Yang(Kevin) <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>
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) <[email protected]>
Sent: Wednesday, September 3, 2025 12:05 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Lazar, Lijo <[email protected]>
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.

---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +3 -2
index 0906bff864cb..6b1de23c26e3 100644
@@ -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