Skip to contentSkip to conversation

drm/amd/pm: Update pmfw headers for smu_v13_0_12

PATCH In review Asad Kamal 2 participants 6 messages Nov 12, 2025 – Nov 13, 2025

Subsystems (3)
lore
Share & tools
lore

Asad Kamal

author
#0 lore raw

PATCH v2 1/4 drm/amd/pm: Update pmfw headers for smu_v13_0_12

Update pmfw headers for smu_v13_0_12 to include ubb power

---
 .../gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_12_pmfw.h  | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_12_pmfw.h +8 -0
index dd30d96e1ca2..acf7b2f43b0e 100644
@@ -189,6 +189,13 @@ typedef enum {
   SVI_MAX_TEMP_ENTRIES,   // 13
 } SVI_TEMP_e;
 
+typedef enum{
+  SYSTEM_POWER_UBB_POWER,
+  SYSTEM_POWER_UBB_POWER_THRESHOLD,
+  SYSTEM_POWER_MAX_ENTRIES_WO_RESERVED,
+  SYSTEM_POWER_MAX_ENTRIES  = 4
+} SYSTEM_POWER_e;
+
 #define SMU_METRICS_TABLE_VERSION 0x15
 
 #define SMU_SYSTEM_METRICS_TABLE_VERSION 0x1
@@ -310,6 +317,7 @@ typedef struct {
   uint32_t NodePowerLimit;
   uint32_t NodePower;
   uint32_t GlobalPPTResidencyAcc;
+  uint16_t SystemPower[SYSTEM_POWER_MAX_ENTRIES];           // UBB Current Power and Power Threshold
 } SystemMetricsTable_t;
 #pragma pack(pop)
 
Signature · 1 line
2.46.0
author
#1 lore raw

PATCH v2 2/4 drm/amd/pm: Add sysfs node for ubb power

Add sysfs node to expose ubb power limit for smu_v13_0_12

v2: Update sysfs node name to baseboard_power & baseboard_power_limit to make it consistent with other node names (Lijo)

---
 .../gpu/drm/amd/include/kgd_pp_interface.h    |  2 +
 drivers/gpu/drm/amd/pm/amdgpu_pm.c            | 65 ++++++++++++++++++-
 2 files changed, 65 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/include/kgd_pp_interface.h +2 -0
