Skip to contentSkip to conversation

Correct UVD/VCE/VCN powergate status retrieval

PATCH In review Evan Quan 3 participants 13 messages Jul 22, 2019 10 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Evan Quan

author
#0 lore raw

cover Correct UVD/VCE/VCN powergate status retrieval

VCN should be used for Vega20 later ASICs.

Evan Quan (5):
drm/amd/powerplay: add new sensor type for VCN powergate status drm/amd/powerplay: support VCN powergate status retrieval on Raven drm/amd/powerplay: support VCN powergate status retrieval for SW SMU drm/amd/powerplay: correct Navi10 VCN powergate control drm/amd/powerplay: correct UVD/VCE/VCN power status retrieval

 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c        | 56 ++++++++++++-------
 .../gpu/drm/amd/include/kgd_pp_interface.h    |  1 +
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c    |  4 ++
 .../gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c |  9 +++
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c    | 26 +++------
 5 files changed, 59 insertions(+), 37 deletions(-)
Signature · 6 lines
2.22.0

_______________________________________________
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]

author
#2 lore raw

PATCH 1/5 drm/amd/powerplay: add new sensor type for VCN powergate status

VCN is widely used in new ASICs and different from tranditional UVD and VCE.

Change-Id I35c9db420734029e8f847dcdce23dff1204d70bc
---
 drivers/gpu/drm/amd/include/kgd_pp_interface.h | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/include/kgd_pp_interface.h +1 -0
