drm/amdgpu/pm: implement the SMU_MSG_EnableGfxImu function
Subsystems (3)
Alex Deucher
maintainerPATCH 1/2 drm/amdgpu/pm: implement the SMU_MSG_EnableGfxImu function
From: Huang Rui <[email protected]>
GC v11_0_1 asic needs to issue the EnableGfxImu message after start IMU.
Signed-off-by Huang Rui <[email protected]>
Reviewed-by Tim Huang <[email protected]>
Signed-off-by Alex Deucher <[email protected]>
--- drivers/gpu/drm/amd/pm/amdgpu_dpm.c | 14 ++++++++++++++ drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h | 2 ++ drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 9 ++++++++- drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h | 7 +++++++ drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h | 2 ++ drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 10 ++++++++++ .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_4_ppt.c | 1 + 7 files changed, 44 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/amdgpu_dpm.c +14 -0
@@ -107,6 +107,20 @@ int amdgpu_dpm_set_powergating_by_smu(struct amdgpu_device *adev, uint32_t blockreturn ret; } +int amdgpu_dpm_set_gfx_power_up_by_imu (struct amdgpu_device *adev) +{ +struct smu_context *smu = adev->powerplay.pp_handle; +int ret = -EOPNOTSUPP ; + +mutex_lock (&adev->pm.mutex); + ret =smu_set_gfx_power_up_by_imu (smu); +mutex_unlock (&adev->pm.mutex); + +msleep (10 ); + +return ret; +} +int amdgpu_dpm_baco_enter (struct amdgpu_device *adev) {const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs;
drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h +2 -0
@@ -386,6 +386,8 @@ int amdgpu_dpm_mode1_reset(struct amdgpu_device *adev);int amdgpu_dpm_set_mp1_state (struct amdgpu_device *adev,enum pp_mp1_state mp1_state); +int amdgpu_dpm_set_gfx_power_up_by_imu (struct amdgpu_device *adev); +int amdgpu_dpm_baco_exit (struct amdgpu_device *adev);int amdgpu_dpm_baco_enter (struct amdgpu_device *adev);
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +8 -1
@@ -134,6 +134,14 @@ int smu_get_dpm_freq_range(struct smu_context *smu,return ret; } +int smu_set_gfx_power_up_by_imu (struct smu_context *smu) +{ +if (!smu->ppt_funcs && !smu->ppt_funcs->set_gfx_power_up_by_imu) +return -EOPNOTSUPP ; + +return smu->ppt_funcs->set_gfx_power_up_by_imu (smu); +} +static u32 smu_get_mclk (void *handle,bool low) {struct smu_context *smu = handle;
@@ -2467,7 +2475,6 @@ static int smu_set_power_profile_mode(void *handle,return smu_bump_power_profile_mode (smu, param, param_size); } -static int smu_get_fan_control_mode (void *handle,u32 *fan_mode) {struct smu_context *smu = handle;
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +7 -0
@@ -701,6 +701,11 @@ struct pptable_funcs {*/ int (*dpm_set_jpeg_enable)(struct smu_context *smu,bool enable); +/** +* @set_gfx_power_up_by_imu: Enable GFX engine with IMU +*/ +int (*set_gfx_power_up_by_imu)(struct smu_context *smu); +/** * @read_sensor: Read data from a sensor. * &sensor: Sensor to read data from.
@@ -1442,6 +1447,8 @@ int smu_get_dpm_freq_range(struct smu_context *smu, enum smu_clk_type clk_type,int smu_set_soft_freq_range (struct smu_context *smu,enum smu_clk_type clk_type,uint32_t min,uint32_t max); +int smu_set_gfx_power_up_by_imu (struct smu_context *smu); +int smu_set_ac_dc (struct smu_context *smu);int smu_allow_xgmi_power_down (struct smu_context *smu,bool en);
drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h +2 -0
@@ -292,6 +292,8 @@ int smu_v13_0_baco_enter(struct smu_context *smu);int smu_v13_0_baco_exit (struct smu_context *smu); +int smu_v13_0_set_gfx_power_up_by_imu (struct smu_context *smu); + int smu_v13_0_od_edit_dpm_table(struct smu_context *smu, enum PP_OD_DPM_TABLE_COMMAND type, long input[],
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +10 -0
@@ -2306,6 +2306,16 @@ int smu_v13_0_baco_exit(struct smu_context *smu) SMU_BACO_STATE_EXIT); } +int smu_v13_0_set_gfx_power_up_by_imu (struct smu_context *smu) +{ +uint16_t index; + + index =smu_cmn_to_asic_specific_index (smu,CMN2ASIC_MAPPING_MSG , + SMU_MSG_EnableGfxImu); + +return smu_cmn_send_msg_without_waiting (smu, index,0 ); +} +int smu_v13_0_od_edit_dpm_table (struct smu_context *smu,enum PP_OD_DPM_TABLE_COMMAND type,long input[],uint32_t size)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_4_ppt.c +1 -0
@@ -1039,6 +1039,7 @@ static const struct pptable_funcs smu_v13_0_4_ppt_funcs = { .force_clk_levels = smu_v13_0_4_force_clk_levels, .set_performance_level = smu_v13_0_4_set_performance_level, .set_fine_grain_gfx_freq_parameters = smu_v13_0_4_set_fine_grain_gfx_freq_parameters, + .set_gfx_power_up_by_imu = smu_v13_0_set_gfx_power_up_by_imu, };void smu_v13_0_4_set_ppt_funcs (struct smu_context *smu)
Signature · 1 line
2.35.3
Alex Deucher
maintainerPATCH 2/2 drm/amdgpu: add apu sequence in the imu v11
From: Huang Rui <[email protected]>
APU required to issue the enable GFX IMU message after IMU reset.
Signed-off-by Huang Rui <[email protected]>
Reviewed-by Tim Huang <[email protected]>
Signed-off-by Alex Deucher <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 6 +++++- drivers/gpu/drm/amd/amdgpu/imu_v11_0.c | 7 ++++--- 2 files changed, 9 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +5 -1
@@ -6291,7 +6291,11 @@ static void gfx_v11_0_set_irq_funcs(struct amdgpu_device *adev)static void gfx_v11_0_set_imu_funcs (struct amdgpu_device *adev) { - adev->gfx.imu.mode =DEBUG_MODE ; +if (adev->flags &AMD_IS_APU ) + adev->gfx.imu.mode =MISSION_MODE ; +else + adev->gfx.imu.mode =DEBUG_MODE ; + adev->gfx.imu.funcs = &gfx_v11_0_imu_funcs; }
drivers/gpu/drm/amd/amdgpu/imu_v11_0.c +4 -3
@@ -24,6 +24,7 @@#include <linux/firmware.h> #include "amdgpu.h" #include "amdgpu_imu.h" +#include "amdgpu_dpm.h" #include "gc/gc_11_0_0_offset.h" #include "gc/gc_11_0_0_sh_mask.h"
@@ -165,10 +166,10 @@ static int imu_v11_0_start(struct amdgpu_device *adev) imu_reg_val &=0xfffffffe ;WREG32_SOC15 (GC ,0 , regGFX_IMU_CORE_CTRL, imu_reg_val); -if (adev->gfx.imu.mode ==DEBUG_MODE ) -return imu_v11_0_wait_for_reset_status (adev); +if (adev->flags &AMD_IS_APU ) +amdgpu_dpm_set_gfx_power_up_by_imu (adev); -return 0 ; +return imu_v11_0_wait_for_reset_status (adev); } static const struct imu_rlc_ram_golden imu_rlc_ram_golden_11[] =
Signature · 1 line
2.35.3