drm/powerplay: Fix Vega20 power reading again

Submitted by Russell, Kent on Aug. 23, 2019, 1:37 p.m.

Details

Message ID 20190823133652.31774-1-kent.russell@amd.com
State Accepted
Commit 23b7f6c41d4717b1638eca47e09d7e99fc7b9fd9
Headers show
Series "drm/powerplay: Fix Vega20 power reading again" ( rev: 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Russell, Kent Aug. 23, 2019, 1:37 p.m.
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
Signed-off-by: Kent Russell <kent.russell@amd.com>
---
 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(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
index 9f50a12f5c03..98a6f5305974 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
@@ -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;
 }
diff --git a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c
index 0fac824490d7..899bf96b23e1 100644
--- a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c
@@ -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;
 }

Comments

Reviewed-by: Evan Quan <evan.quan@amd.com>


> -----Original Message-----

> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of

> Russell, Kent

> Sent: Friday, August 23, 2019 9:37 PM

> To: amd-gfx@lists.freedesktop.org

> Cc: Russell, Kent <Kent.Russell@amd.com>

> 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

> Signed-off-by: Kent Russell <kent.russell@amd.com>

> ---

>  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(-)

> 

> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c

> b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c

> index 9f50a12f5c03..98a6f5305974 100644

> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c

> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c

> @@ -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;

>  }

> diff --git a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c

> b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c

> index 0fac824490d7..899bf96b23e1 100644

> --- a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c

> +++ b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c

> @@ -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

> amd-gfx@lists.freedesktop.org

> https://lists.freedesktop.org/mailman/listinfo/amd-gfx