index 9733bbf9bc72..157e8546855d 100644
@@ -123,6 +123,7 @@ enum amd_pp_sensors {
 	AMDGPU_PP_SENSOR_ENABLED_SMC_FEATURES_MASK,
 	AMDGPU_PP_SENSOR_MIN_FAN_RPM,
 	AMDGPU_PP_SENSOR_MAX_FAN_RPM,
+	AMDGPU_PP_SENSOR_VCN_POWER,
 };
 
 enum amd_pp_task {
Signature · 6 lines
2.22.0

_______________________________________________
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 Kenneth Feng
#4 lore raw

RE: [PATCH 1/5] drm/amd/powerplay: add new sensor type for VCN powergate status

I just suggest that we use AMDGPU_PP_SENSOR_VCN_POWER_STATE instead of AMDGPU_PP_SENSOR_VCN_POWER, since we gets the state of power on/off, not the real VCN power value.

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Evan Quan
Sent: Monday, July 22, 2019 11:15 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>
Subject: [PATCH 1/5] drm/amd/powerplay: add new sensor type for VCN powergate status

[CAUTION: External Email]

VCN is widely used in new ASICs and different from tranditional UVD and VCE.

Change-Id I35c9db420734029e8f847dcdce23dff1204d70bc
---
 drivers/gpu/drm/amd/include/kgd_pp_interface.h | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/include/kgd_pp_interface.h +1 -0
index 9733bbf9bc72..157e8546855d 100644
@@ -123,6 +123,7 @@ enum amd_pp_sensors {
        AMDGPU_PP_SENSOR_ENABLED_SMC_FEATURES_MASK,
        AMDGPU_PP_SENSOR_MIN_FAN_RPM,
        AMDGPU_PP_SENSOR_MAX_FAN_RPM,
+       AMDGPU_PP_SENSOR_VCN_POWER,
 };
 
 enum amd_pp_task {

--
2.22.0

_______________________________________________
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

A message that is not in the archive (sent off-list or not yet received): MN2PR12MB359851C9E6C7D57EE8E867188EC40-rweVpJHSKTohWwLleUddgQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

author
#6 lore raw

RE: [PATCH 1/5] drm/amd/powerplay: add new sensor type for VCN powergate status

Good point. It was following old naming style.
But I think we can make some changes to make it more understandable. Let me address this in the V2 version.

Regards,
Evan

Quoted 52 lines

-----Original Message-----
From: Feng, Kenneth <[email protected]>
Sent: Monday, July 22, 2019 12:27 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>
Subject: RE: [PATCH 1/5] drm/amd/powerplay: add new sensor type for VCN powergate status

I just suggest that we use AMDGPU_PP_SENSOR_VCN_POWER_STATE instead of AMDGPU_PP_SENSOR_VCN_POWER, since we gets the state of power on/off, not the real VCN power value.

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Evan Quan
Sent: Monday, July 22, 2019 11:15 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>
Subject: [PATCH 1/5] drm/amd/powerplay: add new sensor type for VCN powergate status

[CAUTION: External Email]

VCN is widely used in new ASICs and different from tranditional UVD and VCE.

Change-Id I35c9db420734029e8f847dcdce23dff1204d70bc
---
 drivers/gpu/drm/amd/include/kgd_pp_interface.h | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/include/kgd_pp_interface.h +1 -1
index 9733bbf9bc72..157e8546855d 100644
@@ -123,6 +123,7 @@ enum amd_pp_sensors {
        AMDGPU_PP_SENSOR_ENABLED_SMC_FEATURES_MASK,
        AMDGPU_PP_SENSOR_MIN_FAN_RPM,
        AMDGPU_PP_SENSOR_MAX_FAN_RPM,
+       AMDGPU_PP_SENSOR_VCN_POWER,
 };
 
 enum amd_pp_task {
--

2.22.0

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

author
#7 lore raw

PATCH 2/5 drm/amd/powerplay: support VCN powergate status retrieval on Raven

In reply to a message not in the archive

Enable VCN powergate status report on Raven.

Change-Id I60c793f8185ce6799b40a0cabd97d9c9fe5483fd
---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c +9 -0
index e32ae9d3373c..491a3cc776fc 100644
@@ -1111,6 +1111,7 @@ static int smu10_thermal_get_temperature(struct pp_hwmgr *hwmgr)
 static int smu10_read_sensor(struct pp_hwmgr *hwmgr, int idx,
 			  void *value, int *size)
 {
+	struct smu10_hwmgr *smu10_data = (struct smu10_hwmgr *)(hwmgr->backend);
 	uint32_t sclk, mclk;
 	int ret = 0;
 
@@ -1132,6 +1133,10 @@ static int smu10_read_sensor(struct pp_hwmgr *hwmgr, int idx,
 	case AMDGPU_PP_SENSOR_GPU_TEMP:
 		*((uint32_t *)value) = smu10_thermal_get_temperature(hwmgr);
 		break;
+	case AMDGPU_PP_SENSOR_VCN_POWER:
+		*(uint32_t *)value =  smu10_data->vcn_power_gated ? 0 : 1;
+		*size = 4;
+		break;
 	default:
 		ret = -EINVAL;
 		break;
@@ -1175,18 +1180,22 @@ static int smu10_powergate_sdma(struct pp_hwmgr *hwmgr, bool gate)
 
 static void smu10_powergate_vcn(struct pp_hwmgr *hwmgr, bool bgate)
 {
+	struct smu10_hwmgr *smu10_data = (struct smu10_hwmgr *)(hwmgr->backend);
+
 	if (bgate) {
 		amdgpu_device_ip_set_powergating_state(hwmgr->adev,
 						AMD_IP_BLOCK_TYPE_VCN,
 						AMD_PG_STATE_GATE);
 		smum_send_msg_to_smc_with_parameter(hwmgr,
 					PPSMC_MSG_PowerDownVcn, 0);
+		smu10_data->vcn_power_gated = true;
 	} else {
 		smum_send_msg_to_smc_with_parameter(hwmgr,
 						PPSMC_MSG_PowerUpVcn, 0);
 		amdgpu_device_ip_set_powergating_state(hwmgr->adev,
 						AMD_IP_BLOCK_TYPE_VCN,
 						AMD_PG_STATE_UNGATE);
+		smu10_data->vcn_power_gated = false;
 	}
 }
 
Signature · 6 lines
2.22.0

_______________________________________________
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 Kenneth Feng
#9 lore raw

RE: [PATCH 2/5] drm/amd/powerplay: support VCN powergate status retrieval on Raven

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Evan Quan
Sent: Monday, July 22, 2019 11:15 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>
Subject: [PATCH 2/5] drm/amd/powerplay: support VCN powergate status retrieval on Raven

[CAUTION: External Email]

Enable VCN powergate status report on Raven.

Change-Id I60c793f8185ce6799b40a0cabd97d9c9fe5483fd
---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c +11 -1
index e32ae9d3373c..491a3cc776fc 100644
@@ -1111,6 +1111,7 @@ static int smu10_thermal_get_temperature(struct pp_hwmgr *hwmgr)  static int smu10_read_sensor(struct pp_hwmgr *hwmgr, int idx,
                          void *value, int *size)  {
+       struct smu10_hwmgr *smu10_data = (struct smu10_hwmgr 
+ *)(hwmgr->backend);
        uint32_t sclk, mclk;
        int ret = 0;
 
@@ -1132,6 +1133,10 @@ static int smu10_read_sensor(struct pp_hwmgr *hwmgr, int idx,
        case AMDGPU_PP_SENSOR_GPU_TEMP:
                *((uint32_t *)value) = smu10_thermal_get_temperature(hwmgr);
                break;
+       case AMDGPU_PP_SENSOR_VCN_POWER:
+               *(uint32_t *)value =  smu10_data->vcn_power_gated ? 0 : 1;
+               *size = 4;
+               break;
        default:
                ret = -EINVAL;
                break;
@@ -1175,18 +1180,22 @@ static int smu10_powergate_sdma(struct pp_hwmgr *hwmgr, bool gate)
 
 static void smu10_powergate_vcn(struct pp_hwmgr *hwmgr, bool bgate)  {
+       struct smu10_hwmgr *smu10_data = (struct smu10_hwmgr 
+ *)(hwmgr->backend);
+
        if (bgate) {
                amdgpu_device_ip_set_powergating_state(hwmgr->adev,
                                                AMD_IP_BLOCK_TYPE_VCN,
                                                AMD_PG_STATE_GATE);
                smum_send_msg_to_smc_with_parameter(hwmgr,
                                        PPSMC_MSG_PowerDownVcn, 0);
+               smu10_data->vcn_power_gated = true;
        } else {
                smum_send_msg_to_smc_with_parameter(hwmgr,
                                                PPSMC_MSG_PowerUpVcn, 0);
                amdgpu_device_ip_set_powergating_state(hwmgr->adev,
                                                AMD_IP_BLOCK_TYPE_VCN,
                                                AMD_PG_STATE_UNGATE);
+               smu10_data->vcn_power_gated = false;
        }
 }
 
--

2.22.0

_______________________________________________
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

author
#10 lore raw

PATCH 3/5 drm/amd/powerplay: support VCN powergate status retrieval for SW SMU

In reply to a message not in the archive

Commonly used for VCN powergate status retrieval for SW SMU.

Change-Id Ibc2f498848f728eb7727cd3fa889e91a2b09d07b
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +4 -0
index 416f9a837fa8..4e18f33a1bab 100644
@@ -336,6 +336,10 @@ int smu_common_read_sensor(struct smu_context *smu, enum amd_pp_sensors sensor,
 		*(uint32_t *)data = smu_feature_is_enabled(smu, SMU_FEATURE_DPM_VCE_BIT) ? 1 : 0;
 		*size = 4;
 		break;
+	case AMDGPU_PP_SENSOR_VCN_POWER:
+		*(uint32_t *)data = smu_feature_is_enabled(smu, SMU_FEATURE_VCN_PG_BIT) ? 1 : 0;
+		*size = 4;
+		break;
 	default:
 		ret = -EINVAL;
 		break;
Signature · 6 lines
2.22.0

_______________________________________________
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 Kenneth Feng
#12 lore raw

RE: [PATCH 3/5] drm/amd/powerplay: support VCN powergate status retrieval for SW SMU

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Evan Quan
Sent: Monday, July 22, 2019 11:15 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>
Subject: [PATCH 3/5] drm/amd/powerplay: support VCN powergate status retrieval for SW SMU

[CAUTION: External Email]

Commonly used for VCN powergate status retrieval for SW SMU.

Change-Id Ibc2f498848f728eb7727cd3fa889e91a2b09d07b
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +4 -0
index 416f9a837fa8..4e18f33a1bab 100644
@@ -336,6 +336,10 @@ int smu_common_read_sensor(struct smu_context *smu, enum amd_pp_sensors sensor,
                *(uint32_t *)data = smu_feature_is_enabled(smu, SMU_FEATURE_DPM_VCE_BIT) ? 1 : 0;
                *size = 4;
                break;
+       case AMDGPU_PP_SENSOR_VCN_POWER:
+               *(uint32_t *)data = smu_feature_is_enabled(smu, SMU_FEATURE_VCN_PG_BIT) ? 1 : 0;
+               *size = 4;
+               break;
        default:
                ret = -EINVAL;
                break;

--
2.22.0

_______________________________________________
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

author
#13 lore raw

PATCH 4/5 drm/amd/powerplay: correct Navi10 VCN powergate control

In reply to a message not in the archive

No VCN DPM bit check as that's different from VCN PG. Also no extra check for possible double enablement/disablement as that's already done by VCN.

Change-Id I59c63829cf4dcb8093fde1ca8245b613ab2d90df
---
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 26 ++++++++--------------
 1 file changed, 9 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +9 -17
index c8ce9bbae276..2198d373d38c 100644
@@ -591,27 +591,19 @@ static int navi10_set_default_dpm_table(struct smu_context *smu)
 static int navi10_dpm_set_uvd_enable(struct smu_context *smu, bool enable)
 {
 	int ret = 0;
-	struct smu_power_context *smu_power = &smu->smu_power;
-	struct smu_power_gate *power_gate = &smu_power->power_gate;
 
-	if (enable && power_gate->uvd_gated) {
-		if (smu_feature_is_enabled(smu, SMU_FEATURE_DPM_UVD_BIT)) {
-			ret = smu_send_smc_msg_with_param(smu, SMU_MSG_PowerUpVcn, 1);
-			if (ret)
-				return ret;
-		}
-		power_gate->uvd_gated = false;
+	if (enable) {
+		ret = smu_send_smc_msg_with_param(smu, SMU_MSG_PowerUpVcn, 1);
+		if (ret)
+			return ret;
 	} else {
-		if (!enable && !power_gate->uvd_gated) {
-			if (smu_feature_is_enabled(smu, SMU_FEATURE_DPM_UVD_BIT)) {
-				ret = smu_send_smc_msg(smu, SMU_MSG_PowerDownVcn);
-				if (ret)
-					return ret;
-			}
-			power_gate->uvd_gated = true;
-		}
+		ret = smu_send_smc_msg(smu, SMU_MSG_PowerDownVcn);
+		if (ret)
+			return ret;
 	}
 
+	smu_feature_set_enabled(smu, SMU_FEATURE_VCN_PG_BIT, enable);
+
 	return 0;
 }
 
Signature · 6 lines
2.22.0

_______________________________________________
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 Kenneth Feng
#15 lore raw

RE: [PATCH 4/5] drm/amd/powerplay: correct Navi10 VCN powergate control

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Evan Quan
Sent: Monday, July 22, 2019 11:16 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>
Subject: [PATCH 4/5] drm/amd/powerplay: correct Navi10 VCN powergate control

[CAUTION: External Email]

No VCN DPM bit check as that's different from VCN PG. Also no extra check for possible double enablement/disablement as that's already done by VCN.

Change-Id I59c63829cf4dcb8093fde1ca8245b613ab2d90df
---
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 26 ++++++++--------------
 1 file changed, 9 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +9 -18
index c8ce9bbae276..2198d373d38c 100644
@@ -591,27 +591,19 @@ static int navi10_set_default_dpm_table(struct smu_context *smu)  static int navi10_dpm_set_uvd_enable(struct smu_context *smu, bool enable)  {
        int ret = 0;
-       struct smu_power_context *smu_power = &smu->smu_power;
-       struct smu_power_gate *power_gate = &smu_power->power_gate;
 
-       if (enable && power_gate->uvd_gated) {
-               if (smu_feature_is_enabled(smu, SMU_FEATURE_DPM_UVD_BIT)) {
-                       ret = smu_send_smc_msg_with_param(smu, SMU_MSG_PowerUpVcn, 1);
-                       if (ret)
-                               return ret;
-               }
-               power_gate->uvd_gated = false;
+       if (enable) {
+               ret = smu_send_smc_msg_with_param(smu, SMU_MSG_PowerUpVcn, 1);
+               if (ret)
+                       return ret;
        } else {
-               if (!enable && !power_gate->uvd_gated) {
-                       if (smu_feature_is_enabled(smu, SMU_FEATURE_DPM_UVD_BIT)) {
-                               ret = smu_send_smc_msg(smu, SMU_MSG_PowerDownVcn);
-                               if (ret)
-                                       return ret;
-                       }
-                       power_gate->uvd_gated = true;
-               }
+               ret = smu_send_smc_msg(smu, SMU_MSG_PowerDownVcn);
+               if (ret)
+                       return ret;
        }
 
+       smu_feature_set_enabled(smu, SMU_FEATURE_VCN_PG_BIT, enable);
+
        return 0;
 }
 
--

2.22.0

_______________________________________________
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

A message that is not in the archive (sent off-list or not yet received): MN2PR12MB3296FAF9BF4C2FBAF12C2496A2C40@MN2PR12MB3296.namprd12.prod.outlook.com

A message that is not in the archive (sent off-list or not yet received): MN2PR12MB3344303C47BE91884B6D6293E4C40@MN2PR12MB3344.namprd12.prod.outlook.com

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

Reviewed-by Kevin Wang Reviewed-by Kenneth Feng
#19 lore raw

Re: [PATCH 4/5] drm/amd/powerplay: correct Navi10 VCN powergate control

It's not necessary in the current code,
but if you update the implementation of the API one day, your code won't look so strong.
I don't recommend it.

Best Regards,
Kevin

________________________________
From: Quan, Evan <[email protected]>
Sent: Monday, July 22, 2019 2:42:26 PM
To: Wang, Kevin(Yang) <[email protected]>; Feng, Kenneth <[email protected]>; [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>
Subject: RE: [PATCH 4/5] drm/amd/powerplay: correct Navi10 VCN powergate control

That does not really matters. The API will still return success even on smu_feature_set_enabled failure. It does not care about smu_feature_set_enabled failure.

But it helps me find another issue(about the naming smu_feature_set_enabled). I just sent out a patch to address that.

Regards,

Evan

From: Wang, Kevin(Yang) <[email protected]>
Sent: Monday, July 22, 2019 1:39 PM
To: Feng, Kenneth <[email protected]>; Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 4/5] drm/amd/powerplay: correct Navi10 VCN powergate control

you should check return value in smu anytime.

+ smu_feature_set_enabled(smu, SMU_FEATURE_VCN_PG_BIT, enable);
+

Best Regards,
kevin

________________________________

From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:[email protected]>> on behalf of Feng, Kenneth <[email protected]<mailto:[email protected]>>
Sent: Monday, July 22, 2019 12:28:40 PM
To: Quan, Evan <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Deucher, Alexander <[email protected]<mailto:[email protected]>>; Quan, Evan <[email protected]<mailto:[email protected]>>
Subject: RE: [PATCH 4/5] drm/amd/powerplay: correct Navi10 VCN powergate control

-----Original Message-----
From: amd-gfx [mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org] On Behalf Of Evan Quan
Sent: Monday, July 22, 2019 11:16 AM
To: [email protected]<mailto:[email protected]>
Cc: Deucher, Alexander <[email protected]<mailto:[email protected]>>; Quan, Evan <[email protected]<mailto:[email protected]>>
Subject: [PATCH 4/5] drm/amd/powerplay: correct Navi10 VCN powergate control

[CAUTION: External Email]

No VCN DPM bit check as that's different from VCN PG. Also no extra check for possible double enablement/disablement as that's already done by VCN.

Change-Id I59c63829cf4dcb8093fde1ca8245b613ab2d90df
---
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 26 ++++++++--------------
 1 file changed, 9 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +9 -18
index c8ce9bbae276..2198d373d38c 100644
@@ -591,27 +591,19 @@ static int navi10_set_default_dpm_table(struct smu_context *smu)  static int navi10_dpm_set_uvd_enable(struct smu_context *smu, bool enable)  {
        int ret = 0;
-       struct smu_power_context *smu_power = &smu->smu_power;
-       struct smu_power_gate *power_gate = &smu_power->power_gate;
 
-       if (enable && power_gate->uvd_gated) {
-               if (smu_feature_is_enabled(smu, SMU_FEATURE_DPM_UVD_BIT)) {
-                       ret = smu_send_smc_msg_with_param(smu, SMU_MSG_PowerUpVcn, 1);
-                       if (ret)
-                               return ret;
-               }
-               power_gate->uvd_gated = false;
+       if (enable) {
+               ret = smu_send_smc_msg_with_param(smu, SMU_MSG_PowerUpVcn, 1);
+               if (ret)
+                       return ret;
        } else {
-               if (!enable && !power_gate->uvd_gated) {
-                       if (smu_feature_is_enabled(smu, SMU_FEATURE_DPM_UVD_BIT)) {
-                               ret = smu_send_smc_msg(smu, SMU_MSG_PowerDownVcn);
-                               if (ret)
-                                       return ret;
-                       }
-                       power_gate->uvd_gated = true;
-               }
+               ret = smu_send_smc_msg(smu, SMU_MSG_PowerDownVcn);
+               if (ret)
+                       return ret;
        }
 
+       smu_feature_set_enabled(smu, SMU_FEATURE_VCN_PG_BIT, enable);
+
        return 0;
 }
 
--

2.22.0

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

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

author
#20 lore raw

PATCH 5/5 drm/amd/powerplay: correct UVD/VCE/VCN power status retrieval

In reply to a message not in the archive

VCN should be used for Vega20 later ASICs while UVD and VCE are for previous ASICs.

Change-Id Icc53d6fa176c48f0fc5348e79b8a5010357867eb
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 56 +++++++++++++++++---------
 1 file changed, 36 insertions(+), 20 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +36 -20
index 8f702cf5e080..f2b70db347a7 100644
@@ -3065,28 +3065,44 @@ static int amdgpu_debugfs_pm_info_pp(struct seq_file *m, struct amdgpu_device *a
 	if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_ENABLED_SMC_FEATURES_MASK, (void *)&value64, &size))
 		seq_printf(m, "SMC Feature Mask: 0x%016llx\n", value64);
 
-	/* UVD clocks */
-	if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_UVD_POWER, (void *)&value, &size)) {
-		if (!value) {
-			seq_printf(m, "UVD: Disabled\n");
-		} else {
-			seq_printf(m, "UVD: Enabled\n");
-			if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_UVD_DCLK, (void *)&value, &size))
-				seq_printf(m, "\t%u MHz (DCLK)\n", value/100);
-			if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_UVD_VCLK, (void *)&value, &size))
-				seq_printf(m, "\t%u MHz (VCLK)\n", value/100);
+	if (adev->asic_type > CHIP_VEGA20) {
+		/* VCN clocks */
+		if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_VCN_POWER, (void *)&value, &size)) {
+			if (!value) {
+				seq_printf(m, "VCN: Disabled\n");
+			} else {
+				seq_printf(m, "VCN: Enabled\n");
+				if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_UVD_DCLK, (void *)&value, &size))
+					seq_printf(m, "\t%u MHz (DCLK)\n", value/100);
+				if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_UVD_VCLK, (void *)&value, &size))
+					seq_printf(m, "\t%u MHz (VCLK)\n", value/100);
+			}
 		}
-	}
-	seq_printf(m, "\n");
+		seq_printf(m, "\n");
+	} else {
+		/* UVD clocks */
+		if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_UVD_POWER, (void *)&value, &size)) {
+			if (!value) {
+				seq_printf(m, "UVD: Disabled\n");
+			} else {
+				seq_printf(m, "UVD: Enabled\n");
+				if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_UVD_DCLK, (void *)&value, &size))
+					seq_printf(m, "\t%u MHz (DCLK)\n", value/100);
+				if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_UVD_VCLK, (void *)&value, &size))
+					seq_printf(m, "\t%u MHz (VCLK)\n", value/100);
+			}
+		}
+		seq_printf(m, "\n");
 
-	/* VCE clocks */
-	if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_VCE_POWER, (void *)&value, &size)) {
-		if (!value) {
-			seq_printf(m, "VCE: Disabled\n");
-		} else {
-			seq_printf(m, "VCE: Enabled\n");
-			if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_VCE_ECCLK, (void *)&value, &size))
-				seq_printf(m, "\t%u MHz (ECCLK)\n", value/100);
+		/* VCE clocks */
+		if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_VCE_POWER, (void *)&value, &size)) {
+			if (!value) {
+				seq_printf(m, "VCE: Disabled\n");
+			} else {
+				seq_printf(m, "VCE: Enabled\n");
+				if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_VCE_ECCLK, (void *)&value, &size))
+					seq_printf(m, "\t%u MHz (ECCLK)\n", value/100);
+			}
 		}
 	}
 
Signature · 6 lines
2.22.0

_______________________________________________
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 Kenneth Feng
#22 lore raw

RE: [PATCH 5/5] drm/amd/powerplay: correct UVD/VCE/VCN power status retrieval

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Evan Quan
Sent: Monday, July 22, 2019 11:16 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>
Subject: [PATCH 5/5] drm/amd/powerplay: correct UVD/VCE/VCN power status retrieval

[CAUTION: External Email]

VCN should be used for Vega20 later ASICs while UVD and VCE are for previous ASICs.

Change-Id Icc53d6fa176c48f0fc5348e79b8a5010357867eb
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 56 +++++++++++++++++---------
 1 file changed, 36 insertions(+), 20 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +36 -20
index 8f702cf5e080..f2b70db347a7 100644
@@ -3065,28 +3065,44 @@ static int amdgpu_debugfs_pm_info_pp(struct seq_file *m, struct amdgpu_device *a
        if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_ENABLED_SMC_FEATURES_MASK, (void *)&value64, &size))
                seq_printf(m, "SMC Feature Mask: 0x%016llx\n", value64);
 
-       /* UVD clocks */
-       if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_UVD_POWER, (void *)&value, &size)) {
-               if (!value) {
-                       seq_printf(m, "UVD: Disabled\n");
-               } else {
-                       seq_printf(m, "UVD: Enabled\n");
-                       if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_UVD_DCLK, (void *)&value, &size))
-                               seq_printf(m, "\t%u MHz (DCLK)\n", value/100);
-                       if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_UVD_VCLK, (void *)&value, &size))
-                               seq_printf(m, "\t%u MHz (VCLK)\n", value/100);
+       if (adev->asic_type > CHIP_VEGA20) {
+               /* VCN clocks */
+               if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_VCN_POWER, (void *)&value, &size)) {
+                       if (!value) {
+                               seq_printf(m, "VCN: Disabled\n");
+                       } else {
+                               seq_printf(m, "VCN: Enabled\n");
+                               if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_UVD_DCLK, (void *)&value, &size))
+                                       seq_printf(m, "\t%u MHz (DCLK)\n", value/100);
+                               if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_UVD_VCLK, (void *)&value, &size))
+                                       seq_printf(m, "\t%u MHz (VCLK)\n", value/100);
+                       }
                }
-       }
-       seq_printf(m, "\n");
+               seq_printf(m, "\n");
+       } else {
+               /* UVD clocks */
+               if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_UVD_POWER, (void *)&value, &size)) {
+                       if (!value) {
+                               seq_printf(m, "UVD: Disabled\n");
+                       } else {
+                               seq_printf(m, "UVD: Enabled\n");
+                               if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_UVD_DCLK, (void *)&value, &size))
+                                       seq_printf(m, "\t%u MHz (DCLK)\n", value/100);
+                               if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_UVD_VCLK, (void *)&value, &size))
+                                       seq_printf(m, "\t%u MHz (VCLK)\n", value/100);
+                       }
+               }
+               seq_printf(m, "\n");
 
-       /* VCE clocks */
-       if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_VCE_POWER, (void *)&value, &size)) {
-               if (!value) {
-                       seq_printf(m, "VCE: Disabled\n");
-               } else {
-                       seq_printf(m, "VCE: Enabled\n");
-                       if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_VCE_ECCLK, (void *)&value, &size))
-                               seq_printf(m, "\t%u MHz (ECCLK)\n", value/100);
+               /* VCE clocks */
+               if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_VCE_POWER, (void *)&value, &size)) {
+                       if (!value) {
+                               seq_printf(m, "VCE: Disabled\n");
+                       } else {
+                               seq_printf(m, "VCE: Enabled\n");
+                               if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_VCE_ECCLK, (void *)&value, &size))
+                                       seq_printf(m, "\t%u MHz (ECCLK)\n", value/100);
+                       }
                }
        }
 

--
2.22.0

_______________________________________________
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