Skip to contentSkip to conversation

A new set of Linux OD interfaces

PATCH Superseded Evan Quan 2 participants 11 messages Aug 15, 2023 – Aug 21, 2023

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Evan Quan

author
#0 lore raw

cover A new set of Linux OD interfaces

The existing OD interface pp_od_clk_voltage is unable to meet the growing demands for more OD functionalities. Since the buf used within it comes with size limit as one page. With more OD functionalities added, we will hit that limit soon.

To better meet the growing demainds, a new set of OD interfaces are designed. With this new design, there will be multiple interfaces exposed with each representing a single OD functionality. And all those interfaces will be arranged in a tree liked hierarchy as below. Meanwhile all functionalities for the same component will be arranged under the same directory.

gpu_od/

├── fan_ctrl
    ├── acoustic_limit_rpm_threshold
    ├── acoustic_target_rpm_threshold
    ├── fan_curve
    ├── fan_minimum_pwm
    ├── fan_mode
    ├── fan_target_temperature

...
...(more to be added)

Evan Quan (8):
drm/amd/pm: introduce a new set of OD interfaces drm/amdgpu: revise the device initialization sequences drm/amd/pm: add fan mode OD setting support for SMU13 drm/amd/pm: add fan temperature/pwm curve OD setting support for SMU13 drm/amd/pm: add fan acoustic limit OD setting support for SMU13 drm/amd/pm: add fan acoustic target OD setting support for SMU13 drm/amd/pm: add fan target temperature OD setting support for SMU13 drm/amd/pm: add fan minimum pwm OD setting support for SMU13

 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c    |  39 +-
 .../gpu/drm/amd/include/kgd_pp_interface.h    |  14 +-
 drivers/gpu/drm/amd/pm/amdgpu_pm.c            | 676 +++++++++++++++++-
 drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h       |  16 +
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     |  12 +
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h  |   6 +
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c  | 316 +++++++-
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c  | 316 +++++++-
 8 files changed, 1370 insertions(+), 25 deletions(-)
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 1/8 drm/amd/pm: introduce a new set of OD interfaces

There will be multiple interfaces(sysfs files) exposed with each representing a single OD functionality. And all those interface will be arranged in a tree liked hierarchy with the top dir as "gpu_od". Meanwhile all functionalities for the same component will be arranged under the same directory.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |   2 +
 drivers/gpu/drm/amd/pm/amdgpu_pm.c         | 264 ++++++++++++++++++++-
 drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h    |   2 +
 3 files changed, 266 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -0
index 6809bf7dae57..77eb18447e82 100644
@@ -3622,6 +3622,8 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 
 	INIT_LIST_HEAD(&adev->ras_list);
 
