drm/amdgpu: Load TA ucode for PSP 15_0_0
Subsystems (3)
PATCH v6 1/11 drm/amdgpu: Load TA ucode for PSP 15_0_0
TOC and TA both are required
--- drivers/gpu/drm/amd/amdgpu/psp_v15_0.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/psp_v15_0.c +4 -0
@@ -45,6 +45,10 @@ static int psp_v15_0_0_init_microcode(struct psp_context *psp)if (err)return err; + err =psp_init_ta_microcode (psp, ucode_prefix); +if (err) +return err; +return 0 ; }
Signature · 1 line
2.43.0
PATCH v6 2/11 drm/amd/swsmu: Add new param regs for SMU15
Some SMU messages have changed to multi reg read/write Initialize during smu_early_init
--- drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_0_ppt.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_0_ppt.c +9 -1
@@ -52,6 +52,12 @@#define mmMP1_SMN_C2PMSG_32 0x0060#define mmMP1_SMN_C2PMSG_32_BASE_IDX 1 +#define mmMP1_SMN_C2PMSG_33 0x0061 +#define mmMP1_SMN_C2PMSG_33_BASE_IDX 1 + +#define mmMP1_SMN_C2PMSG_34 0x0062 +#define mmMP1_SMN_C2PMSG_34_BASE_IDX 1 +/* MALLPowerController message arguments (Defines for the Cache mode control) */ #define SMU_MALL_PMFW_CONTROL 0#define SMU_MALL_DRIVER_CONTROL 1
@@ -1347,7 +1353,9 @@ static void smu_v15_0_0_init_msg_ctl(struct smu_context *smu) ctl->config.msg_reg =SOC15_REG_OFFSET (MP1 ,0 , mmMP1_SMN_C2PMSG_30); ctl->config.resp_reg =SOC15_REG_OFFSET (MP1 ,0 , mmMP1_SMN_C2PMSG_31); ctl->config.arg_regs[0 ] =SOC15_REG_OFFSET (MP1 ,0 , mmMP1_SMN_C2PMSG_32); - ctl->config.num_arg_regs =1 ; + ctl->config.arg_regs[1 ] =SOC15_REG_OFFSET (MP1 ,0 , mmMP1_SMN_C2PMSG_33); + ctl->config.arg_regs[2 ] =SOC15_REG_OFFSET (MP1 ,0 , mmMP1_SMN_C2PMSG_34); + ctl->config.num_arg_regs =3 ; ctl->ops = &smu_msg_v1_ops; ctl->default_timeout = adev->usec_timeout *20 ; ctl->message_map = smu_v15_0_0_message_map;
Signature · 1 line
2.43.0
PATCH v6 3/11 drm/amdgpu: Add support for update_table for SMU15
In reply to Pratik VishwakarmaAdd update_table for SMU 15_0_0
--- drivers/gpu/drm/amd/pm/swsmu/inc/smu_v15_0.h | 5 ++ .../gpu/drm/amd/pm/swsmu/smu15/smu_v15_0.c | 60 +++++++++++++++++++ 2 files changed, 65 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/inc/smu_v15_0.h +5 -0
@@ -241,5 +241,10 @@ int smu_v15_0_enable_thermal_alert(struct smu_context *smu);int smu_v15_0_disable_thermal_alert (struct smu_context *smu); +int smu_v15_0_0_update_table (struct smu_context *smu, +enum smu_table_id table_index, +int argument,void *table_data, +bool drv2smu); +#endif #endif
drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0.c +60 -0
66 lines not on this page · raw message
Signature · 1 line
2.43.0
Re: [PATCH v6 03/11] drm/amdgpu: Add support for update_table for SMU15
Quoted 61 lines · Pratik Vishwakarma
Add
update_tablefor SMU 15_0_0Signed-off-by Pratik Vishwakarma <[email protected]>--- drivers/gpu/drm/amd/pm/swsmu/inc/smu_v15_0.h | 5 ++ .../gpu/drm/amd/pm/swsmu/smu15/smu_v15_0.c | 60 +++++++++++++++++++ 2 files changed, 65 insertions(+)drivers/gpu/drm/amd/pm/swsmu/inc/smu_v15_0.h +5
-0@@ -241,5 +241,10 @@ int smu_v15_0_enable_thermal_alert(struct smu_context *smu);int smu_v15_0_disable_thermal_alert (struct smu_context *smu); +int smu_v15_0_0_update_table (struct smu_context *smu, +enum smu_table_id table_index, +int argument,void *table_data, +bool drv2smu); +#endif #endif drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0.c +30
-0@@ -1726,6 +1726,66 @@ int smu_v15_0_set_gfx_power_up_by_imu(struct smu_context *smu)return ret; } +int smu_v15_0_0_update_table (struct smu_context *smu, +enum smu_table_id table_index, +int argument, +void *table_data, +bool drv2smu) +{ +struct smu_table_context *smu_table = &smu->smu_table; +struct amdgpu_device *adev = smu->adev; +struct smu_table *table = &smu_table->driver_table; +int table_id =smu_cmn_to_asic_specific_index (smu, +CMN2ASIC_MAPPING_TABLE , + table_index); +uint64_t address; +uint32_t table_size; +int ret; +struct smu_msg_ctl *ctl = &smu->msg_ctl; + +if (!table_data || table_index >=SMU_TABLE_COUNT || table_id <0 ) +return -EINVAL ; + + table_size = smu_table->tables[table_index].size; + +if (drv2smu) { +memcpy (table->cpu_addr, table_data, table_size); +/* +* Flush hdp cache: to guard the content seen by +* GPU is consitent with CPU. +*/ +amdgpu_hdp_flush (adev,NULL ); + }
drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0.c int smu_v15_0_set_gfx_power_up_by_imu(struct smu_context *smu) · line 1768
Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0.c +10
-0+ + address = table->mc_address; + +struct smu_msg_args args = { + .msg = drv2smu ? + SMU_MSG_TransferTableDram2Smu : + SMU_MSG_TransferTableSmu2Dram, + .num_args =3 , + .num_out_args =0 , + .flags =SMU_MSG_FLAG_ASYNC |SMU_MSG_FLAG_LOCK_HELD ,
These flags are not correct. First one indicates, it's an asynchronous call and this one is not. Second one says caller already holds the mutex which is also incorrect. Just clear all the flags.
drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0.c int smu_v15_0_set_gfx_power_up_by_imu(struct smu_context *smu) · line 1769
Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0.c +1
-0+ .timeout = 0,
This is also incorrect, just use the default timeout.
Thanks,
Lijo
Quoted 22 lines
drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0.c +19
-0+ }; + + args.args[0 ] = table_id; + args.args[1 ] = (uint32_t )lower_32_bits (address); + args.args[2 ] = (uint32_t )upper_32_bits (address); + + ret = ctl->ops->send_msg (ctl, &args); + +if (ret) +return ret; + +if (!drv2smu) { +amdgpu_hdp_invalidate (adev,NULL ); +memcpy (table_data, table->cpu_addr, table_size); + } + +return 0 ; +} +int smu_v15_0_set_default_dpm_tables (struct smu_context *smu) {struct smu_table_context *smu_table = &smu->smu_table;
PATCH v6 4/11 drm/admgpu: Update metrics_table for SMU15
In reply to Pratik VishwakarmaUse multi param based get op for metrics_table
--- .../drm/amd/pm/swsmu/smu15/smu_v15_0_0_ppt.c | 34 +++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_0_ppt.c +32 -2
@@ -246,6 +246,36 @@ static int smu_v15_0_0_system_features_control(struct smu_context *smu, bool en)return ret; } +static int smu_v15_0_0_get_metrics_table (struct smu_context *smu, +void *metrics_table, +bool bypass_cache) +{ +struct smu_table_context *smu_table = &smu->smu_table; +uint32_t table_size = + smu_table->tables[SMU_TABLE_SMU_METRICS ].size; +int ret; + +if (bypass_cache || + !smu_table->metrics_time || +time_after (jiffies, smu_table->metrics_time +msecs_to_jiffies (1 ))) { + ret =smu_v15_0_0_update_table (smu, +SMU_TABLE_SMU_METRICS , +0 , + smu_table->metrics_table, + false); +if (ret) { +dev_info (smu->adev->dev,"Failed to export SMU15_0_0 metrics table!\n" ); +return ret; + } + smu_table->metrics_time = jiffies; + } + +if (metrics_table) +memcpy (metrics_table, smu_table->metrics_table, table_size); + +return 0 ; +} +static int smu_v15_0_0_get_smu_metrics_data (struct smu_context *smu,MetricsMember_t member,uint32_t *value)
@@ -255,7 +285,7 @@ static int smu_v15_0_0_get_smu_metrics_data(struct smu_context *smu,SmuMetrics_t *metrics = (SmuMetrics_t *)smu_table->metrics_table;int ret =0 ; - ret =smu_cmn_get_metrics_table (smu,NULL , false); + ret =smu_v15_0_0_get_metrics_table (smu,NULL , false);if (ret)return ret;
@@ -530,7 +560,7 @@ static ssize_t smu_v15_0_0_get_gpu_metrics(struct smu_context *smu,SmuMetrics_t metrics;int ret =0 ; - ret =smu_cmn_get_metrics_table (smu, &metrics, true); + ret =smu_v15_0_0_get_metrics_table (smu, &metrics, false);if (ret)return ret;
Signature · 1 line
2.43.0
PATCH v6 5/11 drm/amdgpu: Fix set_default_dpm_tables
In reply to Pratik VishwakarmaUse smu_v15_0_0_update_table instead of common api
--- drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0.c +1 -1
@@ -1790,7 +1790,7 @@ int smu_v15_0_set_default_dpm_tables(struct smu_context *smu) {struct smu_table_context *smu_table = &smu->smu_table; -return smu_cmn_update_table (smu,SMU_TABLE_DPMCLOCKS ,0 , +return smu_v15_0_0_update_table (smu,SMU_TABLE_DPMCLOCKS ,0 , smu_table->clocks_table, false); }
Signature · 1 line
2.43.0
PATCH v6 6/11 drm/amdgpu: Fix is_dpm_running
In reply to Pratik VishwakarmaUse multi args for get_enabled_mask to fix is_dpm_running
--- .../drm/amd/pm/swsmu/smu15/smu_v15_0_0_ppt.c | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_0_ppt.c +26 -2
@@ -479,12 +479,36 @@ static int smu_v15_0_0_read_sensor(struct smu_context *smu,return ret; } +static int smu_v15_0_0_get_enabled_mask (struct smu_context *smu, +struct smu_feature_bits *feature_mask) +{ +int ret; +struct smu_msg_ctl *ctl = &smu->msg_ctl; + +if (!feature_mask) +return -EINVAL ; + +struct smu_msg_args args = { + .msg = SMU_MSG_GetEnabledSmuFeatures, + .num_args =0 , + .num_out_args =2 , + }; + + ret = ctl->ops->send_msg (ctl, &args); + +if (!ret) +smu_feature_bits_from_arr32 (feature_mask, args.out_args, +SMU_FEATURE_NUM_DEFAULT ); + +return ret; +} +static bool smu_v15_0_0_is_dpm_running (struct smu_context *smu) {int ret =0 ;struct smu_feature_bits feature_enabled; - ret =smu_cmn_get_enabled_mask (smu, &feature_enabled); + ret =smu_v15_0_0_get_enabled_mask (smu, &feature_enabled);if (ret)return false;
@@ -1356,7 +1380,7 @@ static const struct pptable_funcs smu_v15_0_0_ppt_funcs = { .is_dpm_running = smu_v15_0_0_is_dpm_running, .set_watermarks_table = smu_v15_0_0_set_watermarks_table, .get_gpu_metrics = smu_v15_0_0_get_gpu_metrics, - .get_enabled_mask = smu_cmn_get_enabled_mask, + .get_enabled_mask = smu_v15_0_0_get_enabled_mask, .get_pp_feature_mask = smu_cmn_get_pp_feature_mask, .set_driver_table_location = smu_v15_0_set_driver_table_location, .gfx_off_control = smu_v15_0_gfx_off_control,
Signature · 1 line
2.43.0
Re: [PATCH v6 06/11] drm/amdgpu: Fix is_dpm_running
Quoted 3 lines · Pratik Vishwakarma
Use multi args for
get_enabled_maskto fixis_dpm_runningSigned-off-by Pratik Vishwakarma <[email protected]>
Thanks,
Lijo
Quoted 55 lines
--- .../drm/amd/pm/swsmu/smu15/smu_v15_0_0_ppt.c | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_0_ppt.c +26
-2@@ -479,12 +479,36 @@ static int smu_v15_0_0_read_sensor(struct smu_context *smu,return ret; } +static int smu_v15_0_0_get_enabled_mask (struct smu_context *smu, +struct smu_feature_bits *feature_mask) +{ +int ret; +struct smu_msg_ctl *ctl = &smu->msg_ctl; + +if (!feature_mask) +return -EINVAL ; + +struct smu_msg_args args = { + .msg = SMU_MSG_GetEnabledSmuFeatures, + .num_args =0 , + .num_out_args =2 , + }; + + ret = ctl->ops->send_msg (ctl, &args); + +if (!ret) +smu_feature_bits_from_arr32 (feature_mask, args.out_args, +SMU_FEATURE_NUM_DEFAULT ); + +return ret; +} +static bool smu_v15_0_0_is_dpm_running (struct smu_context *smu) {int ret =0 ;struct smu_feature_bits feature_enabled; - ret =smu_cmn_get_enabled_mask (smu, &feature_enabled); + ret =smu_v15_0_0_get_enabled_mask (smu, &feature_enabled);if (ret)return false;@@ -1356,7 +1380,7 @@ static const struct pptable_funcs smu_v15_0_0_ppt_funcs = { .is_dpm_running = smu_v15_0_0_is_dpm_running, .set_watermarks_table = smu_v15_0_0_set_watermarks_table, .get_gpu_metrics = smu_v15_0_0_get_gpu_metrics, - .get_enabled_mask = smu_cmn_get_enabled_mask, + .get_enabled_mask = smu_v15_0_0_get_enabled_mask, .get_pp_feature_mask = smu_cmn_get_pp_feature_mask, .set_driver_table_location = smu_v15_0_set_driver_table_location, .gfx_off_control = smu_v15_0_gfx_off_control,
PATCH v6 7/11 drm/amdgpu: Drop unsupported function
In reply to Pratik Vishwakarmadrop set_driver_table_location
--- drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_0_ppt.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_0_ppt.c +0 -1
@@ -1382,7 +1382,6 @@ static const struct pptable_funcs smu_v15_0_0_ppt_funcs = { .get_gpu_metrics = smu_v15_0_0_get_gpu_metrics, .get_enabled_mask = smu_v15_0_0_get_enabled_mask, .get_pp_feature_mask = smu_cmn_get_pp_feature_mask, - .set_driver_table_location = smu_v15_0_set_driver_table_location, .gfx_off_control = smu_v15_0_gfx_off_control, .mode2_reset = smu_v15_0_0_mode2_reset, .get_dpm_ultimate_freq = smu_v15_0_common_get_dpm_ultimate_freq,
Signature · 1 line
2.43.0
PATCH v6 8/11 drm/amd: Drop MALL
In reply to Pratik VishwakarmaNot supported on SMU 15_0_0
--- .../gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_0_ppt.c | 13 ------------- 1 file changed, 13 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_0_ppt.c +0 -13
@@ -58,19 +58,6 @@#define mmMP1_SMN_C2PMSG_34 0x0062#define mmMP1_SMN_C2PMSG_34_BASE_IDX 1 -/* MALLPowerController message arguments (Defines for the Cache mode control) */ -#define SMU_MALL_PMFW_CONTROL 0 -#define SMU_MALL_DRIVER_CONTROL 1 - -/* -* MALLPowerState message arguments -* (Defines for the Allocate/Release Cache mode if in driver mode) -*/ -#define SMU_MALL_EXIT_PG 0 -#define SMU_MALL_ENTER_PG 1 - -#define SMU_MALL_PG_CONFIG_DEFAULT SMU_MALL_PG_CONFIG_DRIVER_CONTROL_ALWAYS_ON -#define SMU_15_0_UMD_PSTATE_GFXCLK 700#define SMU_15_0_UMD_PSTATE_SOCCLK 678#define SMU_15_0_UMD_PSTATE_FCLK 1800
Signature · 1 line
2.43.0
PATCH v6 9/11 drm/amdgpu: enable mode2 reset for SMU IP v15.0.0
In reply to Pratik VishwakarmaSet the default reset method to mode2 for SMU 15.0.0.
--- drivers/gpu/drm/amd/amdgpu/soc21.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/soc21.c +1 -0
@@ -422,6 +422,7 @@ soc21_asic_reset_method(struct amdgpu_device *adev)case IP_VERSION (14 ,0 ,1 ):case IP_VERSION (14 ,0 ,4 ):case IP_VERSION (14 ,0 ,5 ): +case IP_VERSION (15 ,0 ,0 ):return AMD_RESET_METHOD_MODE2 ;default :if (amdgpu_dpm_is_baco_supported (adev))
Signature · 1 line
2.43.0
PATCH v6 10/11 drm/amd: Add CG/PG flags for GC 11.5.4
In reply to Pratik VishwakarmaEnable GFXOff for GC 11.5.4
--- drivers/gpu/drm/amd/amdgpu/soc21.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/soc21.c +21 -2
@@ -839,9 +839,28 @@ static int soc21_common_early_init(struct amdgpu_ip_block *ip_block)break ;case IP_VERSION (11 ,5 ,4 ): adev->cg_flags =AMD_CG_SUPPORT_VCN_MGCG | -AMD_CG_SUPPORT_JPEG_MGCG ; +AMD_CG_SUPPORT_JPEG_MGCG | +AMD_CG_SUPPORT_GFX_CGCG | +AMD_CG_SUPPORT_GFX_CGLS | +AMD_CG_SUPPORT_GFX_MGCG | +AMD_CG_SUPPORT_GFX_FGCG | +AMD_CG_SUPPORT_REPEATER_FGCG | +AMD_CG_SUPPORT_GFX_PERF_CLK | +AMD_CG_SUPPORT_GFX_3D_CGCG | +AMD_CG_SUPPORT_GFX_3D_CGLS | +AMD_CG_SUPPORT_MC_MGCG | +AMD_CG_SUPPORT_MC_LS | +AMD_CG_SUPPORT_HDP_LS | +AMD_CG_SUPPORT_HDP_DS | +AMD_CG_SUPPORT_HDP_SD | +AMD_CG_SUPPORT_ATHUB_MGCG | +AMD_CG_SUPPORT_ATHUB_LS | +AMD_CG_SUPPORT_IH_CG | +AMD_CG_SUPPORT_BIF_MGCG | +AMD_CG_SUPPORT_BIF_LS ; adev->pg_flags =AMD_PG_SUPPORT_VCN | -AMD_PG_SUPPORT_JPEG ; +AMD_PG_SUPPORT_JPEG | +AMD_PG_SUPPORT_GFX_PG ; adev->external_rev_id = adev->rev_id +0x1 ;break ;default :
Signature · 1 line
2.43.0
PATCH v6 11/11 drm/amd/smu: Fix User mode stable P-states SMU15
In reply to Pratik VishwakarmaSMU 15_0_0 exports only soft limits for CLKs
Use correct messages
--- .../gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_0_ppt.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_0_ppt.c +5 -10
@@ -1026,26 +1026,21 @@ static int smu_v15_0_0_set_soft_freq_limited_range(struct smu_context *smu,switch (clk_type) {case SMU_GFXCLK :case SMU_SCLK : - msg_set_min = SMU_MSG_SetHardMinGfxClk; + msg_set_min = SMU_MSG_SetSoftMinGfxclk; msg_set_max = SMU_MSG_SetSoftMaxGfxClk;break ;case SMU_FCLK : - msg_set_min = SMU_MSG_SetHardMinFclkByFreq; + msg_set_min = SMU_MSG_SetSoftMinFclk; msg_set_max = SMU_MSG_SetSoftMaxFclkByFreq;break ;case SMU_SOCCLK : - msg_set_min = SMU_MSG_SetHardMinSocclkByFreq; + msg_set_min = SMU_MSG_SetSoftMinSocclkByFreq; msg_set_max = SMU_MSG_SetSoftMaxSocclkByFreq;break ;case SMU_VCLK :case SMU_DCLK : - msg_set_min = SMU_MSG_SetHardMinVcn0; - msg_set_max = SMU_MSG_SetSoftMaxVcn0; -break ; -case SMU_VCLK1 : -case SMU_DCLK1 : - msg_set_min = SMU_MSG_SetHardMinVcn1; - msg_set_max = SMU_MSG_SetSoftMaxVcn1; + msg_set_min = SMU_MSG_SetSoftMinVcn; + msg_set_max = SMU_MSG_SetSoftMaxVcn;break ;default :return -EINVAL ;
Signature · 1 line
2.43.0