Skip to contentSkip to conversation

A new set of Linux OD interfaces

PATCH In review Evan Quan 2 participants 12 messages Aug 30, 2023 – Sep 5, 2023

Subsystems (5)
lore
Share & tools
lore

Evan Quan

author
#0 lore raw

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

Evan Quan (7):
drm/amd/pm: introduce a new set of OD interfaces drm/amdgpu: revise the device initialization sequences 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

 Documentation/gpu/amdgpu/thermal.rst          |  30 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c    |  39 +-
 .../gpu/drm/amd/include/kgd_pp_interface.h    |  12 +-
 drivers/gpu/drm/amd/pm/amdgpu_pm.c            | 730 +++++++++++++++++-
 drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h       |  14 +
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     |  10 +
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h  |   5 +
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c  | 298 ++++++-
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c  | 298 ++++++-
 9 files changed, 1411 insertions(+), 25 deletions(-)
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH v3 1/7 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 b2bc5eb31a90..e588cf7a14f6 100644
@@ -3624,6 +3624,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 v3 2/7 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 e588cf7a14f6..f324ef5da792 100644
@@ -3862,22 +3862,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
@@ -3906,6 +3890,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 v3 3/7 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.

--
v1->v2:
- add missing kerneldoc for the new interface(Alex)
v2->v3:
- rich the document for the new interface(Alex)

---
 Documentation/gpu/amdgpu/thermal.rst          |   6 +
 .../gpu/drm/amd/include/kgd_pp_interface.h    |   4 +-
 drivers/gpu/drm/amd/pm/amdgpu_pm.c            | 210 +++++++++++++++++-
 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  | 102 ++++++++-
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c  | 102 ++++++++-
 8 files changed, 423 insertions(+), 8 deletions(-)
Documentation/gpu/amdgpu/thermal.rst +6 -0
index 5e27e4eb3959..08ee33b2acb6 100644
@@ -64,6 +64,12 @@ gpu_metrics
 .. kernel-doc:: drivers/gpu/drm/amd/pm/amdgpu_pm.c
    :doc: gpu_metrics
 
+fan_curve
+---------
+
+.. kernel-doc:: drivers/gpu/drm/amd/pm/amdgpu_pm.c
+   :doc: fan_curve
+
 GFXOFF
 ======
 
drivers/gpu/drm/amd/include/kgd_pp_interface.h +3 -1
index 84c5224d994c..7bdd2bdab970 100644
@@ -113,6 +113,7 @@ enum pp_clock_type {
 	OD_RANGE,
 	OD_VDDGFX_OFFSET,
 	OD_CCLK,
+	OD_FAN_CURVE,
 };
 
 enum amd_pp_sensors {
@@ -186,7 +187,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_CURVE,
 };
 
 struct pp_states_info {
drivers/gpu/drm/amd/pm/amdgpu_pm.c +209 -1

216 lines not on this page · raw message

drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h +4 -0
index 4cab6a2efb63..90544a8f450c 100644
@@ -314,6 +314,9 @@ struct config_table_setting
 	uint16_t fclk_average_tau;
 };
 
+#define OD_OPS_SUPPORT_FAN_CURVE_RETRIEVE		BIT(0)
+#define OD_OPS_SUPPORT_FAN_CURVE_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..2d73a63813de 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_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 e57265cf637c..83e1d43efd2b 100644
@@ -280,6 +280,7 @@ enum smu_clk_type {
 	SMU_OD_VDDC_CURVE,
 	SMU_OD_RANGE,
 	SMU_OD_VDDGFX_OFFSET,
+	SMU_OD_FAN_CURVE,
 	SMU_CLK_COUNT,
 };
 
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +99 -3

146 lines not on this page · raw message

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +99 -3

146 lines not on this page · raw message

Signature · 1 line
2.34.1
author
#4 lore raw

PATCH v3 4/7 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.

--
v1->v2:
- add missing kerneldoc for the new interface(Alex)
v2->v3:
- rich the document for the new interface(Alex)

---
 Documentation/gpu/amdgpu/thermal.rst          |  6 ++
 .../gpu/drm/amd/include/kgd_pp_interface.h    |  2 +
 drivers/gpu/drm/amd/pm/amdgpu_pm.c            | 63 +++++++++++++++++++
 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 ++++++++++++++-
 8 files changed, 176 insertions(+), 2 deletions(-)