+	INIT_LIST_HEAD(&adev->pm.od_kobj_list);
+
 	INIT_DELAYED_WORK(&adev->delayed_init_work,
 			  amdgpu_device_delayed_init_work_handler);
 	INIT_DELAYED_WORK(&adev->gfx.gfx_off_delay_work,
drivers/gpu/drm/amd/pm/amdgpu_pm.c +262 -2

293 lines not on this page · raw message

drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h +2 -0
index 42172b00be66..4cab6a2efb63 100644
@@ -366,6 +366,8 @@ struct amdgpu_pm {
 	struct config_table_setting config_table;
 	/* runtime mode */
 	enum amdgpu_runpm_mode rpm_mode;
+
+	struct list_head	od_kobj_list;
 };
 
 int amdgpu_dpm_read_sensor(struct amdgpu_device *adev, enum amd_pp_sensors sensor,
Signature · 1 line
2.34.1
author
#2 lore raw

PATCH 2/8 drm/amdgpu: revise the device initialization sequences

In reply to Evan Quan

By placing the sysfs interfaces creation after .late_int. Since some operations performed during .late_init may affect how the sysfs interfaces should be created.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 37 ++++++++++++----------
 1 file changed, 21 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +21 -16
index 77eb18447e82..b1accf5c1982 100644
@@ -3860,22 +3860,6 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 	/* Get a log2 for easy divisions. */
 	adev->mm_stats.log2_max_MBps = ilog2(max(1u, max_MBps));
 
-	r = amdgpu_atombios_sysfs_init(adev);
-	if (r)
-		drm_err(&adev->ddev,
-			"registering atombios sysfs failed (%d).\n", r);
-
-	r = amdgpu_pm_sysfs_init(adev);
-	if (r)
-		DRM_ERROR("registering pm sysfs failed (%d).\n", r);
-
-	r = amdgpu_ucode_sysfs_init(adev);
-	if (r) {
-		adev->ucode_sysfs_en = false;
-		DRM_ERROR("Creating firmware sysfs failed (%d).\n", r);
-	} else
-		adev->ucode_sysfs_en = true;
-
 	/*
 	 * Register gpu instance before amdgpu_device_enable_mgpu_fan_boost.
 	 * Otherwise the mgpu fan boost feature will be skipped due to the
@@ -3904,6 +3888,27 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 		flush_delayed_work(&adev->delayed_init_work);
 	}
 
+	/*
+	 * Place those sysfs registering after `late_init`. As some of those
+	 * operations performed in `late_init` might affect the sysfs
+	 * interfaces creating.
+	 */
+	r = amdgpu_atombios_sysfs_init(adev);
+	if (r)
+		drm_err(&adev->ddev,
+			"registering atombios sysfs failed (%d).\n", r);
+
+	r = amdgpu_pm_sysfs_init(adev);
+	if (r)
+		DRM_ERROR("registering pm sysfs failed (%d).\n", r);
+
+	r = amdgpu_ucode_sysfs_init(adev);
+	if (r) {
+		adev->ucode_sysfs_en = false;
+		DRM_ERROR("Creating firmware sysfs failed (%d).\n", r);
+	} else
+		adev->ucode_sysfs_en = true;
+
 	r = sysfs_create_files(&adev->dev->kobj, amdgpu_dev_attributes);
 	if (r)
 		dev_err(adev->dev, "Could not create amdgpu device attr\n");
Signature · 1 line
2.34.1
author
#3 lore raw

PATCH 3/8 drm/amd/pm: add fan mode OD setting support for SMU13

In reply to Evan Quan

Add SMU13 fan mode OD setting support.

---
 .../gpu/drm/amd/include/kgd_pp_interface.h    |   4 +-
 drivers/gpu/drm/amd/pm/amdgpu_pm.c            | 189 +++++++++++++++++-
 drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h       |   4 +
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     |   2 +
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h  |   1 +
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c  |  35 +++-
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c  |  35 +++-
 7 files changed, 262 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/include/kgd_pp_interface.h +3 -1
index 90989405eddc..d51c639a3f31 100644
@@ -113,6 +113,7 @@ enum pp_clock_type {
 	OD_RANGE,
 	OD_VDDGFX_OFFSET,
 	OD_CCLK,
+	OD_FAN_MODE,
 };
 
 enum amd_pp_sensors {
@@ -185,7 +186,8 @@ enum PP_OD_DPM_TABLE_COMMAND {
 	PP_OD_EDIT_VDDC_CURVE,
 	PP_OD_RESTORE_DEFAULT_TABLE,
 	PP_OD_COMMIT_DPM_TABLE,
-	PP_OD_EDIT_VDDGFX_OFFSET
+	PP_OD_EDIT_VDDGFX_OFFSET,
+	PP_OD_EDIT_FAN_MODE,
 };
 
 struct pp_states_info {
drivers/gpu/drm/amd/pm/amdgpu_pm.c +188 -1

195 lines not on this page · raw message

drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h +4 -0
index 4cab6a2efb63..b54f84e2408a 100644
@@ -314,6 +314,9 @@ struct config_table_setting
 	uint16_t fclk_average_tau;
 };
 
+#define OD_OPS_SUPPORT_FAN_MODE_RETRIEVE		BIT(0)
+#define OD_OPS_SUPPORT_FAN_MODE_SET			BIT(1)
+
 struct amdgpu_pm {
 	struct mutex		mutex;
 	u32                     current_sclk;
@@ -368,6 +371,7 @@ struct amdgpu_pm {
 	enum amdgpu_runpm_mode rpm_mode;
 
 	struct list_head	od_kobj_list;
+	uint32_t		od_feature_mask;
 };
 
 int amdgpu_dpm_read_sensor(struct amdgpu_device *adev, enum amd_pp_sensors sensor,
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -0
index f005a90c35af..01ccfd219d6b 100644
@@ -2481,6 +2481,8 @@ static enum smu_clk_type smu_convert_to_smuclk(enum pp_clock_type type)
 		clk_type = SMU_OD_VDDGFX_OFFSET; break;
 	case OD_CCLK:
 		clk_type = SMU_OD_CCLK; break;
+	case OD_FAN_MODE:
+		clk_type = SMU_OD_FAN_MODE; break;
 	default:
 		clk_type = SMU_CLK_COUNT; break;
 	}
drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h +1 -0
index 297b70b9388f..f37de1df8291 100644
@@ -278,6 +278,7 @@ enum smu_clk_type {
 	SMU_OD_VDDC_CURVE,
 	SMU_OD_RANGE,
 	SMU_OD_VDDGFX_OFFSET,
+	SMU_OD_FAN_MODE,
 	SMU_CLK_COUNT,
 };
 
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +32 -3
index 30d9320e4b8c..19406fa001d5 100644
@@ -101,6 +101,7 @@
 #define PP_OD_FEATURE_UCLK_FMIN				2
 #define PP_OD_FEATURE_UCLK_FMAX				3
 #define PP_OD_FEATURE_GFX_VF_CURVE			4
+#define PP_OD_FEATURE_FAN_MODE				5
 
 static struct cmn2asic_msg_mapping smu_v13_0_0_message_map[SMU_MSG_MAX_COUNT] = {
 	MSG_MAP(TestMessage,			PPSMC_MSG_TestMessage,                 1),
@@ -1083,6 +1084,10 @@ static void smu_v13_0_0_get_od_setting_limits(struct smu_context *smu,
 		od_min_setting = overdrive_lowerlimits->VoltageOffsetPerZoneBoundary;
 		od_max_setting = overdrive_upperlimits->VoltageOffsetPerZoneBoundary;
 		break;
+	case PP_OD_FEATURE_FAN_MODE:
+		od_min_setting = overdrive_lowerlimits->FanMode;
+		od_max_setting = overdrive_upperlimits->FanMode;
+		break;
 	default:
 		od_min_setting = od_max_setting = INT_MAX;
 		break;
@@ -1300,6 +1305,16 @@ static int smu_v13_0_0_print_clk_levels(struct smu_context *smu,
 						od_table->OverDriveTable.VoltageOffsetPerZoneBoundary[i]);
 		break;
 
+	case SMU_OD_FAN_MODE:
+		if (!smu_v13_0_0_is_od_feature_supported(smu,
+							 PP_OD_FEATURE_FAN_CURVE_BIT))
+			break;
+
+		size += sysfs_emit_at(buf, size, "OD_FAN_MODE:\n");
+		size += sysfs_emit_at(buf, size, "%d\n",
+					(int)od_table->OverDriveTable.FanMode);
+		break;
+
 	case SMU_OD_RANGE:
 		if (!smu_v13_0_0_is_od_feature_supported(smu, PP_OD_FEATURE_GFXCLK_BIT) &&
 		    !smu_v13_0_0_is_od_feature_supported(smu, PP_OD_FEATURE_UCLK_BIT) &&
@@ -1760,6 +1775,15 @@ static ssize_t smu_v13_0_0_get_gpu_metrics(struct smu_context *smu,
 	return sizeof(struct gpu_metrics_v1_3);
 }
 
+static void smu_v13_0_0_set_supported_od_feature_mask(struct smu_context *smu)
+{
+	struct amdgpu_device *adev = smu->adev;
+
+	if (smu_v13_0_0_is_od_feature_supported(smu,
+						PP_OD_FEATURE_FAN_CURVE_BIT))
+		adev->pm.od_feature_mask |= OD_OPS_SUPPORT_FAN_MODE_RETRIEVE;
+}
+
 static int smu_v13_0_0_set_default_od_settings(struct smu_context *smu)
 {
 	OverDriveTableExternal_t *od_table =
@@ -1809,8 +1833,12 @@ static int smu_v13_0_0_set_default_od_settings(struct smu_context *smu)
 		for (i = 0; i < PP_NUM_OD_VF_CURVE_POINTS; i++)
 			user_od_table->OverDriveTable.VoltageOffsetPerZoneBoundary[i] =
 				user_od_table_bak.OverDriveTable.VoltageOffsetPerZoneBoundary[i];
+		user_od_table->OverDriveTable.FanMode =
+			user_od_table_bak.OverDriveTable.FanMode;
 	}
 
+	smu_v13_0_0_set_supported_od_feature_mask(smu);
+
 	return 0;
 }
 
@@ -1821,9 +1849,10 @@ static int smu_v13_0_0_restore_user_od_settings(struct smu_context *smu)
 	OverDriveTableExternal_t *user_od_table = table_context->user_overdrive_table;
 	int res;
 
-	user_od_table->OverDriveTable.FeatureCtrlMask = 1U << PP_OD_FEATURE_GFXCLK_BIT |
-							1U << PP_OD_FEATURE_UCLK_BIT |
-							1U << PP_OD_FEATURE_GFX_VF_CURVE_BIT;
+	user_od_table->OverDriveTable.FeatureCtrlMask = BIT(PP_OD_FEATURE_GFXCLK_BIT) |
+							BIT(PP_OD_FEATURE_UCLK_BIT) |
+							BIT(PP_OD_FEATURE_GFX_VF_CURVE_BIT) |
+							BIT(PP_OD_FEATURE_FAN_CURVE_BIT);
 	res = smu_v13_0_0_upload_overdrive_table(smu, user_od_table);
 	user_od_table->OverDriveTable.FeatureCtrlMask = 0;
 	if (res == 0)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +32 -3
index 6b68822b8209..7db8a1e2c640 100644
@@ -77,6 +77,7 @@
 #define PP_OD_FEATURE_UCLK_FMIN				2
 #define PP_OD_FEATURE_UCLK_FMAX				3
 #define PP_OD_FEATURE_GFX_VF_CURVE			4
+#define PP_OD_FEATURE_FAN_MODE				5
 
 static struct cmn2asic_msg_mapping smu_v13_0_7_message_map[SMU_MSG_MAX_COUNT] = {
 	MSG_MAP(TestMessage,			PPSMC_MSG_TestMessage,                 1),
@@ -1070,6 +1071,10 @@ static void smu_v13_0_7_get_od_setting_limits(struct smu_context *smu,
 		od_min_setting = overdrive_lowerlimits->VoltageOffsetPerZoneBoundary;
 		od_max_setting = overdrive_upperlimits->VoltageOffsetPerZoneBoundary;
 		break;
+	case PP_OD_FEATURE_FAN_MODE:
+		od_min_setting = overdrive_lowerlimits->FanMode;
+		od_max_setting = overdrive_upperlimits->FanMode;
+		break;
 	default:
 		od_min_setting = od_max_setting = INT_MAX;
 		break;
@@ -1287,6 +1292,16 @@ static int smu_v13_0_7_print_clk_levels(struct smu_context *smu,
 						od_table->OverDriveTable.VoltageOffsetPerZoneBoundary[i]);
 		break;
 
+	case SMU_OD_FAN_MODE:
+		if (!smu_v13_0_7_is_od_feature_supported(smu,
+							 PP_OD_FEATURE_FAN_CURVE_BIT))
+			break;
+
+		size += sysfs_emit_at(buf, size, "OD_FAN_MODE:\n");
+		size += sysfs_emit_at(buf, size, "%d\n",
+					(int)od_table->OverDriveTable.FanMode);
+		break;
+
 	case SMU_OD_RANGE:
 		if (!smu_v13_0_7_is_od_feature_supported(smu, PP_OD_FEATURE_GFXCLK_BIT) &&
 		    !smu_v13_0_7_is_od_feature_supported(smu, PP_OD_FEATURE_UCLK_BIT) &&
@@ -1742,6 +1757,15 @@ static ssize_t smu_v13_0_7_get_gpu_metrics(struct smu_context *smu,
 	return sizeof(struct gpu_metrics_v1_3);
 }
 
+static void smu_v13_0_7_set_supported_od_feature_mask(struct smu_context *smu)
+{
+	struct amdgpu_device *adev = smu->adev;
+
+	if (smu_v13_0_7_is_od_feature_supported(smu,
+						PP_OD_FEATURE_FAN_CURVE_BIT))
+		adev->pm.od_feature_mask |= OD_OPS_SUPPORT_FAN_MODE_RETRIEVE;
+}
+
 static int smu_v13_0_7_set_default_od_settings(struct smu_context *smu)
 {
 	OverDriveTableExternal_t *od_table =
@@ -1791,8 +1815,12 @@ static int smu_v13_0_7_set_default_od_settings(struct smu_context *smu)
 		for (i = 0; i < PP_NUM_OD_VF_CURVE_POINTS; i++)
 			user_od_table->OverDriveTable.VoltageOffsetPerZoneBoundary[i] =
 				user_od_table_bak.OverDriveTable.VoltageOffsetPerZoneBoundary[i];
+		user_od_table->OverDriveTable.FanMode =
+			user_od_table_bak.OverDriveTable.FanMode;
 	}
 
+	smu_v13_0_7_set_supported_od_feature_mask(smu);
+
 	return 0;
 }
 
@@ -1803,9 +1831,10 @@ static int smu_v13_0_7_restore_user_od_settings(struct smu_context *smu)
 	OverDriveTableExternal_t *user_od_table = table_context->user_overdrive_table;
 	int res;
 
-	user_od_table->OverDriveTable.FeatureCtrlMask = 1U << PP_OD_FEATURE_GFXCLK_BIT |
-							1U << PP_OD_FEATURE_UCLK_BIT |
-							1U << PP_OD_FEATURE_GFX_VF_CURVE_BIT;
+	user_od_table->OverDriveTable.FeatureCtrlMask = BIT(PP_OD_FEATURE_GFXCLK_BIT) |
+							BIT(PP_OD_FEATURE_UCLK_BIT) |
+							BIT(PP_OD_FEATURE_GFX_VF_CURVE_BIT) |
+							BIT(PP_OD_FEATURE_FAN_CURVE_BIT);
 	res = smu_v13_0_7_upload_overdrive_table(smu, user_od_table);
 	user_od_table->OverDriveTable.FeatureCtrlMask = 0;
 	if (res == 0)
Signature · 1 line
2.34.1
author
#4 lore raw

PATCH 4/8 drm/amd/pm: add fan temperature/pwm curve OD setting support for SMU13

In reply to Evan Quan

Add SMU13 fan temperature/pwm curve OD setting support.

---
 .../gpu/drm/amd/include/kgd_pp_interface.h    |  2 +
 drivers/gpu/drm/amd/pm/amdgpu_pm.c            | 45 ++++++++++
 drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h       |  2 +
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     |  2 +
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h  |  1 +
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c  | 87 ++++++++++++++++++-
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c  | 87 ++++++++++++++++++-
 7 files changed, 224 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/include/kgd_pp_interface.h +2 -0
index d51c639a3f31..3743777b45cb 100644
@@ -114,6 +114,7 @@ enum pp_clock_type {
 	OD_VDDGFX_OFFSET,
 	OD_CCLK,
 	OD_FAN_MODE,
+	OD_FAN_CURVE,
 };
 
 enum amd_pp_sensors {
@@ -188,6 +189,7 @@ enum PP_OD_DPM_TABLE_COMMAND {
 	PP_OD_COMMIT_DPM_TABLE,
 	PP_OD_EDIT_VDDGFX_OFFSET,
 	PP_OD_EDIT_FAN_MODE,
+	PP_OD_EDIT_FAN_CURVE,
 };
 
 struct pp_states_info {
drivers/gpu/drm/amd/pm/amdgpu_pm.c +45 -0

57 lines not on this page · raw message

drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h +2 -0
index b54f84e2408a..4463c60b710a 100644
@@ -316,6 +316,8 @@ struct config_table_setting
 
 #define OD_OPS_SUPPORT_FAN_MODE_RETRIEVE		BIT(0)
 #define OD_OPS_SUPPORT_FAN_MODE_SET			BIT(1)
+#define OD_OPS_SUPPORT_FAN_CURVE_RETRIEVE		BIT(2)
+#define OD_OPS_SUPPORT_FAN_CURVE_SET			BIT(3)
 
 struct amdgpu_pm {
 	struct mutex		mutex;
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -0
index 01ccfd219d6b..fe998df9dca2 100644
@@ -2483,6 +2483,8 @@ static enum smu_clk_type smu_convert_to_smuclk(enum pp_clock_type type)
 		clk_type = SMU_OD_CCLK; break;
 	case OD_FAN_MODE:
 		clk_type = SMU_OD_FAN_MODE; break;
+	case OD_FAN_CURVE:
+		clk_type = SMU_OD_FAN_CURVE; break;
 	default:
 		clk_type = SMU_CLK_COUNT; break;
 	}
drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h +1 -0
index f37de1df8291..dc5f6e166907 100644
@@ -279,6 +279,7 @@ enum smu_clk_type {
 	SMU_OD_RANGE,
 	SMU_OD_VDDGFX_OFFSET,
 	SMU_OD_FAN_MODE,
+	SMU_OD_FAN_CURVE,
 	SMU_CLK_COUNT,
 };
 
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +86 -1

123 lines not on this page · raw message

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +86 -1

123 lines not on this page · raw message

Signature · 1 line
2.34.1
author
#5 lore raw

PATCH 5/8 drm/amd/pm: add fan acoustic limit OD setting support for SMU13

In reply to Evan Quan

Add SMU13 fan acoustic limit OD setting support.

---
 .../gpu/drm/amd/include/kgd_pp_interface.h    |  2 +
 drivers/gpu/drm/amd/pm/amdgpu_pm.c            | 45 ++++++++++++++++
 drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h       |  2 +
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     |  2 +
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h  |  1 +
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c  | 51 ++++++++++++++++++-
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c  | 51 ++++++++++++++++++-
 7 files changed, 152 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/include/kgd_pp_interface.h +2 -0
index 3743777b45cb..aa07c5d0d3c9 100644
@@ -115,6 +115,7 @@ enum pp_clock_type {
 	OD_CCLK,
 	OD_FAN_MODE,
 	OD_FAN_CURVE,
+	OD_ACOUSTIC_LIMIT,
 };
 
 enum amd_pp_sensors {
@@ -190,6 +191,7 @@ enum PP_OD_DPM_TABLE_COMMAND {
 	PP_OD_EDIT_VDDGFX_OFFSET,
 	PP_OD_EDIT_FAN_MODE,
 	PP_OD_EDIT_FAN_CURVE,
+	PP_OD_EDIT_ACOUSTIC_LIMIT,
 };
 
 struct pp_states_info {
drivers/gpu/drm/amd/pm/amdgpu_pm.c +45 -0

57 lines not on this page · raw message

drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h +2 -0
index 4463c60b710a..17ffcef34e61 100644
@@ -318,6 +318,8 @@ struct config_table_setting
 #define OD_OPS_SUPPORT_FAN_MODE_SET			BIT(1)
 #define OD_OPS_SUPPORT_FAN_CURVE_RETRIEVE		BIT(2)
 #define OD_OPS_SUPPORT_FAN_CURVE_SET			BIT(3)
+#define OD_OPS_SUPPORT_ACOUSTIC_LIMIT_THRESHOLD_RETRIEVE	BIT(4)
+#define OD_OPS_SUPPORT_ACOUSTIC_LIMIT_THRESHOLD_SET		BIT(5)
 
 struct amdgpu_pm {
 	struct mutex		mutex;
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -0
index fe998df9dca2..3db6bd49b73c 100644
@@ -2485,6 +2485,8 @@ static enum smu_clk_type smu_convert_to_smuclk(enum pp_clock_type type)
 		clk_type = SMU_OD_FAN_MODE; break;
 	case OD_FAN_CURVE:
 		clk_type = SMU_OD_FAN_CURVE; break;
+	case OD_ACOUSTIC_LIMIT:
+		clk_type = SMU_OD_ACOUSTIC_LIMIT; break;
 	default:
 		clk_type = SMU_CLK_COUNT; break;
 	}
drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h +1 -0
index dc5f6e166907..63fe6f2882cf 100644
@@ -280,6 +280,7 @@ enum smu_clk_type {
 	SMU_OD_VDDGFX_OFFSET,
 	SMU_OD_FAN_MODE,
 	SMU_OD_FAN_CURVE,
+	SMU_OD_ACOUSTIC_LIMIT,
 	SMU_CLK_COUNT,
 };
 
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +50 -1

87 lines not on this page · raw message

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +50 -1

87 lines not on this page · raw message

Signature · 1 line
2.34.1
author
#6 lore raw

PATCH 6/8 drm/amd/pm: add fan acoustic target OD setting support for SMU13

In reply to Evan Quan

Add SMU13 fan acoustic target OD setting support.

---
 .../gpu/drm/amd/include/kgd_pp_interface.h    |  2 +
 drivers/gpu/drm/amd/pm/amdgpu_pm.c            | 45 ++++++++++++++++
 drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h       |  2 +
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     |  2 +
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h  |  1 +
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c  | 51 ++++++++++++++++++-
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c  | 51 ++++++++++++++++++-
 7 files changed, 152 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/include/kgd_pp_interface.h +2 -0
index aa07c5d0d3c9..06ed73a6b5f3 100644
@@ -116,6 +116,7 @@ enum pp_clock_type {
 	OD_FAN_MODE,
 	OD_FAN_CURVE,
 	OD_ACOUSTIC_LIMIT,
+	OD_ACOUSTIC_TARGET,
 };
 
 enum amd_pp_sensors {
@@ -192,6 +193,7 @@ enum PP_OD_DPM_TABLE_COMMAND {
 	PP_OD_EDIT_FAN_MODE,
 	PP_OD_EDIT_FAN_CURVE,
 	PP_OD_EDIT_ACOUSTIC_LIMIT,
+	PP_OD_EDIT_ACOUSTIC_TARGET,
 };
 
 struct pp_states_info {
drivers/gpu/drm/amd/pm/amdgpu_pm.c +45 -0

57 lines not on this page · raw message

drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h +2 -0
index 17ffcef34e61..6b2bbd13db09 100644
@@ -320,6 +320,8 @@ struct config_table_setting
 #define OD_OPS_SUPPORT_FAN_CURVE_SET			BIT(3)
 #define OD_OPS_SUPPORT_ACOUSTIC_LIMIT_THRESHOLD_RETRIEVE	BIT(4)
 #define OD_OPS_SUPPORT_ACOUSTIC_LIMIT_THRESHOLD_SET		BIT(5)
+#define OD_OPS_SUPPORT_ACOUSTIC_TARGET_THRESHOLD_RETRIEVE	BIT(6)
+#define OD_OPS_SUPPORT_ACOUSTIC_TARGET_THRESHOLD_SET		BIT(7)
 
 struct amdgpu_pm {
 	struct mutex		mutex;
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -0
index 3db6bd49b73c..3bfa9b9bb247 100644
@@ -2487,6 +2487,8 @@ static enum smu_clk_type smu_convert_to_smuclk(enum pp_clock_type type)
 		clk_type = SMU_OD_FAN_CURVE; break;
 	case OD_ACOUSTIC_LIMIT:
 		clk_type = SMU_OD_ACOUSTIC_LIMIT; break;
+	case OD_ACOUSTIC_TARGET:
+		clk_type = SMU_OD_ACOUSTIC_TARGET; break;
 	default:
 		clk_type = SMU_CLK_COUNT; break;
 	}
drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h +1 -0
index 63fe6f2882cf..1463a5d41647 100644
@@ -281,6 +281,7 @@ enum smu_clk_type {
 	SMU_OD_FAN_MODE,
 	SMU_OD_FAN_CURVE,
 	SMU_OD_ACOUSTIC_LIMIT,
+	SMU_OD_ACOUSTIC_TARGET,
 	SMU_CLK_COUNT,
 };
 
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +50 -1

87 lines not on this page · raw message

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +50 -1

87 lines not on this page · raw message

Signature · 1 line
2.34.1
author
#7 lore raw

PATCH 7/8 drm/amd/pm: add fan target temperature OD setting support for SMU13

In reply to Evan Quan

Add SMU13 fan target temperature OD setting support.

---
 .../gpu/drm/amd/include/kgd_pp_interface.h    |  2 +
 drivers/gpu/drm/amd/pm/amdgpu_pm.c            | 45 ++++++++++++++++
 drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h       |  2 +
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     |  2 +
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h  |  1 +
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c  | 51 ++++++++++++++++++-
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c  | 51 ++++++++++++++++++-
 7 files changed, 152 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/include/kgd_pp_interface.h +2 -0
index 06ed73a6b5f3..e2eefc8d8edc 100644
@@ -117,6 +117,7 @@ enum pp_clock_type {
 	OD_FAN_CURVE,
 	OD_ACOUSTIC_LIMIT,
 	OD_ACOUSTIC_TARGET,
+	OD_FAN_TARGET_TEMPERATURE,
 };
 
 enum amd_pp_sensors {
@@ -194,6 +195,7 @@ enum PP_OD_DPM_TABLE_COMMAND {
 	PP_OD_EDIT_FAN_CURVE,
 	PP_OD_EDIT_ACOUSTIC_LIMIT,
 	PP_OD_EDIT_ACOUSTIC_TARGET,
+	PP_OD_EDIT_FAN_TARGET_TEMPERATURE,
 };
 
 struct pp_states_info {
drivers/gpu/drm/amd/pm/amdgpu_pm.c +45 -0

57 lines not on this page · raw message

drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h +2 -0
index 6b2bbd13db09..80d2ac1ecb9f 100644
@@ -322,6 +322,8 @@ struct config_table_setting
 #define OD_OPS_SUPPORT_ACOUSTIC_LIMIT_THRESHOLD_SET		BIT(5)
 #define OD_OPS_SUPPORT_ACOUSTIC_TARGET_THRESHOLD_RETRIEVE	BIT(6)
 #define OD_OPS_SUPPORT_ACOUSTIC_TARGET_THRESHOLD_SET		BIT(7)
+#define OD_OPS_SUPPORT_FAN_TARGET_TEMPERATURE_RETRIEVE	BIT(8)
+#define OD_OPS_SUPPORT_FAN_TARGET_TEMPERATURE_SET	BIT(9)
 
 struct amdgpu_pm {
 	struct mutex		mutex;
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -0
index 3bfa9b9bb247..22a6527139a6 100644
@@ -2489,6 +2489,8 @@ static enum smu_clk_type smu_convert_to_smuclk(enum pp_clock_type type)
 		clk_type = SMU_OD_ACOUSTIC_LIMIT; break;
 	case OD_ACOUSTIC_TARGET:
 		clk_type = SMU_OD_ACOUSTIC_TARGET; break;
+	case OD_FAN_TARGET_TEMPERATURE:
+		clk_type = SMU_OD_FAN_TARGET_TEMPERATURE; break;
 	default:
 		clk_type = SMU_CLK_COUNT; break;
 	}
drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h +1 -0
index 1463a5d41647..7c405486ec52 100644
@@ -282,6 +282,7 @@ enum smu_clk_type {
 	SMU_OD_FAN_CURVE,
 	SMU_OD_ACOUSTIC_LIMIT,
 	SMU_OD_ACOUSTIC_TARGET,
+	SMU_OD_FAN_TARGET_TEMPERATURE,
 	SMU_CLK_COUNT,
 };
 
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +50 -1

87 lines not on this page · raw message

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +50 -1

87 lines not on this page · raw message

Signature · 1 line
2.34.1
author
#8 lore raw

PATCH 8/8 drm/amd/pm: add fan minimum pwm OD setting support for SMU13

In reply to Evan Quan

Add SMU13 fan minimum pwm OD setting support.

---
 .../gpu/drm/amd/include/kgd_pp_interface.h    |  2 +
 drivers/gpu/drm/amd/pm/amdgpu_pm.c            | 45 ++++++++++++++++
 drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h       |  2 +
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     |  2 +
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h  |  1 +
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c  | 51 ++++++++++++++++++-
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c  | 51 ++++++++++++++++++-
 7 files changed, 152 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/include/kgd_pp_interface.h +2 -0
index e2eefc8d8edc..cac972cedce1 100644
@@ -118,6 +118,7 @@ enum pp_clock_type {
 	OD_ACOUSTIC_LIMIT,
 	OD_ACOUSTIC_TARGET,
 	OD_FAN_TARGET_TEMPERATURE,
+	OD_FAN_MINIMUM_PWM,
 };
 
 enum amd_pp_sensors {
@@ -196,6 +197,7 @@ enum PP_OD_DPM_TABLE_COMMAND {
 	PP_OD_EDIT_ACOUSTIC_LIMIT,
 	PP_OD_EDIT_ACOUSTIC_TARGET,
 	PP_OD_EDIT_FAN_TARGET_TEMPERATURE,
+	PP_OD_EDIT_FAN_MINIMUM_PWM,
 };
 
 struct pp_states_info {
drivers/gpu/drm/amd/pm/amdgpu_pm.c +45 -0

57 lines not on this page · raw message

drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h +2 -0
index 80d2ac1ecb9f..342c4d8318dc 100644
@@ -324,6 +324,8 @@ struct config_table_setting
 #define OD_OPS_SUPPORT_ACOUSTIC_TARGET_THRESHOLD_SET		BIT(7)
 #define OD_OPS_SUPPORT_FAN_TARGET_TEMPERATURE_RETRIEVE	BIT(8)
 #define OD_OPS_SUPPORT_FAN_TARGET_TEMPERATURE_SET	BIT(9)
+#define OD_OPS_SUPPORT_FAN_MINIMUM_PWM_RETRIEVE		BIT(10)
+#define OD_OPS_SUPPORT_FAN_MINIMUM_PWM_SET		BIT(11)
 
 struct amdgpu_pm {
 	struct mutex		mutex;
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -0
index 22a6527139a6..d22ed5a272ce 100644
@@ -2491,6 +2491,8 @@ static enum smu_clk_type smu_convert_to_smuclk(enum pp_clock_type type)
 		clk_type = SMU_OD_ACOUSTIC_TARGET; break;
 	case OD_FAN_TARGET_TEMPERATURE:
 		clk_type = SMU_OD_FAN_TARGET_TEMPERATURE; break;
+	case OD_FAN_MINIMUM_PWM:
+		clk_type = SMU_OD_FAN_MINIMUM_PWM; break;
 	default:
 		clk_type = SMU_CLK_COUNT; break;
 	}
drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h +1 -0
index 7c405486ec52..3a56ebcc2b6a 100644
@@ -283,6 +283,7 @@ enum smu_clk_type {
 	SMU_OD_ACOUSTIC_LIMIT,
 	SMU_OD_ACOUSTIC_TARGET,
 	SMU_OD_FAN_TARGET_TEMPERATURE,
+	SMU_OD_FAN_MINIMUM_PWM,
 	SMU_CLK_COUNT,
 };
 
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +50 -1

87 lines not on this page · raw message

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +50 -1

87 lines not on this page · raw message

Signature · 1 line
2.34.1
author
#9 lore raw
In reply to Evan Quan

[AMD Official Use Only - General]

Ping..

Quoted 54 lines

-----Original Message-----
From: Quan, Evan <[email protected]>
Sent: Tuesday, August 15, 2023 4:42 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>
Subject: [PATCH 0/8] A new set of Linux OD interfaces

The existing OD interface pp_od_clk_voltage is unable to meet the growing demands for more OD functionalities. Since the buf used within it comes with size limit as one page. With more OD functionalities added, we will hit that limit soon.

To better meet the growing demainds, a new set of OD interfaces are designed. With this new design, there will be multiple interfaces exposed with each representing a single OD functionality. And all those interfaces will be arranged in a tree liked hierarchy as below. Meanwhile all functionalities for the same component will be arranged under the same directory.

gpu_od/

├── fan_ctrl
    ├── acoustic_limit_rpm_threshold
    ├── acoustic_target_rpm_threshold
    ├── fan_curve
    ├── fan_minimum_pwm
    ├── fan_mode
    ├── fan_target_temperature

...
...(more to be added)

Evan Quan (8):
drm/amd/pm: introduce a new set of OD interfaces drm/amdgpu: revise the device initialization sequences drm/amd/pm: add fan mode OD setting support for SMU13 drm/amd/pm: add fan temperature/pwm curve OD setting support for
SMU13
drm/amd/pm: add fan acoustic limit OD setting support for SMU13 drm/amd/pm: add fan acoustic target OD setting support for SMU13 drm/amd/pm: add fan target temperature OD setting support for SMU13 drm/amd/pm: add fan minimum pwm OD setting support for SMU13

 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c    |  39 +-
 .../gpu/drm/amd/include/kgd_pp_interface.h    |  14 +-
 drivers/gpu/drm/amd/pm/amdgpu_pm.c            | 676 +++++++++++++++++-
 drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h       |  16 +
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     |  12 +
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h  |   6 +
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c  | 316 +++++++-
  .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c  | 316 +++++++-
 8 files changed, 1370 insertions(+), 25 deletions(-)

--
2.34.1

#10 lore raw
In reply to Evan Quan
Quoted 11 lines · Evan Quan

The existing OD interface pp_od_clk_voltage is unable to meet the growing demands for more OD functionalities. Since the buf used within it comes with size limit as one page. With more OD functionalities added, we will hit that limit soon.

To better meet the growing demainds, a new set of OD interfaces are designed. With this new design, there will be multiple interfaces exposed with each representing a single OD functionality. And all those interfaces will be arranged in a tree liked hierarchy as below. Meanwhile all functionalities for the same component will be arranged under the same directory.

Patches look good to me, but please add kerneldoc for this to amdgpu_pm.c and make sure it gets picked up in Documentation/gpu/amdgpu/thermal.rst.

Alex

Quoted 36 lines

gpu_od/

├── fan_ctrl
    ├── acoustic_limit_rpm_threshold
    ├── acoustic_target_rpm_threshold
    ├── fan_curve
    ├── fan_minimum_pwm
    ├── fan_mode
    ├── fan_target_temperature

...
...(more to be added)

Evan Quan (8):
drm/amd/pm: introduce a new set of OD interfaces drm/amdgpu: revise the device initialization sequences drm/amd/pm: add fan mode OD setting support for SMU13 drm/amd/pm: add fan temperature/pwm curve OD setting support for SMU13 drm/amd/pm: add fan acoustic limit OD setting support for SMU13 drm/amd/pm: add fan acoustic target OD setting support for SMU13 drm/amd/pm: add fan target temperature OD setting support for SMU13 drm/amd/pm: add fan minimum pwm OD setting support for SMU13

 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c    |  39 +-
 .../gpu/drm/amd/include/kgd_pp_interface.h    |  14 +-
 drivers/gpu/drm/amd/pm/amdgpu_pm.c            | 676 +++++++++++++++++-
 drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h       |  16 +
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     |  12 +
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h  |   6 +
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c  | 316 +++++++-
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c  | 316 +++++++-
 8 files changed, 1370 insertions(+), 25 deletions(-)

--
2.34.1