Skip to contentSkip to conversation

drm/powerplay: Fix Vega20 power reading again

PATCH In review Russell, Kent 3 participants 3 messages Aug 23, 2019 – Aug 26, 2019 1 message not in the archive

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

PATCH 1/1 drm/powerplay: Fix Vega20 power reading again

For the 40.46 SMU release, they changed CurrSocketPower to AverageSocketPower, but this was changed back in 40.47 so just check if it's 40.46 and make the appropriate change

Tested with 40.45, 40.46 and 40.47 successfully

Change-Id Icbbe6fd3381b8ad6298c2d0852a726ffac98f93a
---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 7 ++++---
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c         | 7 ++++---
 2 files changed, 8 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +4 -3
index 9f50a12f5c03..98a6f5305974 100644
@@ -2101,10 +2101,11 @@ static int vega20_get_gpu_power(struct pp_hwmgr *hwmgr,
 	if (ret)
 		return ret;
 
-	if (hwmgr->smu_version < 0x282e00)
-		*query = metrics_table.CurrSocketPower << 8;
-	else
+	/* For the 40.46 release, they changed the value name */
+	if (hwmgr->smu_version == 0x282e00)
 		*query = metrics_table.AverageSocketPower << 8;
+	else
+		*query = metrics_table.CurrSocketPower << 8;
 
 	return ret;
 }
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +4 -3
index 0fac824490d7..899bf96b23e1 100644
@@ -2932,10 +2932,11 @@ static int vega20_get_gpu_power(struct smu_context *smu, uint32_t *value)
 	if (ret)
 		return ret;
 
-	if (smu_version < 0x282e00)
-		*value = metrics.CurrSocketPower << 8;
-	else
+	/* For the 40.46 release, they changed the value name */
+	if (smu_version == 0x282e00)
 		*value = metrics.AverageSocketPower << 8;
+	else
+		*value = metrics.CurrSocketPower << 8;
 
 	return 0;
 }
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

Reviewed-by
#2 lore raw

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Russell, Kent <[email protected]>
Sent: Friday, August 23, 2019 9:37 AM
To: [email protected] <[email protected]>
Cc: Russell, Kent <[email protected]>
Subject: [PATCH] drm/powerplay: Fix Vega20 power reading again

For the 40.46 SMU release, they changed CurrSocketPower to AverageSocketPower, but this was changed back in 40.47 so just check if it's 40.46 and make the appropriate change

Tested with 40.45, 40.46 and 40.47 successfully

Change-Id Icbbe6fd3381b8ad6298c2d0852a726ffac98f93a
---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 7 ++++---
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c         | 7 ++++---
 2 files changed, 8 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +4 -3
index 9f50a12f5c03..98a6f5305974 100644
@@ -2101,10 +2101,11 @@ static int vega20_get_gpu_power(struct pp_hwmgr *hwmgr,
         if (ret)
                 return ret;
 
-       if (hwmgr->smu_version < 0x282e00)
-               *query = metrics_table.CurrSocketPower << 8;
-       else
+       /* For the 40.46 release, they changed the value name */
+       if (hwmgr->smu_version == 0x282e00)
                 *query = metrics_table.AverageSocketPower << 8;
+       else
+               *query = metrics_table.CurrSocketPower << 8;
 
         return ret;
 }
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +4 -3
index 0fac824490d7..899bf96b23e1 100644
@@ -2932,10 +2932,11 @@ static int vega20_get_gpu_power(struct smu_context *smu, uint32_t *value)
         if (ret)
                 return ret;
 
-       if (smu_version < 0x282e00)
-               *value = metrics.CurrSocketPower << 8;
-       else
+       /* For the 40.46 release, they changed the value name */
+       if (smu_version == 0x282e00)
                 *value = metrics.AverageSocketPower << 8;
+       else
+               *value = metrics.CurrSocketPower << 8;
 
         return 0;
 }

--
2.17.1

_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by Evan Quan
#3 lore raw
In reply to a message not in the archive
Quoted 66 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Russell, Kent
Sent: Friday, August 23, 2019 9:37 PM
To: [email protected]
Cc: Russell, Kent <[email protected]>
Subject: [PATCH] drm/powerplay: Fix Vega20 power reading again

For the 40.46 SMU release, they changed CurrSocketPower to AverageSocketPower, but this was changed back in 40.47 so just check if it's 40.46 and make the appropriate change

Tested with 40.45, 40.46 and 40.47 successfully

Change-Id Icbbe6fd3381b8ad6298c2d0852a726ffac98f93a
---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 7 ++++---
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c         | 7 ++++---
 2 files changed, 8 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +4 -3
index 9f50a12f5c03..98a6f5305974 100644
@@ -2101,10 +2101,11 @@ static int vega20_get_gpu_power(struct
 pp_hwmgr *hwmgr,
 	if (ret)
 		return ret;
 
-	if (hwmgr->smu_version < 0x282e00)
-		*query = metrics_table.CurrSocketPower << 8;
-	else
+	/* For the 40.46 release, they changed the value name */
+	if (hwmgr->smu_version == 0x282e00)
 		*query = metrics_table.AverageSocketPower << 8;
+	else
+		*query = metrics_table.CurrSocketPower << 8;
 
 	return ret;

}

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +4 -3
index 0fac824490d7..899bf96b23e1 100644
@@ -2932,10 +2932,11 @@ static int vega20_get_gpu_power(struct
 smu_context *smu, uint32_t *value)
 	if (ret)
 		return ret;
 
-	if (smu_version < 0x282e00)
-		*value = metrics.CurrSocketPower << 8;
-	else
+	/* For the 40.46 release, they changed the value name */
+	if (smu_version == 0x282e00)
 		*value = metrics.AverageSocketPower << 8;
+	else
+		*value = metrics.CurrSocketPower << 8;
 
 	return 0;

}
--
2.17.1

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx