Skip to contentSkip to conversation

drm/amd/pm: hide pp_table sysfs on APUs

PATCH In review Yang Wang 3 participants 3 messages Jul 29

Subsystems (3)
lore
Share & tools
lore

Yang Wang

author
#0 lore raw

PATCH 1/1 drm/amd/pm: hide pp_table sysfs on APUs

APUs use firmware-owned DPM tables and do not support replacement through pp_table. Generic callbacks can nevertheless expose the sysfs file and accept an upload before resetting the power management stack.

Treat pp_table as unsupported on APUs. Use the same platform check in the get and set paths to hide the file and reject uploads.

Fixes 289921b03fe5 ("drm/amd/powerplay: implement sysfs of pp_table for smu11 (v2)")
---
 drivers/gpu/drm/amd/pm/amdgpu_dpm.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_dpm.c +11 -2
index 8f59ea12fe0e..c3688b3b12cc 100644
@@ -1183,6 +1183,13 @@ int amdgpu_dpm_dispatch_task(struct amdgpu_device *adev,
 	return ret;
 }
 
+static bool amdgpu_dpm_is_pp_table_allowed(struct amdgpu_device *adev)
+{
+	return !amdgpu_sriov_vf(adev) &&
+	       !(adev->flags & AMD_IS_APU) &&
+	       !adev->scpm_enabled;
+}
+
 int amdgpu_dpm_get_pp_table(struct amdgpu_device *adev, char *table,
 			    size_t size)
 {
@@ -1193,7 +1200,8 @@ int amdgpu_dpm_get_pp_table(struct amdgpu_device *adev, char *table,
 	if ((!table && size) || (table && !size))
 		return -EINVAL;
 
-	if (amdgpu_sriov_vf(adev) || !pp_funcs->get_pp_table || adev->scpm_enabled)
+	if (!amdgpu_dpm_is_pp_table_allowed(adev) ||
+	    !pp_funcs->get_pp_table)
 		return -EOPNOTSUPP;
 
 	mutex_lock(&adev->pm.mutex);
@@ -1717,7 +1725,8 @@ int amdgpu_dpm_set_pp_table(struct amdgpu_device *adev,
 	if (!buf || !size)
 		return -EINVAL;
 
-	if (amdgpu_sriov_vf(adev) || !pp_funcs->set_pp_table || adev->scpm_enabled)
+	if (!amdgpu_dpm_is_pp_table_allowed(adev) ||
+	    !pp_funcs->set_pp_table)
 		return -EOPNOTSUPP;
 
 	mutex_lock(&adev->pm.mutex);
Signature · 1 line
2.54.0
Reviewed-by on v1 1/1
#1 lore raw

AMD General

Thanks & Regards
Asad

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Yang Wang
Sent: Wednesday, July 29, 2026 2:01 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Feng, Kenneth <[email protected]>
Subject: [PATCH] drm/amd/pm: hide pp_table sysfs on APUs

APUs use firmware-owned DPM tables and do not support replacement through pp_table. Generic callbacks can nevertheless expose the sysfs file and accept an upload before resetting the power management stack.

Treat pp_table as unsupported on APUs. Use the same platform check in the get and set paths to hide the file and reject uploads.

Fixes 289921b03fe5 ("drm/amd/powerplay: implement sysfs of pp_table for smu11 (v2)")
---
 drivers/gpu/drm/amd/pm/amdgpu_dpm.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_dpm.c +11 -2
index 8f59ea12fe0e..c3688b3b12cc 100644
@@ -1183,6 +1183,13 @@ int amdgpu_dpm_dispatch_task(struct amdgpu_device *adev,
        return ret;
 }
 
+static bool amdgpu_dpm_is_pp_table_allowed(struct amdgpu_device *adev)
+{
+       return !amdgpu_sriov_vf(adev) &&
+              !(adev->flags & AMD_IS_APU) &&
+              !adev->scpm_enabled;
+}
+
 int amdgpu_dpm_get_pp_table(struct amdgpu_device *adev, char *table,
                            size_t size)
 {
@@ -1193,7 +1200,8 @@ int amdgpu_dpm_get_pp_table(struct amdgpu_device *adev, char *table,
        if ((!table && size) || (table && !size))
                return -EINVAL;
 
-       if (amdgpu_sriov_vf(adev) || !pp_funcs->get_pp_table || adev->scpm_enabled)
+       if (!amdgpu_dpm_is_pp_table_allowed(adev) ||
+           !pp_funcs->get_pp_table)
                return -EOPNOTSUPP;
 
        mutex_lock(&adev->pm.mutex);
@@ -1717,7 +1725,8 @@ int amdgpu_dpm_set_pp_table(struct amdgpu_device *adev,
        if (!buf || !size)
                return -EINVAL;
 
-       if (amdgpu_sriov_vf(adev) || !pp_funcs->set_pp_table || adev->scpm_enabled)
+       if (!amdgpu_dpm_is_pp_table_allowed(adev) ||
+           !pp_funcs->set_pp_table)
                return -EOPNOTSUPP;
 
        mutex_lock(&adev->pm.mutex);

--
2.54.0

maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Yang Wang

AMD General

-----Original Message-----
From: Wang, Yang(Kevin) <[email protected]>
Sent: Wednesday, July 29, 2026 4:31 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Feng, Kenneth <[email protected]>
Subject: [PATCH] drm/amd/pm: hide pp_table sysfs on APUs

APUs use firmware-owned DPM tables and do not support replacement through pp_table. Generic callbacks can nevertheless expose the sysfs file and accept an upload before resetting the power management stack.

Treat pp_table as unsupported on APUs. Use the same platform check in the get and set paths to hide the file and reject uploads.

Fixes 289921b03fe5 ("drm/amd/powerplay: implement sysfs of pp_table for smu11 (v2)")
---
 drivers/gpu/drm/amd/pm/amdgpu_dpm.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_dpm.c +11 -2
index 8f59ea12fe0e..c3688b3b12cc 100644
@@ -1183,6 +1183,13 @@ int amdgpu_dpm_dispatch_task(struct amdgpu_device *adev,
        return ret;
 }
 
+static bool amdgpu_dpm_is_pp_table_allowed(struct amdgpu_device *adev)
+{
+       return !amdgpu_sriov_vf(adev) &&
+              !(adev->flags & AMD_IS_APU) &&
+              !adev->scpm_enabled;
+}
+
 int amdgpu_dpm_get_pp_table(struct amdgpu_device *adev, char *table,
                            size_t size)
 {
@@ -1193,7 +1200,8 @@ int amdgpu_dpm_get_pp_table(struct amdgpu_device *adev, char *table,
        if ((!table && size) || (table && !size))
                return -EINVAL;
 
-       if (amdgpu_sriov_vf(adev) || !pp_funcs->get_pp_table || adev->scpm_enabled)
+       if (!amdgpu_dpm_is_pp_table_allowed(adev) ||
+           !pp_funcs->get_pp_table)
                return -EOPNOTSUPP;
 
        mutex_lock(&adev->pm.mutex);
@@ -1717,7 +1725,8 @@ int amdgpu_dpm_set_pp_table(struct amdgpu_device *adev,
        if (!buf || !size)
                return -EINVAL;
 
-       if (amdgpu_sriov_vf(adev) || !pp_funcs->set_pp_table || adev->scpm_enabled)
+       if (!amdgpu_dpm_is_pp_table_allowed(adev) ||
+           !pp_funcs->set_pp_table)
                return -EOPNOTSUPP;
 
        mutex_lock(&adev->pm.mutex);

--
2.54.0