Skip to contentSkip to conversation

drm/amdgpu/pm: remove duplicate check

PATCH In review Alex Deucher 3 participants 6 messages Aug 17, 2020 – Aug 18, 2020

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

PATCH 1/4 drm/amdgpu/pm: remove duplicate check

FAMILY_KV is APUs and we already check for APUs.

---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1 -2
index 5fc6a9a13096..f2e70655e8d9 100644
@@ -3311,8 +3311,7 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj,
 	}
 
 	if (((adev->flags & AMD_IS_APU) ||
-	     adev->family == AMDGPU_FAMILY_SI ||	/* not implemented yet */
-	     adev->family == AMDGPU_FAMILY_KV) &&	/* not implemented yet */
+	     adev->family == AMDGPU_FAMILY_SI) &&	/* not implemented yet */
 	    (attr == &sensor_dev_attr_power1_average.dev_attr.attr ||
 	     attr == &sensor_dev_attr_power1_cap_max.dev_attr.attr ||
 	     attr == &sensor_dev_attr_power1_cap_min.dev_attr.attr||
Signature · 6 lines
2.25.4

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

PATCH 2/4 drm/amdgpu/swsmu: implement voltage metrics for RENOIR

Grab the data from the SMU metrics table.

---
 .../gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c   | 29 +++++++++++++++++++
 1 file changed, 29 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c +29 -0
index 186929c31e9e..ac81f2f605a2 100644
@@ -616,6 +616,27 @@ static int renoir_get_current_activity_percent(struct smu_context *smu,
 	return 0;
 }
 
+static int renoir_get_vddc(struct smu_context *smu, uint32_t *value,
+			   unsigned int index)
+{
+	int ret = 0;
+	SmuMetrics_t metrics;
+
+	if (index >= 2)
+		return -EINVAL;
+
+	if (!value)
+		return -EINVAL;
+
+	ret = smu_cmn_get_metrics_table(smu, &metrics, false);
+	if (ret)
+		return ret;
+
+	*value = metrics.Voltage[index];
+
+	return 0;
+}
+
 /**
  * This interface get dpm clock table for dc
  */
@@ -952,6 +973,14 @@ static int renoir_read_sensor(struct smu_context *smu,
 		*(uint32_t *)data *= 100;
 		*size = 4;
 		break;
+	case AMDGPU_PP_SENSOR_VDDGFX:
+		ret = renoir_get_vddc(smu, (uint32_t *)data, 0);
+		*size = 4;
+		break;
+	case AMDGPU_PP_SENSOR_VDDNB:
+		ret = renoir_get_vddc(smu, (uint32_t *)data, 1);
+		*size = 4;
+		break;
 	default:
 		ret = -EOPNOTSUPP;
 		break;
Signature · 6 lines
2.25.4

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

PATCH 3/4 drm/amdgpu/swsmu: implement power metrics for RENOIR

In reply to Alex Deucher

Grab the data from the SMU metrics table.

---

Can someone with a renoir system verify this?

 .../gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c   | 21 +++++++++++++++++++
 1 file changed, 21 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c +21 -0
index ac81f2f605a2..3b9ac72c7571 100644
@@ -637,6 +637,23 @@ static int renoir_get_vddc(struct smu_context *smu, uint32_t *value,
 	return 0;
 }
 
+static int renoir_get_power(struct smu_context *smu, uint32_t *value)
+{
+	int ret = 0;
+	SmuMetrics_t metrics;
+
+	if (!value)
+		return -EINVAL;
+
+	ret = smu_cmn_get_metrics_table(smu, &metrics, false);
+	if (ret)
+		return ret;
+
+	*value = metrics.CurrentSocketPower << 8;
+
+	return 0;
+}
+
 /**
  * This interface get dpm clock table for dc
  */
@@ -981,6 +998,10 @@ static int renoir_read_sensor(struct smu_context *smu,
 		ret = renoir_get_vddc(smu, (uint32_t *)data, 1);
 		*size = 4;
 		break;
+	case AMDGPU_PP_SENSOR_GPU_POWER:
+		ret = renoir_get_power(smu, (uint32_t *)data);
+		*size = 4;
+		break;
 	default:
 		ret = -EOPNOTSUPP;
 		break;
Signature · 6 lines
2.25.4

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

PATCH 4/4 drm/amdgpu/pm: only hide average power on SI and pre-RENOIR APUs

In reply to Alex Deucher

We can get this on RENOIR and newer via the SMU metrics table.

---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +7 -2
index f2e70655e8d9..a77f7347fdfc 100644
@@ -3312,12 +3312,17 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj,
 
 	if (((adev->flags & AMD_IS_APU) ||
 	     adev->family == AMDGPU_FAMILY_SI) &&	/* not implemented yet */
-	    (attr == &sensor_dev_attr_power1_average.dev_attr.attr ||
-	     attr == &sensor_dev_attr_power1_cap_max.dev_attr.attr ||
+	    (attr == &sensor_dev_attr_power1_cap_max.dev_attr.attr ||
 	     attr == &sensor_dev_attr_power1_cap_min.dev_attr.attr||
 	     attr == &sensor_dev_attr_power1_cap.dev_attr.attr))
 		return 0;
 
+	if (((adev->family == AMDGPU_FAMILY_SI) ||
+	     ((adev->flags & AMD_IS_APU) &&
+	      (adev->asic_type < CHIP_RENOIR))) &&	/* not implemented yet */
+	    (attr == &sensor_dev_attr_power1_average.dev_attr.attr))
+		return 0;
+
 	if (!is_support_sw_smu(adev)) {
 		/* hide max/min values if we can't both query and manage the fan */
 		if ((!adev->powerplay.pp_funcs->set_fan_speed_percent &&
Signature · 6 lines
2.25.4

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

RE: [PATCH 4/4] drm/amdgpu/pm: only hide average power on SI and pre-RENOIR APUs

[AMD Official Use Only - Internal Distribution Only]

Series is reviewed-by: Evan Quan <[email protected]>

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Tuesday, August 18, 2020 3:53 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH 4/4] drm/amdgpu/pm: only hide average power on SI and pre-RENOIR APUs

We can get this on RENOIR and newer via the SMU metrics table.

---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +7 -2
index f2e70655e8d9..a77f7347fdfc 100644
@@ -3312,12 +3312,17 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj,
 
 if (((adev->flags & AMD_IS_APU) ||
      adev->family == AMDGPU_FAMILY_SI) &&/* not implemented yet */
-    (attr == &sensor_dev_attr_power1_average.dev_attr.attr ||
-     attr == &sensor_dev_attr_power1_cap_max.dev_attr.attr ||
+    (attr == &sensor_dev_attr_power1_cap_max.dev_attr.attr ||
      attr == &sensor_dev_attr_power1_cap_min.dev_attr.attr||
      attr == &sensor_dev_attr_power1_cap.dev_attr.attr))
 return 0;
 
+if (((adev->family == AMDGPU_FAMILY_SI) ||
+     ((adev->flags & AMD_IS_APU) &&
+      (adev->asic_type < CHIP_RENOIR))) &&/* not implemented yet */
+    (attr == &sensor_dev_attr_power1_average.dev_attr.attr))
+return 0;
+
 if (!is_support_sw_smu(adev)) {
 /* hide max/min values if we can't both query and manage the fan */
 if ((!adev->powerplay.pp_funcs->set_fan_speed_percent &&

--
2.25.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cevan.quan%40amd.com%7Cc72834b8042146132b1c08d842e7406e%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637332908288049501&amp;sdata=5mKxWVSyQDY1FukBEDZRCQFgP6JYO0foHN9ialkkWik%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#5 lore raw

Re: [PATCH 4/4] drm/amdgpu/pm: only hide average power on SI and pre-RENOIR APUs

In reply to Alex Deucher

Series is Acked-by: Nirmoy Das <[email protected]>

Quoted 22 lines · Alex Deucher

We can get this on RENOIR and newer via the SMU metrics table.

---
  drivers/gpu/drm/amd/pm/amdgpu_pm.c | 9 +++++++--
  1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1 -2
index f2e70655e8d9..a77f7347fdfc 100644
@@ -3312,12 +3312,17 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj,
 
  	if (((adev->flags & AMD_IS_APU) ||
  	     adev->family == AMDGPU_FAMILY_SI) &&	/* not implemented yet */
-	    (attr == &sensor_dev_attr_power1_average.dev_attr.attr ||
-	     attr == &sensor_dev_attr_power1_cap_max.dev_attr.attr ||
+	    (attr == &sensor_dev_attr_power1_cap_max.dev_attr.attr ||
  	     attr == &sensor_dev_attr_power1_cap_min.dev_attr.attr||
  	     attr == &sensor_dev_attr_power1_cap.dev_attr.attr))
  		return 0;

drivers/gpu/drm/amd/pm/amdgpu_pm.c static umode_t hwmon_attributes_visible(struct kobject *kobj, · line 3328

Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +6 -0
 
+	if (((adev->family == AMDGPU_FAMILY_SI) ||
+	     ((adev->flags & AMD_IS_APU) &&
+	      (adev->asic_type < CHIP_RENOIR))) &&	/* not implemented yet */
+	    (attr == &sensor_dev_attr_power1_average.dev_attr.attr))
+		return 0;
+
  	if (!is_support_sw_smu(adev)) {
  		/* hide max/min values if we can't both query and manage the fan */
  		if ((!adev->powerplay.pp_funcs->set_fan_speed_percent &&

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