index 2366e68262e6..92477120c28d 100644
@@ -166,6 +166,8 @@ enum amd_pp_sensors {
 	AMDGPU_PP_SENSOR_NODEPOWER,
 	AMDGPU_PP_SENSOR_GPPTRESIDENCY,
 	AMDGPU_PP_SENSOR_MAXNODEPOWERLIMIT,
+	AMDGPU_PP_SENSOR_UBB_POWER,
+	AMDGPU_PP_SENSOR_UBB_POWER_LIMIT,
 };
 
 enum amd_pp_task {
drivers/gpu/drm/amd/pm/amdgpu_pm.c +63 -2

96 lines not on this page · raw message

Signature · 1 line
2.46.0
#2 lore raw

Re: [PATCH v2 2/4] drm/amd/pm: Add sysfs node for ubb power

Quoted 53 lines · Asad Kamal

Add sysfs node to expose ubb power limit for smu_v13_0_12

v2: Update sysfs node name to baseboard_power & baseboard_power_limit to make it consistent with other node names (Lijo)

---
  .../gpu/drm/amd/include/kgd_pp_interface.h    |  2 +
  drivers/gpu/drm/amd/pm/amdgpu_pm.c            | 65 ++++++++++++++++++-
  2 files changed, 65 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/include/kgd_pp_interface.h +2 -0
index 2366e68262e6..92477120c28d 100644
@@ -166,6 +166,8 @@ enum amd_pp_sensors {
  	AMDGPU_PP_SENSOR_NODEPOWER,
  	AMDGPU_PP_SENSOR_GPPTRESIDENCY,
  	AMDGPU_PP_SENSOR_MAXNODEPOWERLIMIT,
+	AMDGPU_PP_SENSOR_UBB_POWER,
+	AMDGPU_PP_SENSOR_UBB_POWER_LIMIT,
  };
 
  enum amd_pp_task {
drivers/gpu/drm/amd/pm/amdgpu_pm.c +7 -2
index d9e37fd6e186..1efa08771361 100644
@@ -2082,9 +2082,10 @@ static int pp_dpm_clk_default_attr_update(struct amdgpu_device *adev, struct amd
   * for user application to monitor various board reated attributes.
   *
   * The amdgpu driver provides a sysfs API for reporting board attributes. Presently,
- * seven types of attributes are reported. Baseboard temperature and
+ * nine types of attributes are reported. Baseboard temperature and
   * gpu board temperature are reported as binary files. Npm status, current node power limit,
- * max node power limit, node power and global ppt residency is reported as ASCII text file.
+ * max node power limit, node power, global ppt residency, baseboard_power, baseboard_power_limit
+ * is reported as ASCII text file.
   *
   * * .. code-block:: console
   *
@@ -2101,6 +2102,10 @@ static int pp_dpm_clk_default_attr_update(struct amdgpu_device *adev, struct amd
   *      hexdump /sys/bus/pci/devices/.../board/node_power
   *
   *      hexdump /sys/bus/pci/devices/.../board/global_ppt_resid
+ *
+ *      hexdump /sys/bus/pci/devices/.../board/baseboard_power
+ *
+ *      hexdump /sys/bus/pci/devices/.../board/baseboard_power_limit
   */
 
  /**

drivers/gpu/drm/amd/pm/amdgpu_pm.c static ssize_t amdgpu_show_max_node_power_limit(struct device *dev, · line 2308

Quoted 9 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +6 -0
@@ -2295,6 +2300,52 @@ static ssize_t amdgpu_show_max_node_power_limit(struct device *dev,
  	return sysfs_emit(buf, "%u\n", max_nplimit);
  }
 
+/**
+ * DOC: baseboard_power
+ *
+ * The amdgpu driver provides a sysfs API for retrieving current ubb power.
+ * The file baseboard_power is used for this.
+ */

Please also update the unit for both (W/kW/mW etc.).

Thanks,
Lijo

Quoted 67 lines
drivers/gpu/drm/amd/pm/amdgpu_pm.c +50 -0
+static ssize_t amdgpu_show_baseboard_power(struct device *dev,
+					   struct device_attribute *attr, char *buf)
+{
+	struct drm_device *ddev = dev_get_drvdata(dev);
+	struct amdgpu_device *adev = drm_to_adev(ddev);
+	u32 ubbpower;
+	int r;
+
+	/* get the node power */
+	r = amdgpu_pm_get_sensor_generic(adev, AMDGPU_PP_SENSOR_UBB_POWER,
+					 (void *)&ubbpower);
+	if (r)
+		return r;
+
+	return sysfs_emit(buf, "%u\n", ubbpower);
+}
+
+/**
+ * DOC: baseboard_power_limit
+ *
+ * The amdgpu driver provides a sysfs API for retrieving threshold ubb power.
+ * The file baseboard_power_limit is used for this.
+ */
+static ssize_t amdgpu_show_baseboard_power_limit(struct device *dev,
+						 struct device_attribute *attr, char *buf)
+{
+	struct drm_device *ddev = dev_get_drvdata(dev);
+	struct amdgpu_device *adev = drm_to_adev(ddev);
+	u32 ubbpowerlimit;
+	int r;
+
+	/* get the node power */
+	r = amdgpu_pm_get_sensor_generic(adev, AMDGPU_PP_SENSOR_UBB_POWER_LIMIT,
+					 (void *)&ubbpowerlimit);
+	if (r)
+		return r;
+
+	return sysfs_emit(buf, "%u\n", ubbpowerlimit);
+}
+
  static DEVICE_ATTR(baseboard_temp, 0444, amdgpu_get_baseboard_temp_metrics, NULL);
  static DEVICE_ATTR(gpuboard_temp, 0444, amdgpu_get_gpuboard_temp_metrics, NULL);
  static DEVICE_ATTR(cur_node_power_limit, 0444, amdgpu_show_cur_node_power_limit, NULL);
@@ -2302,6 +2353,8 @@ static DEVICE_ATTR(node_power, 0444, amdgpu_show_node_power, NULL);
  static DEVICE_ATTR(global_ppt_resid, 0444, amdgpu_show_global_ppt_resid, NULL);
  static DEVICE_ATTR(max_node_power_limit, 0444, amdgpu_show_max_node_power_limit, NULL);
  static DEVICE_ATTR(npm_status, 0444, amdgpu_show_npm_status, NULL);
+static DEVICE_ATTR(baseboard_power, 0444, amdgpu_show_baseboard_power, NULL);
+static DEVICE_ATTR(baseboard_power_limit, 0444, amdgpu_show_baseboard_power_limit, NULL);
 
  static struct attribute *board_attrs[] = {
  	&dev_attr_baseboard_temp.attr,
@@ -4748,6 +4801,14 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)
  			sysfs_add_file_to_group(&adev->dev->kobj, &dev_attr_npm_status.attr,
  						amdgpu_board_attr_group.name);
  		}
+		if (amdgpu_pm_get_sensor_generic(adev, AMDGPU_PP_SENSOR_UBB_POWER_LIMIT,
+						 (void *)&tmp) != -EOPNOTSUPP) {
+			sysfs_add_file_to_group(&adev->dev->kobj,
+						&dev_attr_baseboard_power_limit.attr,
+						amdgpu_board_attr_group.name);
+			sysfs_add_file_to_group(&adev->dev->kobj, &dev_attr_baseboard_power.attr,
+						amdgpu_board_attr_group.name);
+		}
  	}
 
  	adev->pm.sysfs_initialized = true;
author
#3 lore raw

PATCH v2 3/4 drm/amd/pm: Fetch ubb power for smu_v13_0_12

In reply to Asad Kamal

Feth ubb power from system metrics table for smu_v13_0_12

---
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_12_ppt.c | 34 +++++++++++++++++++
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c  |  7 ++++
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.h  |  4 +++
 3 files changed, 45 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_12_ppt.c +34 -0
index 9e635f733fbf..07bee1f32f54 100644
@@ -601,6 +601,40 @@ static bool smu_v13_0_12_is_temp_metrics_supported(struct smu_context *smu,
 	return false;
 }
 
+int smu_v13_0_12_get_system_power(struct smu_context *smu,
+				  enum amd_pp_sensors sensor,
+				  uint32_t *value)
+{
+	struct smu_table_context *smu_table = &smu->smu_table;
+	struct smu_table *tables = smu_table->tables;
+	SystemMetricsTable_t *metrics;
+	struct smu_table *sys_table;
+	int ret;
+
+	if (!smu_v13_0_6_cap_supported(smu, SMU_CAP(SYSTEM_POWER_METRICS)))
+		return -EOPNOTSUPP;
+
+	ret = smu_v13_0_12_get_system_metrics_table(smu);
+	if (ret)
+		return ret;
+
+	sys_table = &tables[SMU_TABLE_PMFW_SYSTEM_METRICS];
+	metrics = (SystemMetricsTable_t *)sys_table->cache.buffer;
+
+	switch (sensor) {
+	case AMDGPU_PP_SENSOR_UBB_POWER:
+		*value = metrics->SystemPower[SYSTEM_POWER_UBB_POWER];
+		break;
+	case AMDGPU_PP_SENSOR_UBB_POWER_LIMIT:
+		*value = metrics->SystemPower[SYSTEM_POWER_UBB_POWER_THRESHOLD];
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	return ret;
+}
+
 int smu_v13_0_12_get_npm_data(struct smu_context *smu,
 			      enum amd_pp_sensors sensor,
 			      uint32_t *value)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +7 -0
index 44e1cd821eec..2fefd258bc0e 100644
@@ -1860,6 +1860,13 @@ static int smu_v13_0_6_read_sensor(struct smu_context *smu,
 			return ret;
 		*size = 4;
 		break;
+	case AMDGPU_PP_SENSOR_UBB_POWER:
+	case AMDGPU_PP_SENSOR_UBB_POWER_LIMIT:
+		ret = smu_v13_0_12_get_system_power(smu, sensor, (uint32_t *)data);
+		if (ret)
+			return ret;
+		*size = 4;
+		break;
 	case AMDGPU_PP_SENSOR_GPU_AVG_POWER:
 	default:
 		ret = -EOPNOTSUPP;
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.h +4 -0
index 6cbdd7c5ded9..0588a5aa952d 100644
@@ -77,6 +77,7 @@ enum smu_v13_0_6_caps {
 	SMU_CAP(NPM_METRICS),
 	SMU_CAP(RAS_EEPROM),
 	SMU_CAP(FAST_PPT),
+	SMU_CAP(SYSTEM_POWER_METRICS),
 	SMU_CAP(ALL),
 };
 
@@ -107,6 +108,9 @@ void smu_v13_0_12_tables_fini(struct smu_context *smu);
 int smu_v13_0_12_get_npm_data(struct smu_context *smu,
 			      enum amd_pp_sensors sensor,
 			      uint32_t *value);
+int smu_v13_0_12_get_system_power(struct smu_context *smu,
+				  enum amd_pp_sensors sensor,
+				  uint32_t *value);
 extern const struct cmn2asic_mapping smu_v13_0_12_feature_mask_map[];
 extern const struct cmn2asic_msg_mapping smu_v13_0_12_message_map[];
 extern const struct smu_temp_funcs smu_v13_0_12_temp_funcs;
Signature · 1 line
2.46.0
author
#4 lore raw

PATCH v2 4/4 drm/amd/pm: Enable system power caps for smu_v13_0_12

In reply to Asad Kamal

Enable system power caps to fetch system power and threshold for smu_v13_0_12

---
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +4 -1
index 2fefd258bc0e..a3ceecbe5d68 100644
@@ -356,8 +356,11 @@ static void smu_v13_0_12_init_caps(struct smu_context *smu)
 	if (fw_ver > 0x04560900)
 		smu_v13_0_6_cap_set(smu, SMU_CAP(VCN_RESET));
 
-	if (fw_ver >= 0x04560D00)
+	if (fw_ver >= 0x04560D00) {
 		smu_v13_0_6_cap_set(smu, SMU_CAP(FAST_PPT));
+		if (smu->adev->gmc.xgmi.physical_node_id == 0)
+			smu_v13_0_6_cap_set(smu, SMU_CAP(SYSTEM_POWER_METRICS));
+	}
 
 	if (fw_ver >= 0x04560700) {
 		if (fw_ver >= 0x04560900) {
Signature · 1 line
2.46.0
Reviewed-by on v2 4/4
#5 lore raw

Re: [PATCH v2 4/4] drm/amd/pm: Enable system power caps for smu_v13_0_12

Quoted 4 lines · Asad Kamal

Enable system power caps to fetch system power and threshold for smu_v13_0_12

Please update the unit in documentation before submitting.

With that, series is -

Thanks,
Lijo

Quoted 21 lines
---
  drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +4 -1
index 2fefd258bc0e..a3ceecbe5d68 100644
@@ -356,8 +356,11 @@ static void smu_v13_0_12_init_caps(struct smu_context *smu)
  	if (fw_ver > 0x04560900)
  		smu_v13_0_6_cap_set(smu, SMU_CAP(VCN_RESET));
 
-	if (fw_ver >= 0x04560D00)
+	if (fw_ver >= 0x04560D00) {
  		smu_v13_0_6_cap_set(smu, SMU_CAP(FAST_PPT));
+		if (smu->adev->gmc.xgmi.physical_node_id == 0)
+			smu_v13_0_6_cap_set(smu, SMU_CAP(SYSTEM_POWER_METRICS));
+	}
 
  	if (fw_ver >= 0x04560700) {
  		if (fw_ver >= 0x04560900) {