Skip to contentSkip to conversation

amdgpu/pm: Don't show `smartshift_*_power` files for APUs

PATCH In review Mario Limonciello 3 participants 5 messages Mar 9, 2022 – Mar 11, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 amdgpu/pm: Don't show `smartshift_*_power` files for APUs

smartshift_*_power files are showing up on some OEM programs on the APU instead of the dGPU.

Adjust the logic to the function ss_power_attr_update to detect whether or not the attributes should be exported.

The existing checks that are dropped are already included in amdgpu_device_support_smart_shift, so this can be simplified. This causes attributes to not be shown on APUs.

---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1 -4
index cbbbd4079249..ccd0648c6789 100644
@@ -1884,10 +1884,7 @@ static int ss_power_attr_update(struct amdgpu_device *adev, struct amdgpu_device
 {
 	uint32_t ss_power, size;
 
-	if (!amdgpu_acpi_is_power_shift_control_supported())
-		*states = ATTR_STATE_UNSUPPORTED;
-	else if ((adev->flags & AMD_IS_PX) &&
-		 !amdgpu_device_supports_smart_shift(adev_to_drm(adev)))
+	if (!amdgpu_device_supports_smart_shift(adev_to_drm(adev)))
 		*states = ATTR_STATE_UNSUPPORTED;
 	else if (amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_SS_APU_SHARE,
 		 (void *)&ss_power, &size))
Signature · 1 line
2.34.1
#1 lore raw
Quoted 20 lines · Mario Limonciello

smartshift_*_power files are showing up on some OEM programs on the APU instead of the dGPU.

Adjust the logic to the function ss_power_attr_update to detect whether or not the attributes should be exported.

The existing checks that are dropped are already included in amdgpu_device_support_smart_shift, so this can be simplified. This causes attributes to not be shown on APUs.

---
  drivers/gpu/drm/amd/pm/amdgpu_pm.c | 5 +----
  1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0 -0
index cbbbd4079249..ccd0648c6789 100644

drivers/gpu/drm/amd/pm/amdgpu_pm.c static int ss_power_attr_update(struct amdgpu_device *adev, struct amdgpu_device · line 1888

Quoted 9 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1 -4
@@ -1884,10 +1884,7 @@ static int ss_power_attr_update(struct amdgpu_device *adev, struct amdgpu_device
  {
  	uint32_t ss_power, size;
 
-	if (!amdgpu_acpi_is_power_shift_control_supported())
-		*states = ATTR_STATE_UNSUPPORTED;
-	else if ((adev->flags & AMD_IS_PX) &&
-		 !amdgpu_device_supports_smart_shift(adev_to_drm(adev)))
+	if (!amdgpu_device_supports_smart_shift(adev_to_drm(adev)))
  		*states = ATTR_STATE_UNSUPPORTED;

SS 1.0 attributes are supported on APU devices. Will this work on those?

Thanks,
Lijo

Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0 -0
  	else if (amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_SS_APU_SHARE,
  		 (void *)&ss_power, &size))
#2 lore raw

[AMD Official Use Only]

This will fail to create the sysfs attributes for SS1.0.

Regards,
Sathish

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Lazar, Lijo
Sent: Thursday, March 10, 2022 10:58 AM
To: Limonciello, Mario <[email protected]>; [email protected]
Subject: Re: [PATCH] amdgpu/pm: Don't show smartshift_*_power files for APUs

Quoted 21 lines · Mario Limonciello

smartshift_*_power files are showing up on some OEM programs on the APU instead of the dGPU.

Adjust the logic to the function ss_power_attr_update to detect whether or not the attributes should be exported.

The existing checks that are dropped are already included in amdgpu_device_support_smart_shift, so this can be simplified. This causes attributes to not be shown on APUs.

---
  drivers/gpu/drm/amd/pm/amdgpu_pm.c | 5 +----
  1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0 -0
index cbbbd4079249..ccd0648c6789 100644

drivers/gpu/drm/amd/pm/amdgpu_pm.c static int ss_power_attr_update(struct amdgpu_device *adev, struct amdgpu_device · line 1888

Quoted 9 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1 -4
@@ -1884,10 +1884,7 @@ static int ss_power_attr_update(struct amdgpu_device *adev, struct amdgpu_device
  {
  	uint32_t ss_power, size;
 
-	if (!amdgpu_acpi_is_power_shift_control_supported())
-		*states = ATTR_STATE_UNSUPPORTED;
-	else if ((adev->flags & AMD_IS_PX) &&
-		 !amdgpu_device_supports_smart_shift(adev_to_drm(adev)))
+	if (!amdgpu_device_supports_smart_shift(adev_to_drm(adev)))
  		*states = ATTR_STATE_UNSUPPORTED;

SS 1.0 attributes are supported on APU devices. Will this work on those?

Thanks,
Lijo

Quoted 3 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0 -0
  	else if (amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_SS_APU_SHARE,
  		 (void *)&ss_power, &size))
#3 lore raw

[AMD Official Use Only]

I'm not familiar with SS 1.0 in this regard, can you explain why it would fail to make the attributes? I would think the attributes should show up because of amdgpu_device_supports_smart_shift? Or are the checks done in that function not sufficient for SS 1.0?

Quoted 69 lines

-----Original Message-----
From: Sundararaju, Sathishkumar <[email protected]>
Sent: Thursday, March 10, 2022 05:19
To: Lazar, Lijo <[email protected]>; Limonciello, Mario <[email protected]>; [email protected]
Subject: RE: [PATCH] amdgpu/pm: Don't show smartshift_*_power files for APUs

[AMD Official Use Only]

This will fail to create the sysfs attributes for SS1.0.

Regards,
Sathish

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Lazar, Lijo
Sent: Thursday, March 10, 2022 10:58 AM
To: Limonciello, Mario <[email protected]>; amd- [email protected]
Subject: Re: [PATCH] amdgpu/pm: Don't show smartshift_*_power files for APUs

drivers/gpu/drm/amd/pm/amdgpu_pm.c static int ss_power_attr_update(struct

Quoted 21 lines · Mario Limonciello

smartshift_*_power files are showing up on some OEM programs on the APU instead of the dGPU.

Adjust the logic to the function ss_power_attr_update to detect whether or not the attributes should be exported.

The existing checks that are dropped are already included in amdgpu_device_support_smart_shift, so this can be simplified. This causes attributes to not be shown on APUs.

---
  drivers/gpu/drm/amd/pm/amdgpu_pm.c | 5 +----
  1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0 -0
index cbbbd4079249..ccd0648c6789 100644
@@ -1884,10 +1884,7 @@ static int ss_power_attr_update(struct

amdgpu_device *adev, struct amdgpu_device

drivers/gpu/drm/amd/pm/amdgpu_pm.c static int ss_power_attr_update(struct amdgpu_device *adev, struct amdgpu_device

Quoted 7 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0 -4
  {
  	uint32_t ss_power, size;
 
-	if (!amdgpu_acpi_is_power_shift_control_supported())
-		*states = ATTR_STATE_UNSUPPORTED;
-	else if ((adev->flags & AMD_IS_PX) &&
-

!amdgpu_device_supports_smart_shift(adev_to_drm(adev)))

drivers/gpu/drm/amd/pm/amdgpu_pm.c static int ss_power_attr_update(struct amdgpu_device *adev, struct amdgpu_device · line 1888

Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1 -0
+	if (!amdgpu_device_supports_smart_shift(adev_to_drm(adev)))
  		*states = ATTR_STATE_UNSUPPORTED;

SS 1.0 attributes are supported on APU devices. Will this work on those?

Thanks,
Lijo

drivers/gpu/drm/amd/pm/amdgpu_pm.c static int ss_power_attr_update(struct · line 1889

Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0 -0
  	else if (amdgpu_dpm_read_sensor(adev,

AMDGPU_PP_SENSOR_SS_APU_SHARE,

Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0 -0
  		 (void *)&ss_power, &size))
#4 lore raw

[AMD Official Use Only]

Hi Mario,

amdgpu_device_supports_smart_shift() is to check if the device is dGPU and platform supports smartshift.
which would fail for iGPU and so the attr_update() will return unsupported, due to this on SS1.0 platform the entries won't be created.

Regards,
Sathish

-----Original Message-----
From: Limonciello, Mario <[email protected]>
Sent: Thursday, March 10, 2022 11:45 PM
To: Sundararaju, Sathishkumar <[email protected]>; Lazar, Lijo <[email protected]>; [email protected]
Subject: RE: [PATCH] amdgpu/pm: Don't show smartshift_*_power files for APUs

[AMD Official Use Only]

I'm not familiar with SS 1.0 in this regard, can you explain why it would fail to make the attributes? I would think the attributes should show up because of amdgpu_device_supports_smart_shift? Or are the checks done in that function not sufficient for SS 1.0?

Quoted 69 lines

-----Original Message-----
From: Sundararaju, Sathishkumar <[email protected]>
Sent: Thursday, March 10, 2022 05:19
To: Lazar, Lijo <[email protected]>; Limonciello, Mario <[email protected]>; [email protected]
Subject: RE: [PATCH] amdgpu/pm: Don't show smartshift_*_power files for APUs

[AMD Official Use Only]

This will fail to create the sysfs attributes for SS1.0.

Regards,
Sathish

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Lazar, Lijo
Sent: Thursday, March 10, 2022 10:58 AM
To: Limonciello, Mario <[email protected]>; amd- [email protected]
Subject: Re: [PATCH] amdgpu/pm: Don't show smartshift_*_power files for APUs

drivers/gpu/drm/amd/pm/amdgpu_pm.c static int ss_power_attr_update(struct

Quoted 21 lines · Mario Limonciello

smartshift_*_power files are showing up on some OEM programs on the APU instead of the dGPU.

Adjust the logic to the function ss_power_attr_update to detect whether or not the attributes should be exported.

The existing checks that are dropped are already included in amdgpu_device_support_smart_shift, so this can be simplified. This causes attributes to not be shown on APUs.

---
  drivers/gpu/drm/amd/pm/amdgpu_pm.c | 5 +----
  1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0 -0
index cbbbd4079249..ccd0648c6789 100644
@@ -1884,10 +1884,7 @@ static int ss_power_attr_update(struct

amdgpu_device *adev, struct amdgpu_device

drivers/gpu/drm/amd/pm/amdgpu_pm.c static int ss_power_attr_update(struct amdgpu_device *adev, struct amdgpu_device

Quoted 7 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0 -4
  {
  	uint32_t ss_power, size;
 
-	if (!amdgpu_acpi_is_power_shift_control_supported())
-		*states = ATTR_STATE_UNSUPPORTED;
-	else if ((adev->flags & AMD_IS_PX) &&
-

!amdgpu_device_supports_smart_shift(adev_to_drm(adev)))

drivers/gpu/drm/amd/pm/amdgpu_pm.c static int ss_power_attr_update(struct amdgpu_device *adev, struct amdgpu_device · line 1888

Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1 -0
+	if (!amdgpu_device_supports_smart_shift(adev_to_drm(adev)))
  		*states = ATTR_STATE_UNSUPPORTED;

SS 1.0 attributes are supported on APU devices. Will this work on those?

Thanks,
Lijo

drivers/gpu/drm/amd/pm/amdgpu_pm.c static int ss_power_attr_update(struct · line 1889

Quoted 1 line
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0 -0
  	else if (amdgpu_dpm_read_sensor(adev,

AMDGPU_PP_SENSOR_SS_APU_SHARE,

Quoted 2 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0 -0
  		 (void *)&ss_power, &size))