Skip to contentSkip to conversation

drm/amd/pm: adjust the visibility of pp_table sysfs node

PATCH Superseded Yang Wang 2 participants 5 messages Oct 30, 2025 – Nov 20, 2025

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Yang Wang

author
#0 lore raw

PATCH 1/1 drm/amd/pm: adjust the visibility of pp_table sysfs node

- make pp_table invisible on VF mode (only valid on BM)
- make pp_table invisible on Mi* chips (Not supported)
- make pp_table invisible if scpm feature is enabled.

---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +16 -1
index c83d69994380..3a14e0ff38ae 100644
@@ -2507,7 +2507,7 @@ static struct amdgpu_device_attr amdgpu_device_attrs[] = {
 	AMDGPU_DEVICE_ATTR_RO(pp_num_states,				ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
 	AMDGPU_DEVICE_ATTR_RO(pp_cur_state,				ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
 	AMDGPU_DEVICE_ATTR_RW(pp_force_state,				ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
-	AMDGPU_DEVICE_ATTR_RW(pp_table,					ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
+	AMDGPU_DEVICE_ATTR_RW(pp_table,					ATTR_FLAG_BASIC),
 	AMDGPU_DEVICE_ATTR_RW(pp_dpm_sclk,				ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF,
 			      .attr_update = pp_dpm_clk_default_attr_update),
 	AMDGPU_DEVICE_ATTR_RW(pp_dpm_mclk,				ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF,
@@ -2639,6 +2639,21 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
 		if (amdgpu_dpm_get_apu_thermal_limit(adev, &limit) ==
 		    -EOPNOTSUPP)
 			*states = ATTR_STATE_UNSUPPORTED;
+	} else if (DEVICE_ATTR_IS(pp_table)) {
+		switch (gc_ver) {
+		case IP_VERSION(9, 4, 3):
+		case IP_VERSION(9, 4, 4):
+		case IP_VERSION(9, 5, 0):
+			/* No PPTable support on Mi* chips */
+			*states = ATTR_STATE_UNSUPPORTED;
+			break;
+		default:
+			if (adev->scpm_enabled)
+				*states = ATTR_STATE_UNSUPPORTED;
+			else
+				*states = ATTR_STATE_SUPPORTED;
+			break;
+		}
 	}
 
 	switch (gc_ver) {
Signature · 1 line
2.34.1
#1 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

Ping...

Best Regards,
Kevin

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Yang Wang
Sent: Thursday, October 30, 2025 09:17
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>
Subject: [PATCH] drm/amd/pm: adjust the visibility of pp_table sysfs node

- make pp_table invisible on VF mode (only valid on BM)
- make pp_table invisible on Mi* chips (Not supported)
- make pp_table invisible if scpm feature is enabled.

---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +16 -1
index c83d69994380..3a14e0ff38ae 100644
@@ -2507,7 +2507,7 @@ static struct amdgpu_device_attr amdgpu_device_attrs[] = {
        AMDGPU_DEVICE_ATTR_RO(pp_num_states,                            ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
        AMDGPU_DEVICE_ATTR_RO(pp_cur_state,                             ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
        AMDGPU_DEVICE_ATTR_RW(pp_force_state,                           ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
-       AMDGPU_DEVICE_ATTR_RW(pp_table,                                 ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
+       AMDGPU_DEVICE_ATTR_RW(pp_table,                                 ATTR_FLAG_BASIC),
        AMDGPU_DEVICE_ATTR_RW(pp_dpm_sclk,                              ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF,
                              .attr_update = pp_dpm_clk_default_attr_update),
        AMDGPU_DEVICE_ATTR_RW(pp_dpm_mclk,                              ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF,
@@ -2639,6 +2639,21 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
                if (amdgpu_dpm_get_apu_thermal_limit(adev, &limit) ==
                    -EOPNOTSUPP)
                        *states = ATTR_STATE_UNSUPPORTED;
+       } else if (DEVICE_ATTR_IS(pp_table)) {
+               switch (gc_ver) {
+               case IP_VERSION(9, 4, 3):
+               case IP_VERSION(9, 4, 4):
+               case IP_VERSION(9, 5, 0):
+                       /* No PPTable support on Mi* chips */
+                       *states = ATTR_STATE_UNSUPPORTED;
+                       break;
+               default:
+                       if (adev->scpm_enabled)
+                               *states = ATTR_STATE_UNSUPPORTED;
+                       else
+                               *states = ATTR_STATE_SUPPORTED;
+                       break;
+               }
        }
 
        switch (gc_ver) {

--
2.34.1

#2 lore raw
Quoted 45 lines · Yang(Kevin)

[AMD Official Use Only - AMD Internal Distribution Only]

Ping...

Best Regards,
Kevin

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Yang Wang
Sent: Thursday, October 30, 2025 09:17
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>
Subject: [PATCH] drm/amd/pm: adjust the visibility of pp_table sysfs node

- make pp_table invisible on VF mode (only valid on BM)
- make pp_table invisible on Mi* chips (Not supported)
- make pp_table invisible if scpm feature is enabled.

---
  drivers/gpu/drm/amd/pm/amdgpu_pm.c | 17 ++++++++++++++++-
  1 file changed, 16 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +6 -1
index c83d69994380..3a14e0ff38ae 100644
@@ -2507,7 +2507,7 @@ static struct amdgpu_device_attr amdgpu_device_attrs[] = {
         AMDGPU_DEVICE_ATTR_RO(pp_num_states,                            ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
         AMDGPU_DEVICE_ATTR_RO(pp_cur_state,                             ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
         AMDGPU_DEVICE_ATTR_RW(pp_force_state,                           ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
-       AMDGPU_DEVICE_ATTR_RW(pp_table,                                 ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
+       AMDGPU_DEVICE_ATTR_RW(pp_table,                                 ATTR_FLAG_BASIC),
         AMDGPU_DEVICE_ATTR_RW(pp_dpm_sclk,                              ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF,
                               .attr_update = pp_dpm_clk_default_attr_update),
         AMDGPU_DEVICE_ATTR_RW(pp_dpm_mclk,                              ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF,
@@ -2639,6 +2639,21 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
                 if (amdgpu_dpm_get_apu_thermal_limit(adev, &limit) ==
                     -EOPNOTSUPP)
                         *states = ATTR_STATE_UNSUPPORTED;
+       } else if (DEVICE_ATTR_IS(pp_table)) {
+               switch (gc_ver) {
+               case IP_VERSION(9, 4, 3):
+               case IP_VERSION(9, 4, 4):
+               case IP_VERSION(9, 5, 0):

drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_ · line 2656

Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +10 -0
+                       /* No PPTable support on Mi* chips */
+                       *states = ATTR_STATE_UNSUPPORTED;
+                       break;
+               default:
+                       if (adev->scpm_enabled)
+                               *states = ATTR_STATE_UNSUPPORTED;
+                       else
+                               *states = ATTR_STATE_SUPPORTED;
+                       break;
+               }

What about using a dummy check with amdgpu_dpm_get_pp_table(adev, NULL)?

Thanks,
Lijo

Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0 -1
         }
 
         switch (gc_ver) {
--

2.34.1

#3 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Thursday, November 20, 2025 15:41
To: Wang, Yang(Kevin) <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] drm/amd/pm: adjust the visibility of pp_table sysfs node

Quoted 45 lines · Yang(Kevin)

[AMD Official Use Only - AMD Internal Distribution Only]

Ping...

Best Regards,
Kevin

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Yang Wang
Sent: Thursday, October 30, 2025 09:17
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>
Subject: [PATCH] drm/amd/pm: adjust the visibility of pp_table sysfs node

- make pp_table invisible on VF mode (only valid on BM)
- make pp_table invisible on Mi* chips (Not supported)
- make pp_table invisible if scpm feature is enabled.

---
  drivers/gpu/drm/amd/pm/amdgpu_pm.c | 17 ++++++++++++++++-
  1 file changed, 16 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +6 -1
index c83d69994380..3a14e0ff38ae 100644
@@ -2507,7 +2507,7 @@ static struct amdgpu_device_attr amdgpu_device_attrs[] = {
         AMDGPU_DEVICE_ATTR_RO(pp_num_states,                            ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
         AMDGPU_DEVICE_ATTR_RO(pp_cur_state,                             ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
         AMDGPU_DEVICE_ATTR_RW(pp_force_state,                           ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
-       AMDGPU_DEVICE_ATTR_RW(pp_table,                                 ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
+       AMDGPU_DEVICE_ATTR_RW(pp_table,                                 ATTR_FLAG_BASIC),
         AMDGPU_DEVICE_ATTR_RW(pp_dpm_sclk,                              ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF,
                               .attr_update = pp_dpm_clk_default_attr_update),
         AMDGPU_DEVICE_ATTR_RW(pp_dpm_mclk,                              ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF,
@@ -2639,6 +2639,21 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
                 if (amdgpu_dpm_get_apu_thermal_limit(adev, &limit) ==
                     -EOPNOTSUPP)
                         *states = ATTR_STATE_UNSUPPORTED;
+       } else if (DEVICE_ATTR_IS(pp_table)) {
+               switch (gc_ver) {
+               case IP_VERSION(9, 4, 3):
+               case IP_VERSION(9, 4, 4):
+               case IP_VERSION(9, 5, 0):

drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_ · line 2656

Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +10 -0
+                       /* No PPTable support on Mi* chips */
+                       *states = ATTR_STATE_UNSUPPORTED;
+                       break;
+               default:
+                       if (adev->scpm_enabled)
+                               *states = ATTR_STATE_UNSUPPORTED;
+                       else
+                               *states = ATTR_STATE_SUPPORTED;
+                       break;
+               }

What about using a dummy check with amdgpu_dpm_get_pp_table(adev, NULL)?

Thanks,
Lijo

[kevin]:

The linux amdgpu sysfs node provides both get and set capabilities. Therefore, relying solely on the get function for speculative analysis may not be sufficiently rigorous. Additionally, modifications must be implemented concurrently for the backends of both Powerplay and SWSMU.
this is purely a software logic-related adjustment and does not require low-level operations.

Best Regards,
Kevin

Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0 -1
         }
 
         switch (gc_ver) {
--

2.34.1

#4 lore raw
Quoted 70 lines · Yang(Kevin)

[AMD Official Use Only - AMD Internal Distribution Only]

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Thursday, November 20, 2025 15:41
To: Wang, Yang(Kevin) <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] drm/amd/pm: adjust the visibility of pp_table sysfs node

Quoted 45 lines · Yang(Kevin)

[AMD Official Use Only - AMD Internal Distribution Only]

Ping...

Best Regards,
Kevin

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Yang Wang
Sent: Thursday, October 30, 2025 09:17
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>
Subject: [PATCH] drm/amd/pm: adjust the visibility of pp_table sysfs node

- make pp_table invisible on VF mode (only valid on BM)
- make pp_table invisible on Mi* chips (Not supported)
- make pp_table invisible if scpm feature is enabled.

---
   drivers/gpu/drm/amd/pm/amdgpu_pm.c | 17 ++++++++++++++++-
   1 file changed, 16 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +6 -1
index c83d69994380..3a14e0ff38ae 100644
@@ -2507,7 +2507,7 @@ static struct amdgpu_device_attr amdgpu_device_attrs[] = {
          AMDGPU_DEVICE_ATTR_RO(pp_num_states,                            ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
          AMDGPU_DEVICE_ATTR_RO(pp_cur_state,                             ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
          AMDGPU_DEVICE_ATTR_RW(pp_force_state,                           ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
-       AMDGPU_DEVICE_ATTR_RW(pp_table,                                 ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
+       AMDGPU_DEVICE_ATTR_RW(pp_table,                                 ATTR_FLAG_BASIC),
          AMDGPU_DEVICE_ATTR_RW(pp_dpm_sclk,                              ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF,
                                .attr_update = pp_dpm_clk_default_attr_update),
          AMDGPU_DEVICE_ATTR_RW(pp_dpm_mclk,                              ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF,
@@ -2639,6 +2639,21 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
                  if (amdgpu_dpm_get_apu_thermal_limit(adev, &limit) ==
                      -EOPNOTSUPP)
                          *states = ATTR_STATE_UNSUPPORTED;
+       } else if (DEVICE_ATTR_IS(pp_table)) {
+               switch (gc_ver) {
+               case IP_VERSION(9, 4, 3):
+               case IP_VERSION(9, 4, 4):
+               case IP_VERSION(9, 5, 0):

drivers/gpu/drm/amd/pm/amdgpu_pm.c static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_ · line 2656

Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +10 -0
+                       /* No PPTable support on Mi* chips */
+                       *states = ATTR_STATE_UNSUPPORTED;
+                       break;
+               default:
+                       if (adev->scpm_enabled)
+                               *states = ATTR_STATE_UNSUPPORTED;
+                       else
+                               *states = ATTR_STATE_SUPPORTED;
+                       break;
+               }

What about using a dummy check with amdgpu_dpm_get_pp_table(adev, NULL)?

Quoted 9 lines

Thanks,
Lijo

[kevin]:

The linux amdgpu sysfs node provides both get and set capabilities. Therefore, relying solely on the get function for speculative analysis may not be sufficiently rigorous. Additionally, modifications must be implemented concurrently for the backends of both Powerplay and SWSMU.
this is purely a software logic-related adjustment and does not require low-level operations.

This has nothing to do with sysfs. It's all about querying whether pptable is supported or not. If it can be done with the least maintenance that is better, otherwise need to keep adding checks with each IP version.

Thanks,
Lijo

Quoted 10 lines

Best Regards,
Kevin

Quoted 6 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0 -1
          }
 
          switch (gc_ver) {
--

2.34.1