Skip to contentSkip to conversation

drm/amd/powerplay: correct the bit mask for checking VCN power status

PATCH In review Evan Quan 4 participants 5 messages Jul 19, 2019 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Evan Quan

author
#0 lore raw

PATCH 1/1 drm/amd/powerplay: correct the bit mask for checking VCN power status

For Navi10 or later ASICs, a different bit mask is used for checking VCN power status.

Change-Id Iaa49e5a339c38f46e3e7124d21aeb65f6633325e
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +7 -1
index 6e2f7df826f0..887577c47568 100644
@@ -271,6 +271,8 @@ int smu_get_power_num_states(struct smu_context *smu,
 int smu_common_read_sensor(struct smu_context *smu, enum amd_pp_sensors sensor,
 			   void *data, uint32_t *size)
 {
+	struct amdgpu_device *adev = smu->adev;
+	uint32_t uvd_bit_mask = 0xFFFFFFFF;
 	int ret = 0;
 
 	switch (sensor) {
@@ -287,7 +289,11 @@ int smu_common_read_sensor(struct smu_context *smu, enum amd_pp_sensors sensor,
 		*size = 8;
 		break;
 	case AMDGPU_PP_SENSOR_UVD_POWER:
-		*(uint32_t *)data = smu_feature_is_enabled(smu, SMU_FEATURE_DPM_UVD_BIT) ? 1 : 0;
+		if (adev->asic_type == CHIP_VEGA20)
+			uvd_bit_mask = SMU_FEATURE_DPM_UVD_BIT;
+		else
+			uvd_bit_mask = SMU_FEATURE_VCN_PG_BIT;
+		*(uint32_t *)data = smu_feature_is_enabled(smu, uvd_bit_mask) ? 1 : 0;
 		*size = 4;
 		break;
 	case AMDGPU_PP_SENSOR_VCE_POWER:
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 Feifei Xu
#2 lore raw

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Evan Quan
Sent: Friday, July 19, 2019 4:52 PM
To: [email protected]
Cc: Quan, Evan <[email protected]>
Subject: [PATCH] drm/amd/powerplay: correct the bit mask for checking VCN power status

For Navi10 or later ASICs, a different bit mask is used for checking VCN power status.

Change-Id Iaa49e5a339c38f46e3e7124d21aeb65f6633325e
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +8 -1
index 6e2f7df826f0..887577c47568 100644
@@ -271,6 +271,8 @@ int smu_get_power_num_states(struct smu_context *smu,  int smu_common_read_sensor(struct smu_context *smu, enum amd_pp_sensors sensor,
 			   void *data, uint32_t *size)
 {
+	struct amdgpu_device *adev = smu->adev;
+	uint32_t uvd_bit_mask = 0xFFFFFFFF;
 	int ret = 0;
 
 	switch (sensor) {
@@ -287,7 +289,11 @@ int smu_common_read_sensor(struct smu_context *smu, enum amd_pp_sensors sensor,
 		*size = 8;
 		break;
 	case AMDGPU_PP_SENSOR_UVD_POWER:
-		*(uint32_t *)data = smu_feature_is_enabled(smu, SMU_FEATURE_DPM_UVD_BIT) ? 1 : 0;
+		if (adev->asic_type == CHIP_VEGA20)
+			uvd_bit_mask = SMU_FEATURE_DPM_UVD_BIT;
+		else
+			uvd_bit_mask = SMU_FEATURE_VCN_PG_BIT;
+		*(uint32_t *)data = smu_feature_is_enabled(smu, uvd_bit_mask) ? 1 : 
+0;
 		*size = 4;
 		break;

case AMDGPU_PP_SENSOR_VCE_POWER:
--
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

Reviewed-by Huang Rui
#3 lore raw
In reply to a message not in the archive
Quoted 34 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Evan Quan
Sent: Friday, July 19, 2019 4:52 PM
To: [email protected]
Cc: Quan, Evan <[email protected]>
Subject: [PATCH] drm/amd/powerplay: correct the bit mask for checking VCN power status

For Navi10 or later ASICs, a different bit mask is used for checking VCN power status.

Change-Id Iaa49e5a339c38f46e3e7124d21aeb65f6633325e
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +2 -0
index 6e2f7df826f0..887577c47568 100644
@@ -271,6 +271,8 @@ int smu_get_power_num_states(struct smu_context
 *smu,  int smu_common_read_sensor(struct smu_context *smu, enum
 amd_pp_sensors sensor,
 			   void *data, uint32_t *size)
 {
+	struct amdgpu_device *adev = smu->adev;
+	uint32_t uvd_bit_mask = 0xFFFFFFFF;
 	int ret = 0;
 
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +0 -0
 	switch (sensor) {

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c int smu_common_read_sensor(struct smu_context · line 297

Quoted 10 lines
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +4 -1
@@ -287,7 +289,11 @@ int smu_common_read_sensor(struct smu_context
 *smu, enum amd_pp_sensors sensor,
 		*size = 8;
 		break;
 	case AMDGPU_PP_SENSOR_UVD_POWER:
-		*(uint32_t *)data = smu_feature_is_enabled(smu,
 SMU_FEATURE_DPM_UVD_BIT) ? 1 : 0;
+		if (adev->asic_type == CHIP_VEGA20)
+			uvd_bit_mask = SMU_FEATURE_DPM_UVD_BIT;
+		else
+			uvd_bit_mask = SMU_FEATURE_VCN_PG_BIT;

After vega20, we actually will use VCN instead of UVD. Below indicates the design for this.

uvd_bit_mask = (adev->asic_type > CHIP_VEGA20) ? SMU_FEATURE_VCN_PG_BIT : SMU_FEATURE_DPM_UVD_BIT

Anyway, patch looks good for me.

Thanks,
Ray

Quoted 9 lines
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +1 -0
+	*(uint32_t *)data = smu_feature_is_enabled(smu,

uvd_bit_mask) ? 1 :
+0;

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +0 -1
 		*size = 4;
 		break;
 	case AMDGPU_PP_SENSOR_VCE_POWER:
--

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

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

author
#5 lore raw

Considering this is actually different from traditional UVD, maybe it's better to add a new flag like AMDGPU_PP_SENSOR_VCN_POWER. @Deucher, Alexander any comment?

Regards,
Evan

Quoted 77 lines

-----Original Message-----
From: Huang, Ray <[email protected]>
Sent: Friday, July 19, 2019 5:21 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Quan, Evan <[email protected]>
Subject: RE: [PATCH] drm/amd/powerplay: correct the bit mask for checking VCN power status

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c int smu_get_power_num_states(struct

Quoted 24 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Evan Quan
Sent: Friday, July 19, 2019 4:52 PM
To: [email protected]
Cc: Quan, Evan <[email protected]>
Subject: [PATCH] drm/amd/powerplay: correct the bit mask for checking VCN power status

For Navi10 or later ASICs, a different bit mask is used for checking VCN power status.

Change-Id Iaa49e5a339c38f46e3e7124d21aeb65f6633325e
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +0 -0
index 6e2f7df826f0..887577c47568 100644
@@ -271,6 +271,8 @@ int smu_get_power_num_states(struct

smu_context

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c int smu_common_read_sensor(struct

Quoted 10 lines
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +2 -0
 *smu,  int smu_common_read_sensor(struct smu_context *smu, enum
 amd_pp_sensors sensor,
 			   void *data, uint32_t *size)
 {
+	struct amdgpu_device *adev = smu->adev;
+	uint32_t uvd_bit_mask = 0xFFFFFFFF;
 	int ret = 0;
 
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +0 -0
 	switch (sensor) {
@@ -287,7 +289,11 @@ int smu_common_read_sensor(struct

smu_context

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c int smu_common_read_sensor(struct smu_context *smu, enum amd_pp_sensors sensor, · line 295

Quoted 10 lines
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +4 -1
 *smu, enum amd_pp_sensors sensor,
 		*size = 8;
 		break;
 	case AMDGPU_PP_SENSOR_UVD_POWER:
-		*(uint32_t *)data = smu_feature_is_enabled(smu,
 SMU_FEATURE_DPM_UVD_BIT) ? 1 : 0;
+		if (adev->asic_type == CHIP_VEGA20)
+			uvd_bit_mask = SMU_FEATURE_DPM_UVD_BIT;
+		else
+			uvd_bit_mask = SMU_FEATURE_VCN_PG_BIT;

After vega20, we actually will use VCN instead of UVD. Below indicates the design for this.

uvd_bit_mask = (adev->asic_type > CHIP_VEGA20) ?
SMU_FEATURE_VCN_PG_BIT : SMU_FEATURE_DPM_UVD_BIT

Anyway, patch looks good for me.

Thanks,
Ray

Quoted 9 lines
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +1 -0
+	*(uint32_t *)data = smu_feature_is_enabled(smu,

uvd_bit_mask) ? 1 :
+0;

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +0 -1
 		*size = 4;
 		break;
 	case AMDGPU_PP_SENSOR_VCE_POWER:
--

2.22.0

Quoted 4 lines
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

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

#7 lore raw

Sure. That makes more sense. We should switch raven to use it as well.

Alex
________________________________
From: Quan, Evan
Sent: Friday, July 19, 2019 5:47 AM
To: [email protected]; Deucher, Alexander
Subject: RE: [PATCH] drm/amd/powerplay: correct the bit mask for checking VCN power status

Considering this is actually different from traditional UVD, maybe it's better to add a new flag like AMDGPU_PP_SENSOR_VCN_POWER. @Deucher, Alexander any comment?

Regards,
Evan

Quoted 61 lines

-----Original Message-----
From: Huang, Ray <[email protected]>
Sent: Friday, July 19, 2019 5:21 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Quan, Evan <[email protected]>
Subject: RE: [PATCH] drm/amd/powerplay: correct the bit mask for checking
VCN power status

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c int smu_get_power_num_states(struct

Quoted 24 lines

-----Original Message-----
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> On Behalf Of Evan Quan
Sent: Friday, July 19, 2019 4:52 PM
To: [email protected]
Cc: Quan, Evan <[email protected]>
Subject: [PATCH] drm/amd/powerplay: correct the bit mask for checking
VCN power status

For Navi10 or later ASICs, a different bit mask is used for checking VCN power status.

Change-Id Iaa49e5a339c38f46e3e7124d21aeb65f6633325e
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +0 -0
index 6e2f7df826f0..887577c47568 100644
@@ -271,6 +271,8 @@ int smu_get_power_num_states(struct

smu_context

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c int smu_common_read_sensor(struct

Quoted 10 lines
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +2 -0
 *smu,  int smu_common_read_sensor(struct smu_context *smu, enum
 amd_pp_sensors sensor,
                        void *data, uint32_t *size)
 {
+   struct amdgpu_device *adev = smu->adev;
+   uint32_t uvd_bit_mask = 0xFFFFFFFF;
     int ret = 0;
 
     switch (sensor) {
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +0 -0
@@ -287,7 +289,11 @@ int smu_common_read_sensor(struct

smu_context

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c int smu_common_read_sensor(struct smu_context *smu, enum amd_pp_sensors sensor, · line 295

Quoted 10 lines
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +4 -1
 *smu, enum amd_pp_sensors sensor,
             *size = 8;
             break;
     case AMDGPU_PP_SENSOR_UVD_POWER:
-           *(uint32_t *)data = smu_feature_is_enabled(smu,
 SMU_FEATURE_DPM_UVD_BIT) ? 1 : 0;
+           if (adev->asic_type == CHIP_VEGA20)
+                   uvd_bit_mask = SMU_FEATURE_DPM_UVD_BIT;
+           else
+                   uvd_bit_mask = SMU_FEATURE_VCN_PG_BIT;

After vega20, we actually will use VCN instead of UVD. Below indicates the design for this.

uvd_bit_mask = (adev->asic_type > CHIP_VEGA20) ?
SMU_FEATURE_VCN_PG_BIT : SMU_FEATURE_DPM_UVD_BIT

Quoted 20 lines

Anyway, patch looks good for me.

Thanks,
Ray

Quoted 13 lines
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +1 -0
+   *(uint32_t *)data = smu_feature_is_enabled(smu,

uvd_bit_mask) ? 1 :

+0;
             *size = 4;
             break;
     case AMDGPU_PP_SENSOR_VCE_POWER:

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