Documentation/gpu/amdgpu/thermal.rst +6 -0
index 08ee33b2acb6..8ed888f81d2c 100644
@@ -70,6 +70,12 @@ fan_curve
 .. kernel-doc:: drivers/gpu/drm/amd/pm/amdgpu_pm.c
    :doc: fan_curve
 
+acoustic_limit_rpm_threshold
+----------------------------
+
+.. kernel-doc:: drivers/gpu/drm/amd/pm/amdgpu_pm.c
+   :doc: acoustic_limit_rpm_threshold
+
 GFXOFF
 ======
 
drivers/gpu/drm/amd/include/kgd_pp_interface.h +2 -0
index 7bdd2bdab970..e3dcef8c4ab7 100644
@@ -114,6 +114,7 @@ enum pp_clock_type {
 	OD_VDDGFX_OFFSET,
 	OD_CCLK,
 	OD_FAN_CURVE,
+	OD_ACOUSTIC_LIMIT,
 };
 
 enum amd_pp_sensors {
@@ -189,6 +190,7 @@ enum PP_OD_DPM_TABLE_COMMAND {
 	PP_OD_COMMIT_DPM_TABLE,
 	PP_OD_EDIT_VDDGFX_OFFSET,
 	PP_OD_EDIT_FAN_CURVE,
+	PP_OD_EDIT_ACOUSTIC_LIMIT,
 };
 
 struct pp_states_info {
drivers/gpu/drm/amd/pm/amdgpu_pm.c +63 -0

75 lines not on this page · raw message

drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h +2 -0
index 90544a8f450c..984fda278f1a 100644
@@ -316,6 +316,8 @@ struct config_table_setting
 
 #define OD_OPS_SUPPORT_FAN_CURVE_RETRIEVE		BIT(0)
 #define OD_OPS_SUPPORT_FAN_CURVE_SET			BIT(1)
+#define OD_OPS_SUPPORT_ACOUSTIC_LIMIT_THRESHOLD_RETRIEVE	BIT(2)
+#define OD_OPS_SUPPORT_ACOUSTIC_LIMIT_THRESHOLD_SET		BIT(3)
 
 struct amdgpu_pm {
 	struct mutex		mutex;
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -0
index 2d73a63813de..ca41cfd57d89 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_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 83e1d43efd2b..76bb1cba9b83 100644
@@ -281,6 +281,7 @@ enum smu_clk_type {
 	SMU_OD_RANGE,
 	SMU_OD_VDDGFX_OFFSET,
 	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
#5 lore raw

PATCH v3 5/7 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.

--
v1->v2:
- add missing kerneldoc for the new interface(Alex)
v2->v3:
- rich the document for the new interface(Alex)

---
 Documentation/gpu/amdgpu/thermal.rst          |  6 ++
 .../gpu/drm/amd/include/kgd_pp_interface.h    |  2 +
 drivers/gpu/drm/amd/pm/amdgpu_pm.c            | 65 +++++++++++++++++++
 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 ++++++++++++++-
 8 files changed, 178 insertions(+), 2 deletions(-)
Documentation/gpu/amdgpu/thermal.rst +6 -0
index 8ed888f81d2c..26ca4812b9f6 100644
@@ -76,6 +76,12 @@ acoustic_limit_rpm_threshold
 .. kernel-doc:: drivers/gpu/drm/amd/pm/amdgpu_pm.c
    :doc: acoustic_limit_rpm_threshold
 
+acoustic_target_rpm_threshold
+-----------------------------
+
+.. kernel-doc:: drivers/gpu/drm/amd/pm/amdgpu_pm.c
+   :doc: acoustic_target_rpm_threshold
+
 GFXOFF
 ======
 
drivers/gpu/drm/amd/include/kgd_pp_interface.h +2 -0
index e3dcef8c4ab7..a7bc81a0a36e 100644
@@ -115,6 +115,7 @@ enum pp_clock_type {
 	OD_CCLK,
 	OD_FAN_CURVE,
 	OD_ACOUSTIC_LIMIT,
+	OD_ACOUSTIC_TARGET,
 };
 
 enum amd_pp_sensors {
@@ -191,6 +192,7 @@ enum PP_OD_DPM_TABLE_COMMAND {
 	PP_OD_EDIT_VDDGFX_OFFSET,
 	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 +65 -0

77 lines not on this page · raw message

drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h +2 -0
index 984fda278f1a..bcb37ba8db58 100644
@@ -318,6 +318,8 @@ struct config_table_setting
 #define OD_OPS_SUPPORT_FAN_CURVE_SET			BIT(1)
 #define OD_OPS_SUPPORT_ACOUSTIC_LIMIT_THRESHOLD_RETRIEVE	BIT(2)
 #define OD_OPS_SUPPORT_ACOUSTIC_LIMIT_THRESHOLD_SET		BIT(3)
+#define OD_OPS_SUPPORT_ACOUSTIC_TARGET_THRESHOLD_RETRIEVE	BIT(4)
+#define OD_OPS_SUPPORT_ACOUSTIC_TARGET_THRESHOLD_SET		BIT(5)
 
 struct amdgpu_pm {
 	struct mutex		mutex;
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -0
index ca41cfd57d89..0f1e805e166c 100644
@@ -2485,6 +2485,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 76bb1cba9b83..b2e9874f4a0e 100644
@@ -282,6 +282,7 @@ enum smu_clk_type {
 	SMU_OD_VDDGFX_OFFSET,
 	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
#6 lore raw

PATCH v3 6/7 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.

--
v1->v2:
- add missing kerneldoc for the new interface(Alex)
v2->v3:
- rich the document for the new interface(Alex)

---
 Documentation/gpu/amdgpu/thermal.rst          |  6 ++
 .../gpu/drm/amd/include/kgd_pp_interface.h    |  2 +
 drivers/gpu/drm/amd/pm/amdgpu_pm.c            | 66 +++++++++++++++++++
 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 +++++++++++++-
 8 files changed, 179 insertions(+), 2 deletions(-)
Documentation/gpu/amdgpu/thermal.rst +6 -0
index 26ca4812b9f6..aa2d15706cda 100644
@@ -82,6 +82,12 @@ acoustic_target_rpm_threshold
 .. kernel-doc:: drivers/gpu/drm/amd/pm/amdgpu_pm.c
    :doc: acoustic_target_rpm_threshold
 
+fan_target_temperature
+----------------------
+
+.. kernel-doc:: drivers/gpu/drm/amd/pm/amdgpu_pm.c
+   :doc: fan_target_temperature
+
 GFXOFF
 ======
 
drivers/gpu/drm/amd/include/kgd_pp_interface.h +2 -0
index a7bc81a0a36e..0501d174dbd8 100644
@@ -116,6 +116,7 @@ enum pp_clock_type {
 	OD_FAN_CURVE,
 	OD_ACOUSTIC_LIMIT,
 	OD_ACOUSTIC_TARGET,
+	OD_FAN_TARGET_TEMPERATURE,
 };
 
 enum amd_pp_sensors {
@@ -193,6 +194,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 +66 -0

78 lines not on this page · raw message

drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h +2 -0
index bcb37ba8db58..486036632ab7 100644
@@ -320,6 +320,8 @@ struct config_table_setting
 #define OD_OPS_SUPPORT_ACOUSTIC_LIMIT_THRESHOLD_SET		BIT(3)
 #define OD_OPS_SUPPORT_ACOUSTIC_TARGET_THRESHOLD_RETRIEVE	BIT(4)
 #define OD_OPS_SUPPORT_ACOUSTIC_TARGET_THRESHOLD_SET		BIT(5)
+#define OD_OPS_SUPPORT_FAN_TARGET_TEMPERATURE_RETRIEVE		BIT(6)
+#define OD_OPS_SUPPORT_FAN_TARGET_TEMPERATURE_SET		BIT(7)
 
 struct amdgpu_pm {
 	struct mutex		mutex;
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -0
index 0f1e805e166c..60feffd8b221 100644
@@ -2487,6 +2487,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 b2e9874f4a0e..5a129e7162a9 100644
@@ -283,6 +283,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
#7 lore raw

PATCH v3 7/7 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.

--
v1->v2:
- add missing kerneldoc for the new interface(Alex)
v2->v3:
- rich the document for the new interface(Alex)

---
 Documentation/gpu/amdgpu/thermal.rst          |  6 ++
 .../gpu/drm/amd/include/kgd_pp_interface.h    |  2 +
 drivers/gpu/drm/amd/pm/amdgpu_pm.c            | 64 +++++++++++++++++++
 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 ++++++++++++++-
 8 files changed, 177 insertions(+), 2 deletions(-)
Documentation/gpu/amdgpu/thermal.rst +6 -0
index aa2d15706cda..2f6166f81e6a 100644
@@ -88,6 +88,12 @@ fan_target_temperature
 .. kernel-doc:: drivers/gpu/drm/amd/pm/amdgpu_pm.c
    :doc: fan_target_temperature
 
+fan_minimum_pwm
+---------------
+
+.. kernel-doc:: drivers/gpu/drm/amd/pm/amdgpu_pm.c
+   :doc: fan_minimum_pwm
+
 GFXOFF
 ======
 
drivers/gpu/drm/amd/include/kgd_pp_interface.h +2 -0
index 0501d174dbd8..5a889f733462 100644
@@ -117,6 +117,7 @@ enum pp_clock_type {
 	OD_ACOUSTIC_LIMIT,
 	OD_ACOUSTIC_TARGET,
 	OD_FAN_TARGET_TEMPERATURE,
+	OD_FAN_MINIMUM_PWM,
 };
 
 enum amd_pp_sensors {
@@ -195,6 +196,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 +64 -0

76 lines not on this page · raw message

drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h +2 -0
index 486036632ab7..5efdba6e358f 100644
@@ -322,6 +322,8 @@ struct config_table_setting
 #define OD_OPS_SUPPORT_ACOUSTIC_TARGET_THRESHOLD_SET		BIT(5)
 #define OD_OPS_SUPPORT_FAN_TARGET_TEMPERATURE_RETRIEVE		BIT(6)
 #define OD_OPS_SUPPORT_FAN_TARGET_TEMPERATURE_SET		BIT(7)
+#define OD_OPS_SUPPORT_FAN_MINIMUM_PWM_RETRIEVE		BIT(8)
+#define OD_OPS_SUPPORT_FAN_MINIMUM_PWM_SET		BIT(9)
 
 struct amdgpu_pm {
 	struct mutex		mutex;
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -0
index 60feffd8b221..206e233826b5 100644
@@ -2489,6 +2489,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 5a129e7162a9..ebc789e7a289 100644
@@ -284,6 +284,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
Reviewed-by on the v3 series
#8 lore raw
In reply to Evan Quan

Series is:

Quoted 43 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.

gpu_od/

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

Evan Quan (7):
drm/amd/pm: introduce a new set of OD interfaces drm/amdgpu: revise the device initialization sequences 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

 Documentation/gpu/amdgpu/thermal.rst          |  30 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c    |  39 +-
 .../gpu/drm/amd/include/kgd_pp_interface.h    |  12 +-
 drivers/gpu/drm/amd/pm/amdgpu_pm.c            | 730 +++++++++++++++++-
 drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h       |  14 +
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     |  10 +
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h  |   5 +
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c  | 298 ++++++-
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c  | 298 ++++++-
 9 files changed, 1411 insertions(+), 25 deletions(-)

--
2.34.1

#9 lore raw

For consistency with the other OD interface, we'd probably want an "r" option to reset each attribute to the default state again.

Alex

Quoted 48 lines · Alex Deucher

Series is:

Quoted 43 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.

gpu_od/

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

Evan Quan (7):
drm/amd/pm: introduce a new set of OD interfaces drm/amdgpu: revise the device initialization sequences 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

 Documentation/gpu/amdgpu/thermal.rst          |  30 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c    |  39 +-
 .../gpu/drm/amd/include/kgd_pp_interface.h    |  12 +-
 drivers/gpu/drm/amd/pm/amdgpu_pm.c            | 730 +++++++++++++++++-
 drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h       |  14 +
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     |  10 +
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h  |   5 +
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c  | 298 ++++++-
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c  | 298 ++++++-
 9 files changed, 1411 insertions(+), 25 deletions(-)

--
2.34.1

author
#10 lore raw

[AMD Official Use Only - General]

Actually, with my original design, there indeed came with an 'r' option support. But I found that brings some confusion. Since per current 'r' option design, it will reset all attributes back to original states. Thus I dropped it.

If to support 'r' option per attribute, some redesigns to current logics will be needed to support both legacy and the new OD interfaces. That will need some extra efforts. Maybe we can put that on our TODO list?

Evan

Quoted 68 lines

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Friday, September 1, 2023 1:26 AM
To: Quan, Evan <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>
Subject: Re: [V3 0/7] A new set of Linux OD interfaces

For consistency with the other OD interface, we'd probably want an "r" option to reset each attribute to the default state again.

Alex

Quoted 5 lines · Alex Deucher

Series is:

On Wed, Aug 30, 2023 at 2:35 AM Evan Quan <[email protected]>

Quoted 7 lines · wrote:
Quoted 7 lines

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.

Quoted 4 lines
Quoted 4 lines

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.

Quoted 9 lines
Quoted 9 lines

gpu_od/

├── fan_ctrl
│   ├── acoustic_limit_rpm_threshold
│   ├── acoustic_target_rpm_threshold
│   ├── fan_curve
│   ├── fan_minimum_pwm
│   ├── fan_target_temperature
Quoted 4 lines
Quoted 4 lines

Evan Quan (7):
drm/amd/pm: introduce a new set of OD interfaces drm/amdgpu: revise the device initialization sequences drm/amd/pm: add fan temperature/pwm curve OD setting support for

SMU13

Quoted 9 lines
Quoted 9 lines

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

 Documentation/gpu/amdgpu/thermal.rst          |  30 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c    |  39 +-
 .../gpu/drm/amd/include/kgd_pp_interface.h    |  12 +-
 drivers/gpu/drm/amd/pm/amdgpu_pm.c            | 730

+++++++++++++++++-

Quoted 10 lines
Quoted 10 lines
 drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h       |  14 +
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     |  10 +
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h  |   5 +
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c  | 298 ++++++-
.../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c  | 298 ++++++-
 9 files changed, 1411 insertions(+), 25 deletions(-)

--
2.34.1

#11 lore raw
Quoted 10 lines · Evan

[AMD Official Use Only - General]

Actually, with my original design, there indeed came with an 'r' option support. But I found that brings some confusion. Since per current 'r' option design, it will reset all attributes back to original states. Thus I dropped it.

If to support 'r' option per attribute, some redesigns to current logics will be needed to support both legacy and the new OD interfaces. That will need some extra efforts. Maybe we can put that on our TODO list?

Wouldn't it just reset the values of the attributes to the initial value? E.g., for the curve, it would be useful to have a way to set the curve back to the initial settings after messing with it.

Alex

Quoted 70 lines

Evan

Quoted 68 lines

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Friday, September 1, 2023 1:26 AM
To: Quan, Evan <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>
Subject: Re: [V3 0/7] A new set of Linux OD interfaces

For consistency with the other OD interface, we'd probably want an "r" option to reset each attribute to the default state again.

Alex

Quoted 5 lines · Alex Deucher

Series is:

On Wed, Aug 30, 2023 at 2:35 AM Evan Quan <[email protected]>

Quoted 7 lines · wrote:
Quoted 7 lines

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.

Quoted 4 lines
Quoted 4 lines

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.

Quoted 9 lines
Quoted 9 lines

gpu_od/

├── fan_ctrl
│   ├── acoustic_limit_rpm_threshold
│   ├── acoustic_target_rpm_threshold
│   ├── fan_curve
│   ├── fan_minimum_pwm
│   ├── fan_target_temperature
Quoted 4 lines
Quoted 4 lines

Evan Quan (7):
drm/amd/pm: introduce a new set of OD interfaces drm/amdgpu: revise the device initialization sequences drm/amd/pm: add fan temperature/pwm curve OD setting support for

SMU13

Quoted 9 lines
Quoted 9 lines

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

 Documentation/gpu/amdgpu/thermal.rst          |  30 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c    |  39 +-
 .../gpu/drm/amd/include/kgd_pp_interface.h    |  12 +-
 drivers/gpu/drm/amd/pm/amdgpu_pm.c            | 730

+++++++++++++++++-

Quoted 10 lines
Quoted 10 lines
 drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h       |  14 +
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     |  10 +
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h  |   5 +
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c  | 298 ++++++-
.../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c  | 298 ++++++-
 9 files changed, 1411 insertions(+), 25 deletions(-)

--
2.34.1