Skip to contentSkip to conversation

drm/amdgpu: bump version for new power profile sysfs

PATCH In review Rex Zhu 3 participants 13 messages Feb 24, 2018 – Feb 26, 2018 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Rex Zhu

author
#0 lore raw

PATCH 1/10 drm/amdgpu: bump version for new power profile sysfs

Add new power profile sysfs: pp_power_profile_mode old sysfs: pp_compute_power_profile/pp_gfx_power_profile will be removed

Change-Id Ief35efb81b313115b33c430dfb328ad83ce7975d
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -0
index 69cf490..4c92239 100644
@@ -75,6 +75,7 @@
  * - 3.23.0 - Add query for VRAM lost counter
  * - 3.24.0 - Add high priority compute support for gfx9
  * - 3.25.0 - Add support for sensor query info (stable pstate sclk/mclk).
+ * - 3.26.0 - Delete old gfx/compute profile sysfs, add common profile sysfs.
  */
 #define KMS_DRIVER_MAJOR	3
 #define KMS_DRIVER_MINOR	25
Signature · 6 lines
1.9.1

_______________________________________________
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): 1519480567-23858-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

author
#2 lore raw

PATCH 2/10 drm/amd/pp: Remove old gfx/compute profile sysfs

Change-Id I4c3e70a5bff3855e0195d77eb12932dc08063ef2
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h            |   8 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c             | 180 ---------------
 drivers/gpu/drm/amd/amdgpu/ci_dpm.c                | 256 ---------------------
 drivers/gpu/drm/amd/amdgpu/ci_dpm.h                |   7 -
 drivers/gpu/drm/amd/include/kgd_pp_interface.h     |   7 -
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c      | 114 ---------
 .../gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c  |  17 --
 drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c       |   2 -
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   |  84 -------
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c |  86 -------
 .../gpu/drm/amd/powerplay/inc/hardwaremanager.h    |   1 -
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h          |   9 -
 drivers/gpu/drm/amd/powerplay/inc/smumgr.h         |   3 -
 drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c   |  27 ---
 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c |  66 ------
 .../drm/amd/powerplay/smumgr/polaris10_smumgr.c    |  64 ------
 drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c      |  10 -
 .../gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c    |  64 ------
 18 files changed, 1005 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h +0 -8
