Skip to contentSkip to conversation

The new SW SMU driver of amdgpu

PATCH In review Huang Rui 2 participants 141 messages Jan 25, 2019 – Feb 20, 2019 2 messages not in the archive Page 2 of 2

Subsystems (3)
lore
Share & tools
lore
author
#138 lore raw

PATCH 137/138 drm/amd/powerplay: Unify smu handle task function

In reply to a message not in the archive

From: Likun Gao <[email protected]>

Unify power stade adjust function into smu_handle_task by the judgment of task_id.
Move functions which have no relationship with smu version into the file of amdgpu_smu.
Modified the function of smu_display_config_changed into two part. Unify some similiar function.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c         |  46 +++--
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c     | 127 ++++++++++++
 drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h |  31 +++
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c     | 258 ++++++-------------------
 4 files changed, 250 insertions(+), 212 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +28 -18
index 97027b4..c37264b 100644
@@ -2608,28 +2608,38 @@ void amdgpu_pm_compute_clocks(struct amdgpu_device *adev)
 			amdgpu_fence_wait_empty(ring);
 	}
 
-	if (adev->powerplay.pp_funcs->dispatch_tasks) {
-		if (!amdgpu_device_has_dc_support(adev)) {
+	if (is_support_sw_smu(adev)) {
+		struct smu_context *smu = &adev->smu;
+		struct smu_dpm_context *smu_dpm = &adev->smu.smu_dpm;
+		mutex_lock(&(smu->mutex));
+		smu_handle_task(&adev->smu,
+				smu_dpm->dpm_level,
+				AMD_PP_TASK_DISPLAY_CONFIG_CHANGE);
+		mutex_unlock(&(smu->mutex));
+	} else {
+		if (adev->powerplay.pp_funcs->dispatch_tasks) {
+			if (!amdgpu_device_has_dc_support(adev)) {
+				mutex_lock(&adev->pm.mutex);
+				amdgpu_dpm_get_active_displays(adev);
+				adev->pm.pm_display_cfg.num_display = adev->pm.dpm.new_active_crtc_count;
+				adev->pm.pm_display_cfg.vrefresh = amdgpu_dpm_get_vrefresh(adev);
+				adev->pm.pm_display_cfg.min_vblank_time = amdgpu_dpm_get_vblank_time(adev);
+				/* we have issues with mclk switching with refresh rates over 120 hz on the non-DC code. */
+				if (adev->pm.pm_display_cfg.vrefresh > 120)
+					adev->pm.pm_display_cfg.min_vblank_time = 0;
+				if (adev->powerplay.pp_funcs->display_configuration_change)
+					adev->powerplay.pp_funcs->display_configuration_change(
+									adev->powerplay.pp_handle,
+									&adev->pm.pm_display_cfg);
+				mutex_unlock(&adev->pm.mutex);
+			}
+			amdgpu_dpm_dispatch_task(adev, AMD_PP_TASK_DISPLAY_CONFIG_CHANGE, NULL);
+		} else {
 			mutex_lock(&adev->pm.mutex);
 			amdgpu_dpm_get_active_displays(adev);
-			adev->pm.pm_display_cfg.num_display = adev->pm.dpm.new_active_crtc_count;
-			adev->pm.pm_display_cfg.vrefresh = amdgpu_dpm_get_vrefresh(adev);
-			adev->pm.pm_display_cfg.min_vblank_time = amdgpu_dpm_get_vblank_time(adev);
-			/* we have issues with mclk switching with refresh rates over 120 hz on the non-DC code. */
-			if (adev->pm.pm_display_cfg.vrefresh > 120)
-				adev->pm.pm_display_cfg.min_vblank_time = 0;
-			if (adev->powerplay.pp_funcs->display_configuration_change)
-				adev->powerplay.pp_funcs->display_configuration_change(
-								adev->powerplay.pp_handle,
-								&adev->pm.pm_display_cfg);
+			amdgpu_dpm_change_power_state_locked(adev);
 			mutex_unlock(&adev->pm.mutex);
 		}
-		amdgpu_dpm_dispatch_task(adev, AMD_PP_TASK_DISPLAY_CONFIG_CHANGE, NULL);
-	} else {
-		mutex_lock(&adev->pm.mutex);
-		amdgpu_dpm_get_active_displays(adev);
-		amdgpu_dpm_change_power_state_locked(adev);
-		mutex_unlock(&adev->pm.mutex);
 	}
 }
 
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +127 -0

133 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +31 -0
index f1b136e..62e4ed8 100644
@@ -437,6 +437,18 @@ struct pptable_funcs {
 	int (*set_power_profile_mode)(struct smu_context *smu, long *input, uint32_t size);
 	enum amd_dpm_forced_level (*get_performance_level)(struct smu_context *smu);
 	int (*force_performance_level)(struct smu_context *smu, enum amd_dpm_forced_level level);
+	int (*pre_display_config_changed)(struct smu_context *smu);
+	int (*display_config_changed)(struct smu_context *smu);
+	int (*apply_clocks_adjust_rules)(struct smu_context *smu);
+	int (*notify_smc_dispaly_config)(struct smu_context *smu);
+	int (*force_dpm_limit_value)(struct smu_context *smu, bool highest);
+	int (*upload_dpm_level)(struct smu_context *smu, bool max);
+	int (*get_profiling_clk_mask)(struct smu_context *smu,
+				      enum amd_dpm_forced_level level,
+				      uint32_t *sclk_mask,
+				      uint32_t *mclk_mask,
+				      uint32_t *soc_mask);
+	int (*set_cpu_power_state)(struct smu_context *smu);
 };
 
 struct smu_funcs
@@ -628,6 +640,22 @@ struct smu_funcs
 	((smu)->ppt_funcs->get_performance_level ? (smu)->ppt_funcs->get_performance_level((smu)) : 0)
 #define smu_force_performance_level(smu, level) \
 	((smu)->ppt_funcs->force_performance_level ? (smu)->ppt_funcs->force_performance_level((smu), (level)) : 0)
+#define smu_pre_display_config_changed(smu) \
+	((smu)->ppt_funcs->pre_display_config_changed ? (smu)->ppt_funcs->pre_display_config_changed((smu)) : 0)
+#define smu_display_config_changed(smu) \
+	((smu)->ppt_funcs->display_config_changed ? (smu)->ppt_funcs->display_config_changed((smu)) : 0)
+#define smu_apply_clocks_adjust_rules(smu) \
+	((smu)->ppt_funcs->apply_clocks_adjust_rules ? (smu)->ppt_funcs->apply_clocks_adjust_rules((smu)) : 0)
+#define smu_notify_smc_dispaly_config(smu) \
+	((smu)->ppt_funcs->notify_smc_dispaly_config ? (smu)->ppt_funcs->notify_smc_dispaly_config((smu)) : 0)
+#define smu_force_dpm_limit_value(smu, highest) \
+	((smu)->ppt_funcs->force_dpm_limit_value ? (smu)->ppt_funcs->force_dpm_limit_value((smu), (highest)) : 0)
+#define smu_upload_dpm_level(smu, max) \
+	((smu)->ppt_funcs->upload_dpm_level ? (smu)->ppt_funcs->upload_dpm_level((smu), (max)) : 0)
+#define smu_get_profiling_clk_mask(smu, level, sclk_mask, mclk_mask, soc_mask) \
+	((smu)->ppt_funcs->get_profiling_clk_mask ? (smu)->ppt_funcs->get_profiling_clk_mask((smu), (level), (sclk_mask), (mclk_mask), (soc_mask)) : 0)
+#define smu_set_cpu_power_state(smu) \
+	((smu)->ppt_funcs->set_cpu_power_state ? (smu)->ppt_funcs->set_cpu_power_state((smu)) : 0)
 
 #define smu_msg_get_index(smu, msg) \
 	((smu)->ppt_funcs? ((smu)->ppt_funcs->get_smu_msg_index? (smu)->ppt_funcs->get_smu_msg_index((smu), (msg)) : -EINVAL) : -EINVAL)
@@ -698,4 +726,7 @@ extern int smu_display_configuration_change(struct smu_context *smu, const
 extern int smu_get_current_clocks(struct smu_context *smu,
 				  struct amd_pp_clock_info *clocks);
 extern int smu_dpm_set_power_gate(struct smu_context *smu,uint32_t block_type, bool gate);
+extern int smu_handle_task(struct smu_context *smu,
+			   enum amd_dpm_forced_level level,
+			   enum amd_pp_task task_id);
 #endif
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +64 -194

376 lines not on this page · raw message

Signature · 6 lines
2.7.4

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

PATCH 138/138 drm/amd/powerplay: enable amdgpu dpm for smu

In reply to a message not in the archive

From: Kevin Wang <[email protected]>

enable amdgpu dpm global flag

---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +2 -0
index 5c9c7e1..c3176e4 100644
@@ -734,6 +734,8 @@ static int smu_hw_init(void *handle)
 
 	mutex_unlock(&smu->mutex);
 
+	adev->pm.dpm_enabled = true;
+
 	pr_info("SMU is initialized successfully!\n");
 
 	return 0;
Signature · 6 lines
2.7.4

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

Ping.
May I have your comments?

Thanks,
Ray

Quoted 277 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Huang Rui
Sent: Friday, January 25, 2019 6:23 PM
To: [email protected]
Cc: Gao, Likun <[email protected]>; Wang, Kevin(Yang) <[email protected]>; Huang, Ray <[email protected]>; Gui, Jack <[email protected]>
Subject: [PATCH 000/138] The new SW SMU driver of amdgpu

Hi all,

The series of patches are to implement a new SW SMU driver for future asics.

Background:
The powerplay driver will be retired. The final version is for vega20 with SMU11. However, the future asic will use the new swSMU framework to implement as
well. Here is the first version of new sw smu driver that is basing on vega20.

Purpose:
We would like to do re-arch for linux power codes to use a new sw SMU ip block
for future asics. We hope to write a simple and readable framework for Linux.

Currently, the default path is still with powerplay on vega20. So far we don’t plan to switch default path to new swSMU design for vega20. And we can use the
module parameter amdgpu_dpm to switch it to new SW SMU design (modprobe amdgpu
dpm=1).

Development Items:
- Setup new SMU IP block skeleton.
- Implement SMC firmware loading function.
- Implement SMC table data structure.
- Implement SMU v11 indirect register (MP1) read/write and SMC message sending
helpers.
- Implement SMU v11 SMC table initialization (read from vbios, parse, populate,
and write back to smc).
- Implement SMU v11 memory pool location function.
- Enable DPM feature for SMU v11 and implement DPM control callback function.
- Enable interfaces for starting tools.
- Implement SMU v11 power control and power containment functions.
- Implement and enable SMU v11 thermal/fan control function.
- Implement SMU interfaces placeholder for DC, VCN, and KFD driver.
- Enable and align sys interface in the amdgpu_pm.c.

So far, Kevin, Likun, Jack, and I have enabled features such as dpm, od, thermal, and etc. with new sw smu driver. (Thanks to Kevin, Likun and Jack's great effort!)

Any comments are warm for us.

Thanks & Best Regards!
Ray

Chengming Gui (14):
drm/amd/powerplay: implement power_dpm_state sys interface for
SMU11
drm/amd/powerplay: add watermarks related data structs and function

    for SMU11.
  drm/amd/powerplay: implement pp_power_profile_mode sys inerface for
    SMU11
  drm/amd/powerplay: add display_config to handle display config for
    SMU11.
  drm/amd/powerplay: add mclk_latency_table struct and smu_clocks struct
    for SMU11
  drm/amd/powerplay: add enable_umd_pstate functions for SMU11
  drm/amd/powerplay: add get_profiling_clk_mask functions for SMU11
  drm/amd/powerplay: add set_uclk_to_highest_level for SMU11
  drm/amd/powerplay: add display_config_changed for SMU11.
  drm/amd/powerplay: add apply_clock_adjust_rules for SMU11.
  drm/amd/powerplay: add vega20_notify_smc_display_config functions for
    SMU11

drm/amd/powerplay: add vega20_find/force_higest/lowest_dpm for
SMU11
drm/amd/powerplay: add vega20_unforce_dpm_levels for SMU11. drm/amd/powerplay: implement power_dpm_force_performance_level
for

    SMU11

Huang Rui (53):
drm/amd/powerplay: add new smu ip block drm/amd/powerplay: add smu11 sub block for SMU IP drm/amd/powerplay: add firmware loading interface drm/amd/powerplay: add fw load checking interface drm/amd/powerplay: add interface to read pptable from vbios drm/amd/powerplay: add placeholder of smu_initialize_pptable drm/amd/powerplay: add interface to init smc tables (v2) drm/amd/powerplay: add interface to init power (v2) drm/amd/powerplay: add interface to get vbios bootup values (v2) drm/amd/powerplay: add interface to check pptable (v2) drm/amd/powerplay: add interface to init fb allocations (v2) drm/amd/powerplay: add interface to parse pptable (v2) drm/amd/powerplay: add interface to populate smc pptable (v2) drm/amd/powerplay: add interface to check fw version (v2) drm/amd/powerplay: add interface to write pptable (v2) drm/amd/powerplay: add interface to set min dcef deep sleep (v2) drm/amd/powerplay: add interface to set tool table location (v2) drm/amd/powerplay: add interface to allocate memory pool (v2) drm/amd/powerplay: add interface to notify memory pool location (v2) drm/amd/powerplay: add interfaces for smu resume drm/amd/powerplay: add resume sequence placeholder for smu ip block drm/amdgpu: enable new smu ip block for vega20 drm/amd/powerplay: add new ppsmc header for smu11 (v2) drm/amd/powerplay: add pptable header for smu11 drm/amdgpu: update atomfirmware header for smu11 drm/amdgpu: update new members in atomfirmware drm/amd/powerplay: add smu table context structure drm/amd/powerplay: add get atom data table helper drm/amdgpu: move get_index_into_master_table macro into
atomfirmware
header
drm/amd/powerplay: implement read_pptable_from_vbios function for

    smu11
  drm/amd/powerplay: update pptable header for smu11
  drm/amd/powerplay: add data structure of bootup values
  drm/amd/powerplay: implement get_vbios_bootup_values function for
    smu11 (v2)
  drm/amd/powerplay: implement get_clk_info_from_vbios function for
    smu11 (v2)

drm/amd/powerplay: add vega20 pptable function file drm/amd/powerplay: add append_powerplay_table function drm/amd/powerplay: add get_max_sustainable_clock function drm/amd/powerplay: add the function to set deep sleep dcefclk drm/amd/powerplay: add two interfaces to set_active_display_count and
store_cc6_data
drm/amd/powerplay: add smu display configuration change function drm/amd/powerplay: add get_clock_by_type interface for display drm/amd/powerplay: add interface to get max high clocks for display drm/amd/powerplay: add interface to get clock by type with latency for
display (v2)
drm/amd/powerplay: add interface to get clock by type with voltage for
display
drm/amd/powerplay: add interface to request display clock voltage drm/amd/powerplay: add interface to get dal power level drm/amd/powerplay: add interface to get performance level drm/amd/powerplay: add interface to get current shallow sleep clocks drm/amd/powerplay: add interface to get current clocks for display drm/amd/powerplay: add interface to notify smu enable pme restore
register
drm/amd/powerplay: implement interface to set watermarks for clock
ranges
drm/amd/powerplay: remove unnecessary checking in smu_hw_fini drm/amd/powerplay: don't check hwmgr while using the sw smu

Kevin Wang (38):
drm/amd/powerplay: implement smu send message functions for smu11
(v3)
drm/amd/powerplay: implement check_fw_status function for smu11 drm/amd/powerplay: implement check_fw_version function for smu11 drm/amd/powerplay: implement smu_init[fini]_smc_tables for smu11 drm/amd/powerplay: implement smu dpm context functions for smu11 drm/amd/powerplay: implement smu_init[fini]_power function for smu11 drm/amd/powerplay: implement smu_init(fini)_fb_allocations function drm/amd/powerplay: remove header of smu_v11_0_pptable drm/amd/powerplay: implement smu_alloc[free]_memory pool function drm/amd/powerplay: implement notify_memory_pool_location function
for

    smu11

drm/amd/powerplay: add enum smu_msg_type to header drm/amd/powerplay: implement smu vega20_message_map for vega20 drm/amd/powerplay: use virtual msg index to replace asic-related msg
index
drm/amd/powerplay: replace SMU_MSG_XXX with PPSMC_MSG_XXX
message
index for smu11 (v2)
drm/amd/powerplay: implement smu_init_display for smu11 drm/amd/powerplay: implement smu_run_afll_btc function drm/amd/powerplay: implement smu feature functions drm/amd/powerplay: implement feature get&set functions drm/amd/powerplay: implement smu_notify_display_change function for

    smu11
  drm/amd/powerplay: implement get_current_clk_freq for smu11
  drm/amd/powerplay: implement smu update table function
  drm/amd/powerplay: implement is_support_sw_smu function for new smu
  drm/amd/powerplay: implement sysfs of amdgpu_get_busy_percent for
    smu11
  drm/amd/powerplay: implement sysfs of pp_table for smu11
  drm/amd/powerplay: implement sensor of SCLK and MCLK for smu11
  drm/amd/powerplay: implement sensor of thermal_get_temperature for
    smu11
  drm/amd/powerplay: implement sensor of get_gpu_power for smu11
  drm/amd/powerplay: implement sensor of get_gfx_vdd for smu11
  drm/amd/powerplay: implement sensor of get feature mask
  drm/amd/powerplay: implement sysfs of get num states function
  drm/amd/powerplay: implement sysfs of pp_cur_state function
  drm/amd/powerplay: implement sysfs of pp_force_state for sw-smu
  drm/amd/powerplay: implement update enabled feature state to smc for
    smu11

drm/amd/powerplay: hwmon don't check powerplay when sw smu is
enabled
drm/amd/powerplay: implement uvd & vce dpm enable functions drm/amd/powerplay: implement sensor of uvd & vce power state for
smu11
drm/amd/powerplay: implement dpm enable functions of uvd & vce for
smu
drm/amd/powerplay: enable amdgpu dpm for smu

Likun Gao (33):
drm/amd/powerplay: init microcode for smu11 drm/amd/powerplay: add function to parse pptable for smu11 drm/amd/powerplay: add function to check pptable for smu11 drm/amd/powerplay: update hw fini function to relase some memory drm/amd/powerplay: add function to populate smc pptable for smu11 drm/amd/powerplay: add function to write pptable for smu11 (v2) drm/amd/powerplay: add function to set min dcef deep sleep for smu11

    (v2)
  drm/amd/powerplay: add function to set tool table location for smu11
    (v2)
  drm/amd/powerplay: expose the function of smu read argument
  drm/amd/powerplay: Change the allocate method of dpm context for
    smu11.
  drm/amd/powerplay: set defalut dpm table for smu
  drm/amd/powerplay: add function to populate umd state clk.
  drm/amd/powerplay: add function to get power limit for smu11 (v2)
  drm/amd/powerplay: print clock levels for smu11 (v2)
  drm/amd/powerplay: add function to get thermal range
  drm/amd/powerplay: add function to set thermal range
  drm/amd/powerplay: add function to enable thermal alert
  drm/amd/powerplay: add function to set fan table to control thermal
  drm/amd/powerplay: add function to start thermal control
  drm/amd/powerplay: upload dpm level for smu11
  drm/amd/powerplay: force clock levels for smu11
  drm/amd/powerplay: add function to store overdrive information for
    smu11

drm/amd/powerplay: add function to set default overdrive settings drm/amd/powerplay: add golden dpm table to backup default DPM table drm/amd/powerplay: print overdrive percentage information for smu11 drm/amd/powerplay: get overdrive clock and voltage information drm/amd/powerplay: add sys interface for pcie for smu drm/amd/powerplay: add function to update overdrive settings drm/amd/powerplay: add sys interface for set sclk_od/mclk_od for smu drm/amd/powerplay: add sys interface to set pp_od_clk_voltage for smu drm/amd/powerplay: adjust power state when set od_clk drm/amd/powerplay: dpm clk can be set only when performance level is
manual
drm/amd/powerplay: Unify smu handle task function

 drivers/gpu/drm/amd/amdgpu/amdgpu.h                |    4 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c   |   12 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.h   |    2 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c        |    7 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h            |   11 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c             |  364 ++--
 drivers/gpu/drm/amd/amdgpu/soc15.c                 |    9 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c   |   99 +-
 drivers/gpu/drm/amd/include/amd_shared.h           |    3 +
 drivers/gpu/drm/amd/include/atomfirmware.h         |   44 +-
 drivers/gpu/drm/amd/powerplay/Makefile             |    2 +-
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c         | 1198 +++++++++++
 drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h     |  732 +++++++
 drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h      |   89 +
 .../gpu/drm/amd/powerplay/inc/smu_v11_0_ppsmc.h    |  128 ++
 .../gpu/drm/amd/powerplay/inc/smu_v11_0_pptable.h  |  147 ++
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c          | 1683
+++++++++++++++
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c         | 2146
++++++++++++++++++++
 drivers/gpu/drm/amd/powerplay/vega20_ppt.h         |  129 ++
 19 files changed, 6624 insertions(+), 185 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h
 create mode 100644
drivers/gpu/drm/amd/powerplay/inc/smu_v11_0_ppsmc.h
 create mode 100644
drivers/gpu/drm/amd/powerplay/inc/smu_v11_0_pptable.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/smu_v11_0.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/vega20_ppt.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/vega20_ppt.h
Quoted 7 lines

--
2.7.4

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

_______________________________________________
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): MN2PR12MB330957C48B4613D0D35B1AE4EC7D0-rweVpJHSKTpWdvXm18W95QdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#142 lore raw

Series is:

________________________________
From: Huang, Ray
Sent: Wednesday, February 20, 2019 7:51 AM
To: Huang, Ray; [email protected]; Deucher, Alexander
Cc: Gao, Likun; Wang, Kevin(Yang); Gui, Jack
Subject: RE: [PATCH 000/138] The new SW SMU driver of amdgpu

Ping.
May I have your comments?

Thanks,
Ray

Quoted 277 lines

-----Original Message-----
From: amd-gfx [mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org] On Behalf Of Huang Rui
Sent: Friday, January 25, 2019 6:23 PM
To: [email protected]
Cc: Gao, Likun <[email protected]>; Wang, Kevin(Yang) <[email protected]>; Huang, Ray <[email protected]>; Gui, Jack <[email protected]>
Subject: [PATCH 000/138] The new SW SMU driver of amdgpu

Hi all,

The series of patches are to implement a new SW SMU driver for future asics.

Background:
The powerplay driver will be retired. The final version is for vega20 with SMU11. However, the future asic will use the new swSMU framework to implement as
well. Here is the first version of new sw smu driver that is basing on vega20.

Purpose:
We would like to do re-arch for linux power codes to use a new sw SMU ip block
for future asics. We hope to write a simple and readable framework for Linux.

Currently, the default path is still with powerplay on vega20. So far we don’t plan to switch default path to new swSMU design for vega20. And we can use the
module parameter amdgpu_dpm to switch it to new SW SMU design (modprobe amdgpu
dpm=1).

Development Items:
- Setup new SMU IP block skeleton.
- Implement SMC firmware loading function.
- Implement SMC table data structure.
- Implement SMU v11 indirect register (MP1) read/write and SMC message sending
helpers.
- Implement SMU v11 SMC table initialization (read from vbios, parse, populate,
and write back to smc).
- Implement SMU v11 memory pool location function.
- Enable DPM feature for SMU v11 and implement DPM control callback function.
- Enable interfaces for starting tools.
- Implement SMU v11 power control and power containment functions.
- Implement and enable SMU v11 thermal/fan control function.
- Implement SMU interfaces placeholder for DC, VCN, and KFD driver.
- Enable and align sys interface in the amdgpu_pm.c.

So far, Kevin, Likun, Jack, and I have enabled features such as dpm, od, thermal, and etc. with new sw smu driver. (Thanks to Kevin, Likun and Jack's great effort!)

Any comments are warm for us.

Thanks & Best Regards!
Ray

Chengming Gui (14):
drm/amd/powerplay: implement power_dpm_state sys interface for
SMU11
drm/amd/powerplay: add watermarks related data structs and function

    for SMU11.
  drm/amd/powerplay: implement pp_power_profile_mode sys inerface for
    SMU11
  drm/amd/powerplay: add display_config to handle display config for
    SMU11.
  drm/amd/powerplay: add mclk_latency_table struct and smu_clocks struct
    for SMU11
  drm/amd/powerplay: add enable_umd_pstate functions for SMU11
  drm/amd/powerplay: add get_profiling_clk_mask functions for SMU11
  drm/amd/powerplay: add set_uclk_to_highest_level for SMU11
  drm/amd/powerplay: add display_config_changed for SMU11.
  drm/amd/powerplay: add apply_clock_adjust_rules for SMU11.
  drm/amd/powerplay: add vega20_notify_smc_display_config functions for
    SMU11

drm/amd/powerplay: add vega20_find/force_higest/lowest_dpm for
SMU11
drm/amd/powerplay: add vega20_unforce_dpm_levels for SMU11. drm/amd/powerplay: implement power_dpm_force_performance_level
for

    SMU11

Huang Rui (53):
drm/amd/powerplay: add new smu ip block drm/amd/powerplay: add smu11 sub block for SMU IP drm/amd/powerplay: add firmware loading interface drm/amd/powerplay: add fw load checking interface drm/amd/powerplay: add interface to read pptable from vbios drm/amd/powerplay: add placeholder of smu_initialize_pptable drm/amd/powerplay: add interface to init smc tables (v2) drm/amd/powerplay: add interface to init power (v2) drm/amd/powerplay: add interface to get vbios bootup values (v2) drm/amd/powerplay: add interface to check pptable (v2) drm/amd/powerplay: add interface to init fb allocations (v2) drm/amd/powerplay: add interface to parse pptable (v2) drm/amd/powerplay: add interface to populate smc pptable (v2) drm/amd/powerplay: add interface to check fw version (v2) drm/amd/powerplay: add interface to write pptable (v2) drm/amd/powerplay: add interface to set min dcef deep sleep (v2) drm/amd/powerplay: add interface to set tool table location (v2) drm/amd/powerplay: add interface to allocate memory pool (v2) drm/amd/powerplay: add interface to notify memory pool location (v2) drm/amd/powerplay: add interfaces for smu resume drm/amd/powerplay: add resume sequence placeholder for smu ip block drm/amdgpu: enable new smu ip block for vega20 drm/amd/powerplay: add new ppsmc header for smu11 (v2) drm/amd/powerplay: add pptable header for smu11 drm/amdgpu: update atomfirmware header for smu11 drm/amdgpu: update new members in atomfirmware drm/amd/powerplay: add smu table context structure drm/amd/powerplay: add get atom data table helper drm/amdgpu: move get_index_into_master_table macro into
atomfirmware
header
drm/amd/powerplay: implement read_pptable_from_vbios function for

    smu11
  drm/amd/powerplay: update pptable header for smu11
  drm/amd/powerplay: add data structure of bootup values
  drm/amd/powerplay: implement get_vbios_bootup_values function for
    smu11 (v2)
  drm/amd/powerplay: implement get_clk_info_from_vbios function for
    smu11 (v2)

drm/amd/powerplay: add vega20 pptable function file drm/amd/powerplay: add append_powerplay_table function drm/amd/powerplay: add get_max_sustainable_clock function drm/amd/powerplay: add the function to set deep sleep dcefclk drm/amd/powerplay: add two interfaces to set_active_display_count and
store_cc6_data
drm/amd/powerplay: add smu display configuration change function drm/amd/powerplay: add get_clock_by_type interface for display drm/amd/powerplay: add interface to get max high clocks for display drm/amd/powerplay: add interface to get clock by type with latency for
display (v2)
drm/amd/powerplay: add interface to get clock by type with voltage for
display
drm/amd/powerplay: add interface to request display clock voltage drm/amd/powerplay: add interface to get dal power level drm/amd/powerplay: add interface to get performance level drm/amd/powerplay: add interface to get current shallow sleep clocks drm/amd/powerplay: add interface to get current clocks for display drm/amd/powerplay: add interface to notify smu enable pme restore
register
drm/amd/powerplay: implement interface to set watermarks for clock
ranges
drm/amd/powerplay: remove unnecessary checking in smu_hw_fini drm/amd/powerplay: don't check hwmgr while using the sw smu

Kevin Wang (38):
drm/amd/powerplay: implement smu send message functions for smu11
(v3)
drm/amd/powerplay: implement check_fw_status function for smu11 drm/amd/powerplay: implement check_fw_version function for smu11 drm/amd/powerplay: implement smu_init[fini]_smc_tables for smu11 drm/amd/powerplay: implement smu dpm context functions for smu11 drm/amd/powerplay: implement smu_init[fini]_power function for smu11 drm/amd/powerplay: implement smu_init(fini)_fb_allocations function drm/amd/powerplay: remove header of smu_v11_0_pptable drm/amd/powerplay: implement smu_alloc[free]_memory pool function drm/amd/powerplay: implement notify_memory_pool_location function
for

    smu11

drm/amd/powerplay: add enum smu_msg_type to header drm/amd/powerplay: implement smu vega20_message_map for vega20 drm/amd/powerplay: use virtual msg index to replace asic-related msg
index
drm/amd/powerplay: replace SMU_MSG_XXX with PPSMC_MSG_XXX
message
index for smu11 (v2)
drm/amd/powerplay: implement smu_init_display for smu11 drm/amd/powerplay: implement smu_run_afll_btc function drm/amd/powerplay: implement smu feature functions drm/amd/powerplay: implement feature get&set functions drm/amd/powerplay: implement smu_notify_display_change function for

    smu11
  drm/amd/powerplay: implement get_current_clk_freq for smu11
  drm/amd/powerplay: implement smu update table function
  drm/amd/powerplay: implement is_support_sw_smu function for new smu
  drm/amd/powerplay: implement sysfs of amdgpu_get_busy_percent for
    smu11
  drm/amd/powerplay: implement sysfs of pp_table for smu11
  drm/amd/powerplay: implement sensor of SCLK and MCLK for smu11
  drm/amd/powerplay: implement sensor of thermal_get_temperature for
    smu11
  drm/amd/powerplay: implement sensor of get_gpu_power for smu11
  drm/amd/powerplay: implement sensor of get_gfx_vdd for smu11
  drm/amd/powerplay: implement sensor of get feature mask
  drm/amd/powerplay: implement sysfs of get num states function
  drm/amd/powerplay: implement sysfs of pp_cur_state function
  drm/amd/powerplay: implement sysfs of pp_force_state for sw-smu
  drm/amd/powerplay: implement update enabled feature state to smc for
    smu11

drm/amd/powerplay: hwmon don't check powerplay when sw smu is
enabled
drm/amd/powerplay: implement uvd & vce dpm enable functions drm/amd/powerplay: implement sensor of uvd & vce power state for
smu11
drm/amd/powerplay: implement dpm enable functions of uvd & vce for
smu
drm/amd/powerplay: enable amdgpu dpm for smu

Likun Gao (33):
drm/amd/powerplay: init microcode for smu11 drm/amd/powerplay: add function to parse pptable for smu11 drm/amd/powerplay: add function to check pptable for smu11 drm/amd/powerplay: update hw fini function to relase some memory drm/amd/powerplay: add function to populate smc pptable for smu11 drm/amd/powerplay: add function to write pptable for smu11 (v2) drm/amd/powerplay: add function to set min dcef deep sleep for smu11

    (v2)
  drm/amd/powerplay: add function to set tool table location for smu11
    (v2)
  drm/amd/powerplay: expose the function of smu read argument
  drm/amd/powerplay: Change the allocate method of dpm context for
    smu11.
  drm/amd/powerplay: set defalut dpm table for smu
  drm/amd/powerplay: add function to populate umd state clk.
  drm/amd/powerplay: add function to get power limit for smu11 (v2)
  drm/amd/powerplay: print clock levels for smu11 (v2)
  drm/amd/powerplay: add function to get thermal range
  drm/amd/powerplay: add function to set thermal range
  drm/amd/powerplay: add function to enable thermal alert
  drm/amd/powerplay: add function to set fan table to control thermal
  drm/amd/powerplay: add function to start thermal control
  drm/amd/powerplay: upload dpm level for smu11
  drm/amd/powerplay: force clock levels for smu11
  drm/amd/powerplay: add function to store overdrive information for
    smu11

drm/amd/powerplay: add function to set default overdrive settings drm/amd/powerplay: add golden dpm table to backup default DPM table drm/amd/powerplay: print overdrive percentage information for smu11 drm/amd/powerplay: get overdrive clock and voltage information drm/amd/powerplay: add sys interface for pcie for smu drm/amd/powerplay: add function to update overdrive settings drm/amd/powerplay: add sys interface for set sclk_od/mclk_od for smu drm/amd/powerplay: add sys interface to set pp_od_clk_voltage for smu drm/amd/powerplay: adjust power state when set od_clk drm/amd/powerplay: dpm clk can be set only when performance level is
manual
drm/amd/powerplay: Unify smu handle task function

 drivers/gpu/drm/amd/amdgpu/amdgpu.h                |    4 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c   |   12 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.h   |    2 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c        |    7 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h            |   11 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c             |  364 ++--
 drivers/gpu/drm/amd/amdgpu/soc15.c                 |    9 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c   |   99 +-
 drivers/gpu/drm/amd/include/amd_shared.h           |    3 +
 drivers/gpu/drm/amd/include/atomfirmware.h         |   44 +-
 drivers/gpu/drm/amd/powerplay/Makefile             |    2 +-
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c         | 1198 +++++++++++
 drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h     |  732 +++++++
 drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h      |   89 +
 .../gpu/drm/amd/powerplay/inc/smu_v11_0_ppsmc.h    |  128 ++
 .../gpu/drm/amd/powerplay/inc/smu_v11_0_pptable.h  |  147 ++
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c          | 1683
+++++++++++++++
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c         | 2146
++++++++++++++++++++
 drivers/gpu/drm/amd/powerplay/vega20_ppt.h         |  129 ++
 19 files changed, 6624 insertions(+), 185 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h
 create mode 100644
drivers/gpu/drm/amd/powerplay/inc/smu_v11_0_ppsmc.h
 create mode 100644
drivers/gpu/drm/amd/powerplay/inc/smu_v11_0_pptable.h
 create mode 100644 drivers/gpu/drm/amd/powerplay/smu_v11_0.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/vega20_ppt.c
 create mode 100644 drivers/gpu/drm/amd/powerplay/vega20_ppt.h
Quoted 7 lines

--
2.7.4

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

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