index bd745a4..9c373f8f 100644
@@ -341,14 +341,6 @@ enum amdgpu_pcie_gen {
 		((adev)->powerplay.pp_funcs->reset_power_profile_state(\
 			(adev)->powerplay.pp_handle, request))
 
-#define amdgpu_dpm_get_power_profile_state(adev, query) \
-		((adev)->powerplay.pp_funcs->get_power_profile_state(\
-			(adev)->powerplay.pp_handle, query))
-
-#define amdgpu_dpm_set_power_profile_state(adev, request) \
-		((adev)->powerplay.pp_funcs->set_power_profile_state(\
-			(adev)->powerplay.pp_handle, request))
-
 #define amdgpu_dpm_switch_power_profile(adev, type) \
 		((adev)->powerplay.pp_funcs->switch_power_profile(\
 			(adev)->powerplay.pp_handle, type))
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -180

204 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/ci_dpm.c +0 -256

280 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/ci_dpm.h +0 -7
index 84cbc9c..91be299 100644
@@ -295,13 +295,6 @@ struct ci_power_info {
 	bool fan_is_controlled_by_smc;
 	u32 t_min;
 	u32 fan_ctrl_default_mode;
-
-	/* power profile */
-	struct amd_pp_profile gfx_power_profile;
-	struct amd_pp_profile compute_power_profile;
-	struct amd_pp_profile default_gfx_power_profile;
-	struct amd_pp_profile default_compute_power_profile;
-	enum amd_pp_profile_type current_power_profile;
 };
 
 #define CISLANDS_VOLTAGE_CONTROL_NONE                   0x0
drivers/gpu/drm/amd/include/kgd_pp_interface.h +0 -7
index 22c2fa3..7dfba2d 100644
@@ -260,13 +260,6 @@ struct amd_pm_funcs {
 	int (*get_pp_table)(void *handle, char **table);
 	int (*set_pp_table)(void *handle, const char *buf, size_t size);
 	void (*debugfs_print_current_performance_level)(void *handle, struct seq_file *m);
-
-	int (*reset_power_profile_state)(void *handle,
-			struct amd_pp_profile *request);
-	int (*get_power_profile_state)(void *handle,
-			struct amd_pp_profile *query);
-	int (*set_power_profile_state)(void *handle,
-			struct amd_pp_profile *request);
 	int (*switch_power_profile)(void *handle,
 			enum amd_pp_profile_type type);
 /* export to amdgpu */
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +0 -114

132 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c +0 -17
index 33480de..f06f8f4 100644
@@ -128,23 +128,6 @@ int phm_force_dpm_levels(struct pp_hwmgr *hwmgr, enum amd_dpm_forced_level level
 	return ret;
 }
 
-int phm_reset_power_profile_state(struct pp_hwmgr *hwmgr)
-{
-	int ret = 0;
-
-	if (hwmgr->hwmgr_func->set_power_profile_state) {
-		if (hwmgr->current_power_profile == AMD_PP_GFX_PROFILE)
-			ret = hwmgr->hwmgr_func->set_power_profile_state(
-					hwmgr,
-					&hwmgr->gfx_power_profile);
-		else if (hwmgr->current_power_profile == AMD_PP_COMPUTE_PROFILE)
-			ret = hwmgr->hwmgr_func->set_power_profile_state(
-					hwmgr,
-					&hwmgr->compute_power_profile);
-	}
-	return ret;
-}
-
 int phm_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,
 				   struct pp_power_state *adjusted_ps,
 			     const struct pp_power_state *current_ps)
drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c +0 -2
index 95ab772..ed3bd15 100644
@@ -247,8 +247,6 @@ int psm_adjust_power_state_dynamic(struct pp_hwmgr *hwmgr, bool skip,
 	if (!phm_force_dpm_levels(hwmgr, hwmgr->request_dpm_level))
 		hwmgr->dpm_level = hwmgr->request_dpm_level;
 
-	phm_reset_power_profile_state(hwmgr);
-
 	return 0;
 }
 
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -84

96 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -86

110 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/hardwaremanager.h +0 -1
index 6f528e6..b366a5b 100644
@@ -448,6 +448,5 @@ extern int phm_display_clock_voltage_request(struct pp_hwmgr *hwmgr,
 
 extern int phm_get_max_high_clocks(struct pp_hwmgr *hwmgr, struct amd_pp_simple_clock_info *clocks);
 extern int phm_disable_smc_firmware_ctf(struct pp_hwmgr *hwmgr);
-extern int phm_reset_power_profile_state(struct pp_hwmgr *hwmgr);
 #endif /* _HARDWARE_MANAGER_H_ */
 
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +0 -9
index 7b19be4..a3beb31 100644
@@ -236,8 +236,6 @@ struct pp_smumgr_func {
 	uint32_t (*get_offsetof)(uint32_t type, uint32_t member);
 	uint32_t (*get_mac_definition)(uint32_t value);
 	bool (*is_dpm_running)(struct pp_hwmgr *hwmgr);
-	int (*populate_requested_graphic_levels)(struct pp_hwmgr *hwmgr,
-			struct amd_pp_profile *request);
 	bool (*is_hw_avfs_present)(struct pp_hwmgr  *hwmgr);
 	int (*update_dpm_settings)(struct pp_hwmgr *hwmgr, void *profile_setting);
 };
@@ -329,8 +327,6 @@ struct pp_hwmgr_func {
 	int (*get_mclk_od)(struct pp_hwmgr *hwmgr);
 	int (*set_mclk_od)(struct pp_hwmgr *hwmgr, uint32_t value);
 	int (*read_sensor)(struct pp_hwmgr *hwmgr, int idx, void *value, int *size);
-	int (*set_power_profile_state)(struct pp_hwmgr *hwmgr,
-			struct amd_pp_profile *request);
 	int (*avfs_control)(struct pp_hwmgr *hwmgr, bool enable);
 	int (*disable_smc_firmware_ctf)(struct pp_hwmgr *hwmgr);
 	int (*set_active_display_count)(struct pp_hwmgr *hwmgr, uint32_t count);
@@ -752,11 +748,6 @@ struct pp_hwmgr {
 	uint32_t feature_mask;
 
 	/* UMD Pstate */
-	struct amd_pp_profile gfx_power_profile;
-	struct amd_pp_profile compute_power_profile;
-	struct amd_pp_profile default_gfx_power_profile;
-	struct amd_pp_profile default_compute_power_profile;
-	enum amd_pp_profile_type current_power_profile;
 	bool en_umd_pstate;
 	uint32_t power_profile_mode;
 	uint32_t default_power_profile_mode;
drivers/gpu/drm/amd/powerplay/inc/smumgr.h +0 -3
index e05a57e..e1f6e83 100644
@@ -129,9 +129,6 @@ extern uint32_t smum_get_offsetof(struct pp_hwmgr *hwmgr,
 
 extern bool smum_is_dpm_running(struct pp_hwmgr *hwmgr);
 
-extern int smum_populate_requested_graphic_levels(struct pp_hwmgr *hwmgr,
-		struct amd_pp_profile *request);
-
 extern bool smum_is_hw_avfs_present(struct pp_hwmgr *hwmgr);
 
 extern int smum_update_dpm_settings(struct pp_hwmgr *hwmgr, void *profile_setting);
drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c +0 -27
index 6dd10ef..6f4bf7e 100644
@@ -2772,32 +2772,6 @@ static bool ci_is_dpm_running(struct pp_hwmgr *hwmgr)
 	return ci_is_smc_ram_running(hwmgr);
 }
 
-static int ci_populate_requested_graphic_levels(struct pp_hwmgr *hwmgr,
-						struct amd_pp_profile *request)
-{
-	struct ci_smumgr *smu_data = (struct ci_smumgr *)
-			(hwmgr->smu_backend);
-	struct SMU7_Discrete_GraphicsLevel *levels =
-			smu_data->smc_state_table.GraphicsLevel;
-	uint32_t array = smu_data->dpm_table_start +
-			offsetof(SMU7_Discrete_DpmTable, GraphicsLevel);
-	uint32_t array_size = sizeof(struct SMU7_Discrete_GraphicsLevel) *
-			SMU7_MAX_LEVELS_GRAPHICS;
-	uint32_t i;
-
-	for (i = 0; i < smu_data->smc_state_table.GraphicsDpmLevelCount; i++) {
-		levels[i].ActivityLevel =
-				cpu_to_be16(request->activity_threshold);
-		levels[i].EnabledForActivity = 1;
-		levels[i].UpH = request->up_hyst;
-		levels[i].DownH = request->down_hyst;
-	}
-
-	return ci_copy_bytes_to_smc(hwmgr, array, (uint8_t *)levels,
-				array_size, SMC_RAM_END);
-}
-
-
 static int ci_smu_init(struct pp_hwmgr *hwmgr)
 {
 	struct ci_smumgr *ci_priv = NULL;
@@ -2942,6 +2916,5 @@ static int ci_update_dpm_settings(struct pp_hwmgr *hwmgr,
 	.get_mac_definition = ci_get_mac_definition,
 	.initialize_mc_reg_table = ci_initialize_mc_reg_table,
 	.is_dpm_running = ci_is_dpm_running,
-	.populate_requested_graphic_levels = ci_populate_requested_graphic_levels,
 	.update_dpm_settings = ci_update_dpm_settings,
 };
drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c +0 -66

90 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +0 -64

88 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c +0 -10
index 1ce4959..43b1010 100644
@@ -236,16 +236,6 @@ bool smum_is_dpm_running(struct pp_hwmgr *hwmgr)
 	return true;
 }
 
-int smum_populate_requested_graphic_levels(struct pp_hwmgr *hwmgr,
-		struct amd_pp_profile *request)
-{
-	if (hwmgr->smumgr_funcs->populate_requested_graphic_levels)
-		return hwmgr->smumgr_funcs->populate_requested_graphic_levels(
-				hwmgr, request);
-
-	return 0;
-}
-
 bool smum_is_hw_avfs_present(struct pp_hwmgr *hwmgr)
 {
 	if (hwmgr->smumgr_funcs->is_hw_avfs_present)
drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c +0 -64

87 lines not on this page · raw message

Signature · 6 lines
1.9.1

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

PATCH 3/10 drm/amd/pp: Add new hw interface for auto wattman feature.

In reply to a message not in the archive

Auto wattman feature was used for adjust dpm
optimization settings based on workloads

Change-Id I6e747beb7786c45f733c3c0f9ef9b48c98f0484c
---
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +2 -0
index a3beb31..d9aef88 100644
@@ -347,6 +347,8 @@ struct pp_hwmgr_func {
 					long *input, uint32_t size);
 	int (*set_power_limit)(struct pp_hwmgr *hwmgr, uint32_t n);
 	int (*set_mmhub_powergating_by_smu)(struct pp_hwmgr *hwmgr);
+	int (*update_auto_wattman)(struct pp_hwmgr *hwmgr);
+	void (*start_auto_wattman)(struct pp_hwmgr *hwmgr, bool en);
 };
 
 struct pp_table_func {
Signature · 6 lines
1.9.1

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

PATCH 4/10 drm/amd/pp: Add a work queue for autowattman feature

In reply to a message not in the archive

driver need to monitor the gfx activity and notify smu to change the dpm policy

---
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | 17 +++++++++++++++++
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h   |  3 +++
 2 files changed, 20 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +17 -0
index 51c4ecb..cad71ec 100644
@@ -252,6 +252,20 @@ int hwmgr_early_init(struct pp_instance *handle)
 	return 0;
 }
 
+static void wattman_sample_handler(struct work_struct *work)
+{
+	struct pp_hwmgr *hwmgr =
+		container_of(work, struct pp_hwmgr, wattman_update_work.work);
+
+	if (hwmgr->autowattman_enabled) {
+		if (hwmgr->hwmgr_func->update_auto_wattman != NULL)
+			hwmgr->hwmgr_func->update_auto_wattman(hwmgr);
+
+		if (hwmgr->hwmgr_func->start_auto_wattman != NULL)
+			hwmgr->hwmgr_func->start_auto_wattman(hwmgr, true);
+	}
+}
+
 int hwmgr_hw_init(struct pp_instance *handle)
 {
 	struct pp_hwmgr *hwmgr;
@@ -262,6 +276,8 @@ int hwmgr_hw_init(struct pp_instance *handle)
 
 	hwmgr = handle->hwmgr;
 
+	INIT_DELAYED_WORK(&hwmgr->wattman_update_work, wattman_sample_handler);
+
 	if (hwmgr->pptable_func == NULL ||
 	    hwmgr->pptable_func->pptable_init == NULL ||
 	    hwmgr->hwmgr_func->backend_init == NULL)
@@ -338,6 +354,7 @@ int hwmgr_hw_suspend(struct pp_instance *handle)
 		return -EINVAL;
 
 	hwmgr = handle->hwmgr;
+
 	phm_disable_smc_firmware_ctf(hwmgr);
 	ret = psm_set_boot_states(hwmgr);
 	if (ret)
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +3 -0
index d9aef88..0fb14a1 100644
@@ -40,6 +40,7 @@
 struct pp_atomctrl_voltage_table;
 
 #define VOLTAGE_SCALE 4
+#define WATTMAM_SAMPLE_PERIOD msecs_to_jiffies(100)
 
 uint8_t convert_to_vid(uint16_t vddc);
 uint16_t convert_to_vddc(uint8_t vid);
@@ -758,6 +759,8 @@ struct pp_hwmgr {
 	bool od_enabled;
 	uint32_t power_limit;
 	uint32_t default_power_limit;
+	bool autowattman_enabled;
+	struct delayed_work wattman_update_work;
 };
 
 struct cgs_irq_src_funcs {
Signature · 6 lines
1.9.1

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

PATCH 5/10 drm/amd/pp: Expose new interface to DC to ctrl auto wattman

In reply to a message not in the archive

AutoWattman changes clocks quite aggressively which can make framerates jump significantly and lead to a subpar experience when using Freesync.

Disable AutoWattman (if enabled) when FreeSync is enabled.

Change-Id I1c8e6b6d0d77b8bb3aa5250d4f5aec81270c27f1
---
 drivers/gpu/drm/amd/include/kgd_pp_interface.h |  1 +
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c  | 23 +++++++++++++++++++++++
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c    |  1 +
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h      |  1 +
 4 files changed, 26 insertions(+)
drivers/gpu/drm/amd/include/kgd_pp_interface.h +1 -0
index 7dfba2d..168184e 100644
@@ -306,6 +306,7 @@ struct amd_pm_funcs {
 	int (*set_power_profile_mode)(void *handle, long *input, uint32_t size);
 	int (*odn_edit_dpm_table)(void *handle, uint32_t type, long *input, uint32_t size);
 	int (*set_mmhub_powergating_by_smu)(void *handle);
+	int (*notify_free_sync_change)(void *handle, bool en);
 };
 
 #endif
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +23 -0
index 5f5fbb6..c88f392 100644
@@ -1454,6 +1454,28 @@ static int pp_set_mmhub_powergating_by_smu(void *handle)
 	return hwmgr->hwmgr_func->set_mmhub_powergating_by_smu(hwmgr);
 }
 
+static int pp_notify_free_sync_change(void *handle, bool en)
+{
+	struct pp_hwmgr *hwmgr;
+	struct pp_instance *pp_handle = (struct pp_instance *)handle;
+	int ret = 0;
+
+	ret = pp_check(pp_handle);
+
+	if (ret)
+		return ret;
+
+	hwmgr = pp_handle->hwmgr;
+
+	mutex_lock(&pp_handle->pp_lock);
+	if (hwmgr->autowattman_enabled && hwmgr->hwmgr_func->start_auto_wattman != NULL) {
+		hwmgr->autowattman_mask = en ? true : false;
+		hwmgr->hwmgr_func->start_auto_wattman(hwmgr, en);
+	}
+	mutex_unlock(&pp_handle->pp_lock);
+	return 0;
+}
+
 const struct amd_pm_funcs pp_dpm_funcs = {
 	.load_firmware = pp_dpm_load_fw,
 	.wait_for_fw_loading_complete = pp_dpm_fw_loading_complete,
@@ -1500,4 +1522,5 @@ static int pp_set_mmhub_powergating_by_smu(void *handle)
 	.display_clock_voltage_request = pp_display_clock_voltage_request,
 	.get_display_mode_validation_clocks = pp_get_display_mode_validation_clocks,
 	.set_mmhub_powergating_by_smu = pp_set_mmhub_powergating_by_smu,
+	.notify_free_sync_change = pp_notify_free_sync_change,
 };
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +1 -0
index cad71ec..2fd0417 100644
@@ -175,6 +175,7 @@ int hwmgr_early_init(struct pp_instance *handle)
 	hwmgr_set_user_specify_caps(hwmgr);
 	hwmgr->fan_ctrl_is_in_default_mode = true;
 	hwmgr->reload_fw = 1;
+	hwmgr->autowattman_mask = true;
 
 	switch (hwmgr->chip_family) {
 	case AMDGPU_FAMILY_CI:
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +1 -0
index 0fb14a1..5583a84 100644
@@ -760,6 +760,7 @@ struct pp_hwmgr {
 	uint32_t power_limit;
 	uint32_t default_power_limit;
 	bool autowattman_enabled;
+	bool autowattman_mask;
 	struct delayed_work wattman_update_work;
 };
 
Signature · 6 lines
1.9.1

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

PATCH 6/10 drm/amd/pp: Unified to ctrl autowattman/profile mode

In reply to a message not in the archive

Add a common hw interface to ctrl autowattman feature and restore power profile mode.

when autowattman enabled, start the wattman queue when power state is set. disable this feature when suspend/ enter manual mode.

when autowattman not support, just restore default power profile mode in auto dpm level if it was changed.

FreeSync is enabled, disable or not set power profile mode.

Change-Id Iee4c6a3deb4ba9bdd4fb56c5bca31c6365ccea3a
---
 .../gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c  | 23 ++++++++++++++++++++++
 drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c       |  2 ++
 .../gpu/drm/amd/powerplay/inc/hardwaremanager.h    |  2 ++
 3 files changed, 27 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c +23 -0
index f06f8f4..f97a455 100644
@@ -128,6 +128,29 @@ int phm_force_dpm_levels(struct pp_hwmgr *hwmgr, enum amd_dpm_forced_level level
 	return ret;
 }
 
+int phm_power_profile_ctrl(struct pp_hwmgr *hwmgr, struct pp_power_state *new_ps)
+{
+	if (hwmgr->autowattman_mask) {
+		if (hwmgr->autowattman_enabled && hwmgr->hwmgr_func->start_auto_wattman != NULL) {
+			if ((new_ps != NULL && new_ps->classification.flags & PP_StateClassificationFlag_Boot)
+				|| hwmgr->dpm_level == AMD_DPM_FORCED_LEVEL_MANUAL)
+				hwmgr->hwmgr_func->start_auto_wattman(hwmgr, false);
+			else
+				hwmgr->hwmgr_func->start_auto_wattman(hwmgr, true);
+		} else {
+			if (hwmgr->dpm_level == AMD_DPM_FORCED_LEVEL_AUTO &&
+				hwmgr->default_power_profile_mode != hwmgr->power_profile_mode) {
+				long mode = hwmgr->default_power_profile_mode;
+
+				if (hwmgr->hwmgr_func->set_power_profile_mode != NULL)
+					hwmgr->hwmgr_func->set_power_profile_mode(hwmgr, &mode, 0);
+			}
+		}
+	}
+
+	return 0;
+}
+
 int phm_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,
 				   struct pp_power_state *adjusted_ps,
 			     const struct pp_power_state *current_ps)
drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c +2 -0
index ed3bd15..00c49080 100644
@@ -247,6 +247,8 @@ int psm_adjust_power_state_dynamic(struct pp_hwmgr *hwmgr, bool skip,
 	if (!phm_force_dpm_levels(hwmgr, hwmgr->request_dpm_level))
 		hwmgr->dpm_level = hwmgr->request_dpm_level;
 
+	phm_power_profile_ctrl(hwmgr, new_ps);
+
 	return 0;
 }
 
drivers/gpu/drm/amd/powerplay/inc/hardwaremanager.h +2 -0
index b366a5b..fbe1cd2 100644
@@ -448,5 +448,7 @@ extern int phm_display_clock_voltage_request(struct pp_hwmgr *hwmgr,
 
 extern int phm_get_max_high_clocks(struct pp_hwmgr *hwmgr, struct amd_pp_simple_clock_info *clocks);
 extern int phm_disable_smc_firmware_ctf(struct pp_hwmgr *hwmgr);
+extern int phm_power_profile_ctrl(struct pp_hwmgr *hwmgr, struct pp_power_state *new_ps);
+
 #endif /* _HARDWARE_MANAGER_H_ */
 
Signature · 6 lines
1.9.1

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

PATCH 7/10 drm/amd/PP: Delete dead code in vega10

In reply to a message not in the archive

Do not need to restore default power profile mode
when force dpm level.

Change-Id Ib9cabf5efe2bbacd5987598acb79221b4ad4d567
---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -5
index 1416d2a..22a42c9 100644
@@ -4164,11 +4164,6 @@ static int vega10_dpm_force_dpm_level(struct pp_hwmgr *hwmgr,
 		break;
 	case AMD_DPM_FORCED_LEVEL_AUTO:
 		ret = vega10_unforce_dpm_levels(hwmgr);
-		if (hwmgr->default_power_profile_mode != hwmgr->power_profile_mode) {
-				smum_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_SetWorkloadMask,
-						1 << hwmgr->default_power_profile_mode);
-				hwmgr->power_profile_mode = hwmgr->default_power_profile_mode;
-		}
 		break;
 	case AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD:
 	case AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK:
Signature · 6 lines
1.9.1

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

PATCH 8/10 drm/amd/pp: Implement AutoWattman feature on Vega10

In reply to a message not in the archive

based on the engine activity read from smu, driver will notify smu to adjust the behaviour of natural DPM.

Change-Id I951390cae82eeacfdaea3917eb570aa57216cbd7
---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 65 +++++++++++++++++++++-
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.h | 11 +++-
 2 files changed, 73 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +64 -1
index 22a42c9..2336f1f 100644
@@ -766,7 +766,7 @@ static int vega10_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
 	vega10_set_default_registry_data(hwmgr);
 
 	data->disable_dpm_mask = 0xff;
-	data->workload_mask = 0xff;
+	data->workload_index = 0xff;
 
 	/* need to set voltage control types before EVV patching */
 	data->vddc_control = VEGA10_VOLTAGE_CONTROL_NONE;
@@ -4942,6 +4942,67 @@ static int vega10_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, ui
 	return 0;
 }
 
+static void vega10_start_auto_wattman(struct pp_hwmgr *hwmgr, bool en)
+{
+	if (en)
+		schedule_delayed_work(&hwmgr->wattman_update_work, WATTMAM_SAMPLE_PERIOD);
+	else
+		cancel_delayed_work_sync(&hwmgr->wattman_update_work);
+}
+
+static void vega10_auto_wattman_get_data(struct pp_hwmgr *hwmgr)
+{
+	struct vega10_hwmgr *data = (struct vega10_hwmgr *)(hwmgr->backend);
+	uint32_t activity_percent;
+
+	smum_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_GetAverageGfxActivity, 0);
+	vega10_read_arg_from_smc(hwmgr, &activity_percent);
+	data->wattman_data.average_sclk_busy = activity_percent > 100 ? 100 : activity_percent;
+
+	pr_debug("average sclk busy: %d\n", data->wattman_data.average_sclk_busy);
+
+	return;
+}
+
+#define Vega10_AutoWattMan_Setting_Max 5
+
+uint32_t Vega10_AutoWattMan_Setting[Vega10_AutoWattMan_Setting_Max] = {
+				PP_SMC_POWER_PROFILE_POWERSAVING,
+				PP_SMC_POWER_PROFILE_VIDEO,
+				PP_SMC_POWER_PROFILE_FULLSCREEN3D,
+				PP_SMC_POWER_PROFILE_VR,
+				PP_SMC_POWER_PROFILE_COMPUTE};
+
+static void vega10_auto_wattman_algorithm(struct pp_hwmgr *hwmgr)
+{
+	struct vega10_hwmgr *data = (struct vega10_hwmgr *)(hwmgr->backend);
+	uint32_t threshold = AutoWattmanAlgorithmThreshold;
+
+	if (data->wattman_data.average_sclk_busy < threshold){
+		if (data->workload_index > 0)
+			data->workload_index -= 1;
+	} else {
+		if (data->workload_index < (Vega10_AutoWattMan_Setting_Max - 1))
+			data->workload_index += 1;
+	}
+}
+
+static int vega10_update_auto_wattman(struct pp_hwmgr *hwmgr)
+{
+	struct vega10_hwmgr *data = (struct vega10_hwmgr *)(hwmgr->backend);
+
+	vega10_auto_wattman_get_data(hwmgr);
+	vega10_auto_wattman_algorithm(hwmgr);
+
+	if (hwmgr->power_profile_mode != Vega10_AutoWattMan_Setting[data->workload_index]) {
+		hwmgr->power_profile_mode = Vega10_AutoWattMan_Setting[data->workload_index];
+		smum_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_SetWorkloadMask,
+						1<<hwmgr->power_profile_mode);
+	}
+
+	return 0;
+}
+
 static const struct pp_hwmgr_func vega10_hwmgr_funcs = {
 	.backend_init = vega10_hwmgr_backend_init,
 	.backend_fini = vega10_hwmgr_backend_fini,
@@ -5000,6 +5061,8 @@ static int vega10_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, ui
 	.get_power_profile_mode = vega10_get_power_profile_mode,
 	.set_power_profile_mode = vega10_set_power_profile_mode,
 	.set_power_limit = vega10_set_power_limit,
+	.update_auto_wattman = vega10_update_auto_wattman,
+	.start_auto_wattman = vega10_start_auto_wattman,
 };
 
 int vega10_hwmgr_init(struct pp_hwmgr *hwmgr)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.h +9 -2
index ab3e879..a12c170 100644
@@ -36,6 +36,8 @@
 #define WaterMarksExist  1
 #define WaterMarksLoaded 2
 
+#define AutoWattmanAlgorithmThreshold 80
+
 enum {
 	GNLD_DPM_PREFETCHER = 0,
 	GNLD_DPM_GFXCLK,
@@ -299,6 +301,11 @@ struct vega10_odn_fan_table {
 	uint32_t	min_fan_limit;
 };
 
+struct vega10_auto_wattman_data {
+	uint32_t   average_sclk_busy;
+	uint32_t   average_mclk_busy;
+};
+
 struct vega10_hwmgr {
 	struct vega10_dpm_table			dpm_table;
 	struct vega10_dpm_table			golden_dpm_table;
@@ -374,8 +381,8 @@ struct vega10_hwmgr {
 	uint32_t                       apply_overdrive_next_settings_mask;
 
 	/* ---- Workload Mask ---- */
-	uint32_t                       workload_mask;
-
+	uint32_t                       workload_index;
+	struct vega10_auto_wattman_data         wattman_data;
 	/* ---- SMU9 ---- */
 	struct smu_features            smu_features[GNLD_FEATURES_MAX];
 	struct vega10_smc_state_table  smc_state_table;
Signature · 6 lines
1.9.1

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

PATCH 9/10 drm/amd/pp: Implement auto wattman feature on Smu7

In reply to a message not in the archive

Adjust dpm optimization settings on smu7 based on the activity level read from SMU.
in manual dpm mode, auto wattman will be disabled.

Change-Id I68396f04be76793ece3b07f0ac1b646981ca1e29
---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 218 ++++++++++++++++++++++-
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.h |  26 +++
 2 files changed, 239 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +213 -5
index cb75c4f..0e7f986 100644
@@ -82,7 +82,6 @@
 #define TCLK                        (PCIE_BUS_CLK / 10)
 
 static int smu7_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, uint32_t size);
-
 static const struct profile_mode_setting smu7_profiling[5] =
 					{{1, 0, 100, 30, 1, 0, 100, 10},
 					 {1, 10, 0, 30, 0, 0, 0, 0},
@@ -2527,9 +2526,10 @@ static int smu7_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
 			data->pcie_gen_cap = AMDGPU_DEFAULT_PCIE_GEN_MASK;
 		else
 			data->pcie_gen_cap = (uint32_t)sys_info.value;
+
 		if (data->pcie_gen_cap & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3)
 			data->pcie_spc_cap = 20;
-		sys_info.size = sizeof(struct cgs_system_info);
+
 		sys_info.info_id = CGS_SYSTEM_INFO_PCIE_MLW;
 		result = cgs_query_system_info(hwmgr->device, &sys_info);
 		if (result)
@@ -2537,6 +2537,11 @@ static int smu7_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
 		else
 			data->pcie_lane_cap = (uint32_t)sys_info.value;
 
+		sys_info.info_id = CGS_SYSTEM_INFO_VRAM_WIDTH;
+		result = cgs_query_system_info(hwmgr->device, &sys_info);
+		if (!result)
+			data->memory_bit_width = (uint32_t)sys_info.value;
+
 		hwmgr->platform_descriptor.vbiosInterruptId = 0x20000400; /* IRQ_SOURCE1_SW_INT */
 /* The true clock step depends on the frequency, typically 4.5 or 9 MHz. Here we use 5. */
 		hwmgr->platform_descriptor.clockStep.engineClock = 500;
@@ -2772,10 +2777,17 @@ static int smu7_force_dpm_level(struct pp_hwmgr *hwmgr,
 		ret = smu7_force_dpm_lowest(hwmgr);
 		break;
 	case AMD_DPM_FORCED_LEVEL_AUTO:
-		if (hwmgr->default_power_profile_mode != hwmgr->power_profile_mode) {
-			long mode = hwmgr->default_power_profile_mode;
+		if (hwmgr->autowattman_enabled) {
+			if (hwmgr->hwmgr_func->start_auto_wattman != NULL) {
+				if (!cancel_delayed_work_sync(&hwmgr->wattman_update_work))
+					hwmgr->hwmgr_func->start_auto_wattman(hwmgr, true);
+			}
+		} else {
+			if (hwmgr->default_power_profile_mode != hwmgr->power_profile_mode) {
+				long mode = hwmgr->default_power_profile_mode;
 
-			smu7_set_power_profile_mode(hwmgr, &mode, 0);
+				smu7_set_power_profile_mode(hwmgr, &mode, 0);
+			}
 		}
 		if (hwmgr->chip_id == CHIP_FIJI)
 			smu7_enable_power_containment(hwmgr);
@@ -2794,6 +2806,11 @@ static int smu7_force_dpm_level(struct pp_hwmgr *hwmgr,
 		smu7_force_clock_level(hwmgr, PP_PCIE, 1<<pcie_mask);
 		break;
 	case AMD_DPM_FORCED_LEVEL_MANUAL:
+		if (hwmgr->autowattman_enabled) {
+			if (hwmgr->hwmgr_func->start_auto_wattman != NULL)
+				hwmgr->hwmgr_func->start_auto_wattman(hwmgr, false);
+		}
+		break;
 	case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
 	default:
 		break;
@@ -5025,6 +5042,195 @@ static int smu7_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, uint
 	return 0;
 }
 
+static void smu7_start_auto_wattman(struct pp_hwmgr *hwmgr, bool en)
+{
+	if (en) {
+		smum_send_msg_to_smc(hwmgr, PPSMC_MSG_PmStatusLogStart);
+		schedule_delayed_work(&hwmgr->wattman_update_work, WATTMAM_SAMPLE_PERIOD);
+	} else {
+		cancel_delayed_work_sync(&hwmgr->wattman_update_work);
+	}
+}
+
+static void smu7_auto_wattman_get_data(struct pp_hwmgr *hwmgr)
+{
+	struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
+
+	data->wattman_data.average_sclk_busy = cgs_read_ind_register(
+							hwmgr->device,
+							CGS_IND_REG__SMC,
+							ixSMU_PM_STATUS_91);
+	data->wattman_data.average_sclk_busy >>= 8;
+
+	data->wattman_data.average_mclk_busy = cgs_read_ind_register(
+							hwmgr->device,
+							CGS_IND_REG__SMC,
+							ixSMU_PM_STATUS_92);
+
+	data->wattman_data.average_mclk_busy >>= 8;
+
+	data->wattman_data.effective_sclk = cgs_read_ind_register(
+							hwmgr->device,
+							CGS_IND_REG__SMC,
+							ixSMU_PM_STATUS_77);
+
+	data->wattman_data.effective_mclk = cgs_read_ind_register(
+							hwmgr->device,
+							CGS_IND_REG__SMC,
+							ixSMU_PM_STATUS_111);
+
+	pr_debug("effective sclk: %x average sclk busy: %x\n",
+					data->wattman_data.effective_sclk,
+					data->wattman_data.average_sclk_busy);
+	pr_debug("effective mclk: %x average mclk busy: %x\n",
+					data->wattman_data.effective_mclk,
+					data->wattman_data.average_mclk_busy);
+
+	return;
+}
+
+static int smu7_auto_wattman_update_clk_setting(struct pp_hwmgr *hwmgr,
+			struct smu7_auto_wattman_adjust_settings *setting,
+			uint32_t clk_busy, uint32_t threshold)
+{
+	uint32_t adjust_factor = 0;
+	uint32_t divide_factor = 0;
+
+	if (setting == NULL)
+		return -EINVAL;
+
+	if (clk_busy < threshold) {
+		divide_factor = threshold / AutoWattmanAlgorithmMaxAdjustFactor;
+		adjust_factor = AutoWattmanAlgorithmMaxAdjustFactor - (clk_busy / divide_factor);
+		setting->uphyst_adjust = adjust_factor;
+		setting->uphyst_polarity = 1;
+		setting->downhyst_adjust = 6 * adjust_factor;
+		setting->downhyst_polarity = 0;
+		setting->activity_adjust = 2 * adjust_factor;
+		setting->activity_polarity = 1;
+	} else {
+		divide_factor = (100 - threshold) / AutoWattmanAlgorithmMaxAdjustFactor;
+		adjust_factor = (clk_busy - threshold + divide_factor - 1) / divide_factor;
+		setting->uphyst_adjust = adjust_factor;
+		setting->uphyst_polarity = 0;
+		setting->downhyst_adjust = 6 * adjust_factor;
+		setting->downhyst_polarity = 1;
+		setting->activity_adjust = 2 * adjust_factor;
+		setting->activity_polarity = 0;
+	}
+
+	return 0;
+}
+
+static void smu7_auto_wattman_algorithm(struct pp_hwmgr *hwmgr)
+{
+	struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
+	uint32_t threshold = 0x32;
+
+	smu7_auto_wattman_update_clk_setting(hwmgr, &data->sclk_settings,
+				data->wattman_data.average_sclk_busy, threshold);
+
+	if (data->memory_bit_width == 64)
+		threshold = 0xA;
+	else if (hwmgr->chip_id == CHIP_POLARIS12)
+		threshold = 0xF;
+	else
+		threshold = 0x14;
+
+	smu7_auto_wattman_update_clk_setting(hwmgr, &data->mclk_settings,
+				data->wattman_data.average_mclk_busy, threshold);
+}
+
+static int smu7_auto_wattman_get_adjust_setting(uint32_t low_limit, uint32_t high_limit,
+						uint32_t polarity, uint32_t adjust_value,
+						uint32_t original_setting)
+{
+	if (!polarity) {
+		if (original_setting < low_limit + adjust_value)
+			original_setting = low_limit;
+		else
+			original_setting -= adjust_value;
+	} else {
+		if ((high_limit < adjust_value) || (high_limit - adjust_value < original_setting))
+			original_setting = high_limit;
+		else
+			original_setting += adjust_value;
+	}
+
+	return original_setting;
+}
+
+static int smu7_update_auto_wattman(struct pp_hwmgr *hwmgr)
+{
+	struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
+	struct profile_mode_setting tmp;
+	uint32_t high_limit, low_limit;
+
+	high_limit = AutoWattmanSCLKHighLimits;
+	low_limit = AutoWattmanSCLKLowLimits;
+
+	smu7_auto_wattman_get_data(hwmgr);
+	smu7_auto_wattman_algorithm(hwmgr);
+
+	tmp.sclk_up_hyst = smu7_auto_wattman_get_adjust_setting(low_limit & 0xff,
+							high_limit & 0xff,
+							data->sclk_settings.uphyst_polarity,
+							data->sclk_settings.uphyst_adjust,
+							data->current_profile_setting.sclk_up_hyst);
+
+	tmp.sclk_down_hyst = smu7_auto_wattman_get_adjust_setting((low_limit >> 8) & 0xff,
+							(high_limit >> 8) & 0xff,
+							data->sclk_settings.downhyst_polarity,
+							data->sclk_settings.downhyst_adjust,
+							data->current_profile_setting.sclk_down_hyst);
+
+	tmp.sclk_activity = smu7_auto_wattman_get_adjust_setting((low_limit >> 16) & 0xffff,
+							(high_limit >> 16) & 0xffff,
+							data->sclk_settings.activity_polarity,
+							data->sclk_settings.activity_adjust,
+							data->current_profile_setting.sclk_activity);
+
+	if ((tmp.sclk_up_hyst == data->current_profile_setting.sclk_up_hyst) &&
+		(tmp.sclk_down_hyst == data->current_profile_setting.sclk_down_hyst) &&
+		(tmp.sclk_activity == data->current_profile_setting.sclk_activity))
+		tmp.bupdate_sclk = false;
+	else
+		tmp.bupdate_sclk = true;
+
+	high_limit = AutoWattmanMCLKHighLimits;
+	low_limit = AutoWattmanMCLKLowLimits;
+
+	tmp.mclk_up_hyst = smu7_auto_wattman_get_adjust_setting(low_limit && 0xff,
+							high_limit && 0xff,
+							data->mclk_settings.uphyst_polarity,
+							data->mclk_settings.uphyst_adjust,
+							data->current_profile_setting.mclk_up_hyst);
+
+	tmp.mclk_down_hyst  = smu7_auto_wattman_get_adjust_setting((low_limit >> 8) && 0xff,
+							(high_limit >> 8) && 0xff,
+							data->mclk_settings.downhyst_polarity,
+							data->mclk_settings.downhyst_adjust,
+							data->current_profile_setting.mclk_down_hyst);
+
+	tmp.mclk_activity  = smu7_auto_wattman_get_adjust_setting((low_limit >> 16) && 0xffff,
+							(high_limit >> 16) && 0xffff,
+							data->mclk_settings.activity_polarity,
+							data->mclk_settings.activity_adjust,
+							data->current_profile_setting.mclk_activity);
+
+	if ((tmp.mclk_up_hyst == data->current_profile_setting.mclk_up_hyst) &&
+		(tmp.mclk_down_hyst == data->current_profile_setting.mclk_down_hyst) &&
+		(tmp.mclk_activity == data->current_profile_setting.mclk_activity))
+		tmp.bupdate_mclk = false;
+	else
+		tmp.bupdate_mclk = true;
+
+	if (!smum_update_dpm_settings(hwmgr, &tmp) && ((tmp.bupdate_mclk) || tmp.bupdate_mclk))
+		memcpy(&data->current_profile_setting, &tmp, sizeof(struct profile_mode_setting));
+
+	return 0;
+}
+
 static const struct pp_hwmgr_func smu7_hwmgr_funcs = {
 	.backend_init = &smu7_hwmgr_backend_init,
 	.backend_fini = &smu7_hwmgr_backend_fini,
@@ -5081,6 +5287,8 @@ static int smu7_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, uint
 	.set_power_limit = smu7_set_power_limit,
 	.get_power_profile_mode = smu7_get_power_profile_mode,
 	.set_power_profile_mode = smu7_set_power_profile_mode,
+	.update_auto_wattman = smu7_update_auto_wattman,
+	.start_auto_wattman = smu7_start_auto_wattman,
 };
 
 uint8_t smu7_get_sleep_divider_id_from_clock(uint32_t clock,
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.h +26 -0
index 3bcfc61..9f61507 100644
@@ -186,6 +186,21 @@ struct smu7_odn_dpm_table {
 	uint32_t					odn_mclk_min_limit;
 };
 
+#define AutoWattmanSCLKHighLimits 0x002D3C0A
+#define AutoWattmanSCLKLowLimits 0x00190000
+#define AutoWattmanMCLKHighLimits 0x002D3C0A
+#define AutoWattmanMCLKLowLimits 0x000A1000
+#define AutoWattmanAlgorithmMaxAdjustFactor 5
+
+struct smu7_auto_wattman_adjust_settings {
+	uint32_t  uphyst_adjust;
+	uint32_t  uphyst_polarity;
+	uint32_t  downhyst_adjust;
+	uint32_t  downhyst_polarity;
+	uint32_t  activity_adjust;
+	uint32_t  activity_polarity;
+};
+
 struct profile_mode_setting {
 	uint8_t bupdate_sclk;
 	uint8_t sclk_up_hyst;
@@ -197,6 +212,13 @@ struct profile_mode_setting {
 	uint16_t mclk_activity;
 };
 
+struct smu7_auto_wattman_data {
+	uint32_t   effective_sclk;
+	uint32_t   effective_mclk;
+	uint32_t   average_sclk_busy;
+	uint32_t   average_mclk_busy;
+};
+
 struct smu7_hwmgr {
 	struct smu7_dpm_table			dpm_table;
 	struct smu7_dpm_table			golden_dpm_table;
@@ -327,6 +349,10 @@ struct smu7_hwmgr {
 	uint32_t                              vr_config;
 	struct profile_mode_setting           custom_profile_setting;
 	struct profile_mode_setting           current_profile_setting;
+	struct smu7_auto_wattman_data         wattman_data;
+	uint32_t                              memory_bit_width;
+	struct smu7_auto_wattman_adjust_settings sclk_settings;
+	struct smu7_auto_wattman_adjust_settings mclk_settings;
 };
 
 /* To convert to Q8.8 format for firmware */
Signature · 6 lines
1.9.1

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

PATCH 10/10 drm/amd/pp: Enable auto automan feature on Vega10

In reply to a message not in the archive
Change-Id I7bd4dc5b255ed3edcb28f6c770e7b0199d0662d4
---
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +3 -0
index 2fd0417..0c05024 100644
@@ -228,6 +228,8 @@ int hwmgr_early_init(struct pp_instance *handle)
 	case AMDGPU_FAMILY_AI:
 		switch (hwmgr->chip_id) {
 		case CHIP_VEGA10:
+			if (hwmgr->feature_mask & PP_AUTOWATTMAN_MASK)
+				hwmgr->autowattman_enabled = true; /* currently only enabled on vega10 */
 			hwmgr->smumgr_funcs = &vega10_smu_funcs;
 			vega10_hwmgr_init(hwmgr);
 			break;
@@ -1022,6 +1024,7 @@ int polaris_set_asic_special_caps(struct pp_hwmgr *hwmgr)
 		phm_cap_set(hwmgr->platform_descriptor.platformCaps,
 							PHM_PlatformCaps_TCPRamping);
 	}
+
 	return 0;
 }
 
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#11 lore raw
In reply to a message not in the archive

Am 24.02.2018 um 14:55 schrieb Rex Zhu:

Quoted 3 lines

Add new power profile sysfs: pp_power_profile_mode old sysfs: pp_compute_power_profile/pp_gfx_power_profile will be removed

Well sysfs is supposed to be stable, so removing the old interface won't be allowed.

Quoted 12 lines
Change-Id Ief35efb81b313115b33c430dfb328ad83ce7975d
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 1 +
  1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
index 69cf490..4c92239 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c line 81

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -0
@@ -75,6 +75,7 @@
   * - 3.23.0 - Add query for VRAM lost counter
   * - 3.24.0 - Add high priority compute support for gfx9
   * - 3.25.0 - Add support for sensor query info (stable pstate sclk/mclk).
+ * - 3.26.0 - Delete old gfx/compute profile sysfs, add common profile sysfs.
   */
  #define KMS_DRIVER_MAJOR	3
  #define KMS_DRIVER_MINOR	25

Well you actually also need to bump the version, e.g. modify KMS_DRIVER_MINOR.

Christian.
_______________________________________________
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): 01527bb2-ea10-60a2-46e5-b635bda11ae7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

author
#13 lore raw

We have added new sysfs pp_power_profile_mode.

The old sysfs (pp_compute_power_profile and pp_gfx_power_profile)
were used internally currently by ROCM tool and KFD to switch mode between gfx and compute only on VI/CI asics. We can't extend more modes for other workloads, for example: video, power saving mode,etc. And the old sysfs can't support VEGA.

With new sysfs, User can switch mode based on workloads(video, power save, gfx, compute, VR), or configure custom mode.

To avoid conflicts and confusion, I think better remove two old sysfs.

Best Regards
Rex
-----Original Message-----
From: Christian König [mailto:[email protected]]
Sent: Sunday, February 25, 2018 9:19 PM
To: Zhu, Rex; [email protected]
Subject: Re: [PATCH 01/10] drm/amdgpu: bump version for new power profile sysfs

Am 24.02.2018 um 14:55 schrieb Rex Zhu:

Quoted 3 lines

Add new power profile sysfs: pp_power_profile_mode old sysfs:
pp_compute_power_profile/pp_gfx_power_profile
will be removed

Well sysfs is supposed to be stable, so removing the old interface won't be allowed.

Quoted 13 lines
Change-Id Ief35efb81b313115b33c430dfb328ad83ce7975d
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 1 +
  1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
index 69cf490..4c92239 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c line 81

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -0
@@ -75,6 +75,7 @@
   * - 3.23.0 - Add query for VRAM lost counter
   * - 3.24.0 - Add high priority compute support for gfx9
   * - 3.25.0 - Add support for sensor query info (stable pstate sclk/mclk).
+ * - 3.26.0 - Delete old gfx/compute profile sysfs, add common profile sysfs.
   */
  #define KMS_DRIVER_MAJOR	3
  #define KMS_DRIVER_MINOR	25

Well you actually also need to bump the version, e.g. modify KMS_DRIVER_MINOR.

Christian.
_______________________________________________
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): CY4PR12MB1687E52188F4E891D3447270FBC10-rpdhrqHFk06Y0SjTqZDccQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#15 lore raw
Quoted 1 line

To avoid conflicts and confusion, I think better remove two old sysfs.

Well that is not a matter of personal opinion. The rule is simply that sysfs needs to be stable, otherwise we can't upstream a sysfs interface.

Especially since you already noted that current ROCM tool and KFD depend on them.

What we can argue is that if this never worked on Vega10 we can remove it for Vega10 but keep it for older ASICs.

Alternative we can have some sort of compatibility code which translates the old interface into the new one, e.g. in this case I think a simple symlink should do.

Regards,
Christian.

Am 26.02.2018 um 03:54 schrieb Zhu, Rex:

Quoted 47 lines

We have added new sysfs pp_power_profile_mode.

The old sysfs (pp_compute_power_profile and pp_gfx_power_profile)
were used internally currently by ROCM tool and KFD to switch mode between gfx and compute only on VI/CI asics. We can't extend more modes for other workloads, for example: video, power saving mode,etc. And the old sysfs can't support VEGA.

With new sysfs, User can switch mode based on workloads(video, power save, gfx, compute, VR), or configure custom mode.

To avoid conflicts and confusion, I think better remove two old sysfs.

Best Regards
Rex
-----Original Message-----
From: Christian König [mailto:[email protected]]
Sent: Sunday, February 25, 2018 9:19 PM
To: Zhu, Rex; [email protected]
Subject: Re: [PATCH 01/10] drm/amdgpu: bump version for new power profile sysfs

Am 24.02.2018 um 14:55 schrieb Rex Zhu:

Quoted 3 lines

Add new power profile sysfs: pp_power_profile_mode old sysfs:
pp_compute_power_profile/pp_gfx_power_profile
will be removed

Well sysfs is supposed to be stable, so removing the old interface won't be allowed.

Quoted 12 lines
Change-Id Ief35efb81b313115b33c430dfb328ad83ce7975d
---
   drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 1 +
   1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
index 69cf490..4c92239 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c line 81

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -0
@@ -75,6 +75,7 @@
    * - 3.23.0 - Add query for VRAM lost counter
    * - 3.24.0 - Add high priority compute support for gfx9
    * - 3.25.0 - Add support for sensor query info (stable pstate sclk/mclk).
+ * - 3.26.0 - Delete old gfx/compute profile sysfs, add common profile sysfs.
    */
   #define KMS_DRIVER_MAJOR	3
   #define KMS_DRIVER_MINOR	25

Well you actually also need to bump the version, e.g. modify KMS_DRIVER_MINOR.

Quoted 1 line

Christian.

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