drm/amd/powerplay: use MGPU friendly err/warn/info/dbg messages
Subsystems (2)
PATCH 1/3 drm/amd/powerplay: use MGPU friendly err/warn/info/dbg messages
Use dev_err/warn/info/dbg instead of pr_err/warn/info/debug.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 70 +- drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 527 ++++++------ drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 119 +-- drivers/gpu/drm/amd/powerplay/renoir_ppt.c | 14 +- .../drm/amd/powerplay/sienna_cichlid_ppt.c | 784 +++++++++--------- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 52 +- drivers/gpu/drm/amd/powerplay/smu_v12_0.c | 14 +- 7 files changed, 793 insertions(+), 787 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +35 -35
@@ -609,7 +609,7 @@ int smu_sys_set_pp_table(struct smu_context *smu, void *buf, size_t size)return -EOPNOTSUPP ;if (header->usStructureSize != size) { -pr_err ("pp table size not matched !\n" ); +dev_err (smu->adev->dev,"pp table size not matched !\n" );return -EIO ; }
@@ -633,7 +633,7 @@ int smu_sys_set_pp_table(struct smu_context *smu, void *buf, size_t size) ret =smu_reset (smu);if (ret) -pr_info ("smu reset failed, ret = %d\n" , ret); +dev_info (smu->adev->dev,"smu reset failed, ret = %d\n" , ret); smu->uploading_custom_pp_table = false;
@@ -847,7 +847,7 @@ static int smu_init_fb_allocations(struct smu_context *smu) &tables[SMU_TABLE_PMSTATUSLOG ].mc_address, &tables[SMU_TABLE_PMSTATUSLOG].cpu_addr);if (ret) { -pr_err ("VRAM allocation for tool table failed!\n" ); +dev_err (adev->dev,"VRAM allocation for tool table failed!\n" );return ret; } }
@@ -876,7 +876,7 @@ static int smu_init_fb_allocations(struct smu_context *smu) &driver_table->mc_address, &driver_table->cpu_addr);if (ret) { -pr_err ("VRAM allocation for driver table failed!\n" ); +dev_err (adev->dev,"VRAM allocation for driver table failed!\n" );if (tables[SMU_TABLE_PMSTATUSLOG ].mc_address) amdgpu_bo_free_kernel(&tables[SMU_TABLE_PMSTATUSLOG].bo, &tables[SMU_TABLE_PMSTATUSLOG].mc_address,
@@ -979,7 +979,7 @@ static int smu_smc_table_sw_init(struct smu_context *smu)*/ ret =smu_init_smc_tables (smu);if (ret) { -pr_err ("Failed to init smc tables!\n" ); +dev_err (smu->adev->dev,"Failed to init smc tables!\n" );return ret; }
@@ -989,7 +989,7 @@ static int smu_smc_table_sw_init(struct smu_context *smu)*/ ret =smu_init_power (smu);if (ret) { -pr_err ("Failed to init smu_init_power!\n" ); +dev_err (smu->adev->dev,"Failed to init smu_init_power!\n" );return ret; }
@@ -1021,13 +1021,13 @@ static int smu_smc_table_sw_fini(struct smu_context *smu) ret =smu_fini_power (smu);if (ret) { -pr_err ("Failed to init smu_fini_power!\n" ); +dev_err (smu->adev->dev,"Failed to init smu_fini_power!\n" );return ret; } ret =smu_fini_smc_tables (smu);if (ret) { -pr_err ("Failed to smu_fini_smc_tables!\n" ); +dev_err (smu->adev->dev,"Failed to smu_fini_smc_tables!\n" );return ret; }
@@ -1090,19 +1090,19 @@ static int smu_sw_init(void *handle) smu->smu_dpm.requested_dpm_level =AMD_DPM_FORCED_LEVEL_AUTO ; ret =smu_init_microcode (smu);if (ret) { -pr_err ("Failed to load smu firmware!\n" ); +dev_err (adev->dev,"Failed to load smu firmware!\n" );return ret; } ret =smu_smc_table_sw_init (smu);if (ret) { -pr_err ("Failed to sw init smc table!\n" ); +dev_err (adev->dev,"Failed to sw init smc table!\n" );return ret; } ret =smu_register_irq_handler (smu);if (ret) { -pr_err ("Failed to register smc irq handler!\n" ); +dev_err (adev->dev,"Failed to register smc irq handler!\n" );return ret; }
@@ -1117,7 +1117,7 @@ static int smu_sw_fini(void *handle) ret =smu_smc_table_sw_fini (smu);if (ret) { -pr_err ("Failed to sw fini smc table!\n" ); +dev_err (adev->dev,"Failed to sw fini smc table!\n" );return ret; }
@@ -1132,7 +1132,7 @@ static int smu_smc_hw_setup(struct smu_context *smu)int ret;if (smu_is_dpm_running (smu) && adev->in_suspend) { -pr_info ("dpm has been enabled\n" ); +dev_info (adev->dev,"dpm has been enabled\n" );return 0 ; }
@@ -1182,7 +1182,7 @@ static int smu_smc_hw_setup(struct smu_context *smu)return ret;if (!smu_is_dpm_running (smu)) -pr_info ("dpm has been disabled\n" ); +dev_info (adev->dev,"dpm has been disabled\n" ); ret =smu_override_pcie_parameters (smu);if (ret)
@@ -1198,7 +1198,7 @@ static int smu_smc_hw_setup(struct smu_context *smu) ret =smu_disable_umc_cdr_12gbps_workaround (smu);if (ret) { -pr_err ("Workaround failed to disable UMC CDR feature on 12Gbps SKU!\n" ); +dev_err (adev->dev,"Workaround failed to disable UMC CDR feature on 12Gbps SKU!\n" );return ret; }
@@ -1210,7 +1210,7 @@ static int smu_smc_hw_setup(struct smu_context *smu) adev->pm.ac_power ?SMU_POWER_SOURCE_AC : SMU_POWER_SOURCE_DC);if (ret) { -pr_err ("Failed to switch to %s mode!\n" , adev->pm.ac_power ?"AC" :"DC" ); +dev_err (adev->dev,"Failed to switch to %s mode!\n" , adev->pm.ac_power ?"AC" :"DC" );return ret; }
@@ -1247,7 +1247,7 @@ static int smu_start_smc_engine(struct smu_context *smu)if (smu->ppt_funcs->check_fw_status) { ret = smu->ppt_funcs->check_fw_status (smu);if (ret) { -pr_err ("SMC is not ready\n" ); +dev_err (adev->dev,"SMC is not ready\n" );return ret; } }
@@ -1274,7 +1274,7 @@ static int smu_hw_init(void *handle) ret =smu_start_smc_engine (smu);if (ret) { -pr_err ("SMU is not ready yet!\n" ); +dev_err (adev->dev,"SMU is not ready yet!\n" );return ret; }
@@ -1307,7 +1307,7 @@ static int smu_hw_init(void *handle) adev->pm.dpm_enabled = true; -pr_info ("SMU is initialized successfully!\n" ); +dev_info (adev->dev,"SMU is initialized successfully!\n" );return 0 ;
@@ -1360,11 +1360,11 @@ static int smu_disable_dpms(struct smu_context *smu) features_to_disable, 0);if (ret) -pr_err ("Failed to disable smu features except BACO.\n" ); +dev_err (adev->dev,"Failed to disable smu features except BACO.\n" ); }else { ret =smu_system_features_control (smu, false);if (ret) -pr_err ("Failed to disable smu features.\n" ); +dev_err (adev->dev,"Failed to disable smu features.\n" ); } if (adev->asic_type >= CHIP_NAVI10 &&
@@ -1385,7 +1385,7 @@ static int smu_smc_hw_cleanup(struct smu_context *smu) ret =smu_disable_thermal_alert (smu);if (ret) { -pr_warn ("Fail to stop thermal control!\n" ); +dev_warn (adev->dev,"Fail to stop thermal control!\n" );return ret; }
@@ -1479,11 +1479,11 @@ static int smu_resume(void *handle)if (!smu->pm_enabled)return 0 ; -pr_info ("SMU is resuming...\n" ); +dev_info (adev->dev,"SMU is resuming...\n" ); ret =smu_start_smc_engine (smu);if (ret) { -pr_err ("SMU is not ready yet!\n" ); +dev_err (adev->dev,"SMU is not ready yet!\n" ); goto failed; }
@@ -1498,7 +1498,7 @@ static int smu_resume(void *handle) adev->pm.dpm_enabled = true; -pr_info ("SMU is resumed successfully!\n" ); +dev_info (adev->dev,"SMU is resumed successfully!\n" );return 0 ;
@@ -1591,7 +1591,7 @@ int smu_get_current_clocks(struct smu_context *smu, ret =smu_get_clock_info (smu, &hw_clocks,PERF_LEVEL_ACTIVITY );if (ret) { -pr_err ("Error in smu_get_clock_info\n" ); +dev_err (smu->adev->dev,"Error in smu_get_clock_info\n" ); goto failed; }
@@ -1687,21 +1687,21 @@ int smu_adjust_power_state_dynamic(struct smu_context *smu,if (!skip_display_settings) { ret =smu_display_config_changed (smu);if (ret) { -pr_err ("Failed to change display config!" ); +dev_err (smu->adev->dev,"Failed to change display config!" );return ret; } } ret =smu_apply_clocks_adjust_rules (smu);if (ret) { -pr_err ("Failed to apply clocks adjust rules!" ); +dev_err (smu->adev->dev,"Failed to apply clocks adjust rules!" );return ret; }if (!skip_display_settings) { ret =smu_notify_smc_display_config (smu);if (ret) { -pr_err ("Failed to notify smc display config!" ); +dev_err (smu->adev->dev,"Failed to notify smc display config!" );return ret; } }
@@ -1709,7 +1709,7 @@ int smu_adjust_power_state_dynamic(struct smu_context *smu,if (smu_dpm_ctx->dpm_level != level) { ret =smu_asic_set_performance_level (smu, level);if (ret) { -pr_err ("Failed to set performance level!" ); +dev_err (smu->adev->dev,"Failed to set performance level!" );return ret; }
@@ -1875,7 +1875,7 @@ int smu_force_clk_levels(struct smu_context *smu,return -EOPNOTSUPP ;if (smu_dpm_ctx->dpm_level !=AMD_DPM_FORCED_LEVEL_MANUAL ) { -pr_debug ("force clock level is for dpm manual mode only.\n" ); +dev_dbg (smu->adev->dev,"force clock level is for dpm manual mode only.\n" );return -EINVAL ; }
@@ -1933,7 +1933,7 @@ int smu_set_mp1_state(struct smu_context *smu, ret =smu_send_smc_msg (smu, msg,NULL );if (ret) -pr_err ("[PrepareMp1] Failed!\n" ); +dev_err (smu->adev->dev,"[PrepareMp1] Failed!\n" );mutex_unlock (&smu->mutex);
@@ -1955,7 +1955,7 @@ int smu_set_df_cstate(struct smu_context *smu, ret = smu->ppt_funcs->set_df_cstate (smu, state);if (ret) -pr_err ("[SetDfCstate] failed!\n" ); +dev_err (smu->adev->dev,"[SetDfCstate] failed!\n" );mutex_unlock (&smu->mutex);
@@ -1976,7 +1976,7 @@ int smu_allow_xgmi_power_down(struct smu_context *smu, bool en) ret = smu->ppt_funcs->allow_xgmi_power_down (smu, en);if (ret) -pr_err ("[AllowXgmiPowerDown] failed!\n" ); +dev_err (smu->adev->dev,"[AllowXgmiPowerDown] failed!\n" );mutex_unlock (&smu->mutex);
@@ -2042,7 +2042,7 @@ int smu_set_ac_dc(struct smu_context *smu) smu->adev->pm.ac_power ?SMU_POWER_SOURCE_AC : SMU_POWER_SOURCE_DC);if (ret) -pr_err ("Failed to switch to %s mode!\n" , +dev_err (smu->adev->dev,"Failed to switch to %s mode!\n" , smu->adev->pm.ac_power ?"AC" :"DC" );mutex_unlock (&smu->mutex);
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +264 -263
1,027 lines not on this page · raw message
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +62 -57
351 lines not on this page · raw message
drivers/gpu/drm/amd/powerplay/renoir_ppt.c +7 -7
@@ -175,7 +175,7 @@ static int renoir_get_metrics_table(struct smu_context *smu, ret =smu_update_table (smu,SMU_TABLE_SMU_METRICS ,0 , (void *)smu_table->metrics_table, false);if (ret) { -pr_info ("Failed to export SMU metrics table!\n" ); +dev_info (smu->adev->dev,"Failed to export SMU metrics table!\n" );mutex_unlock (&smu->metrics_lock);return ret; }
@@ -508,7 +508,7 @@ static int renoir_get_current_activity_percent(struct smu_context *smu, *value = metrics.AverageGfxActivity /100 ;break ;default : -pr_err ("Invalid sensor for retrieving clock activity\n" ); +dev_err (smu->adev->dev,"Invalid sensor for retrieving clock activity\n" );return -EINVAL ; }
@@ -620,7 +620,7 @@ static int renoir_force_clk_levels(struct smu_context *smu,case SMU_GFXCLK :case SMU_SCLK :if (soft_min_level >2 || soft_max_level >2 ) { -pr_info ("Currently sclk only support 3 levels on APU\n" ); +dev_info (smu->adev->dev,"Currently sclk only support 3 levels on APU\n" );return -EINVAL ; }
@@ -674,7 +674,7 @@ static int renoir_set_power_profile_mode(struct smu_context *smu, long *input, uuint32_t profile_mode = input[size];if (profile_mode >PP_SMC_POWER_PROFILE_CUSTOM ) { -pr_err ("Invalid power profile mode %d\n" , smu->power_profile_mode); +dev_err (smu->adev->dev,"Invalid power profile mode %d\n" , smu->power_profile_mode);return -EINVAL ; }
@@ -685,7 +685,7 @@ static int renoir_set_power_profile_mode(struct smu_context *smu, long *input, u* TODO: If some case need switch to powersave/default power mode * then can consider enter WORKLOAD_COMPUTE/WORKLOAD_CUSTOM for power saving. */ -pr_err_once ("Unsupported power profile mode %d on RENOIR\n" ,smu->power_profile_mode); +dev_err_once (smu->adev->dev,"Unsupported power profile mode %d on RENOIR\n" ,smu->power_profile_mode);return -EINVAL ; }
@@ -693,7 +693,7 @@ static int renoir_set_power_profile_mode(struct smu_context *smu, long *input, u1 << workload_type, NULL);if (ret) { -pr_err_once ("Fail to set workload type %d\n" , workload_type); +dev_err_once (smu->adev->dev,"Fail to set workload type %d\n" , workload_type);return ret; }
@@ -826,7 +826,7 @@ static int renoir_set_watermarks_table(if (!(smu->watermarks_bitmap &WATERMARKS_LOADED )) { ret =smu_write_watermarks_table (smu);if (ret) { -pr_err ("Failed to update WMTABLE!" ); +dev_err (smu->adev->dev,"Failed to update WMTABLE!" );return ret; } smu->watermarks_bitmap |=WATERMARKS_LOADED ;
drivers/gpu/drm/amd/powerplay/sienna_cichlid_ppt.c +392 -392
1,033 lines not on this page · raw message
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +26 -26
204 lines not on this page · raw message
drivers/gpu/drm/amd/powerplay/smu_v12_0.c +7 -7
@@ -92,7 +92,7 @@ smu_v12_0_send_msg_with_param(struct smu_context *smu,mutex_lock (&smu->message_lock); ret =smu_v12_0_wait_for_response (smu);if (ret) { -pr_err ("Msg issuing pre-check failed and " +dev_err (adev->dev,"Msg issuing pre-check failed and " "SMU may be not in the right state!\n" ); goto out; }
@@ -105,14 +105,14 @@ smu_v12_0_send_msg_with_param(struct smu_context *smu, ret =smu_v12_0_wait_for_response (smu);if (ret) { -pr_err ("Failed to send message 0x%x, response 0x%x param 0x%x\n" , +dev_err (adev->dev,"Failed to send message 0x%x, response 0x%x param 0x%x\n" , index, ret, param); goto out; }if (read_arg) { ret =smu_v12_0_read_arg (smu, read_arg);if (ret) { -pr_err ("Failed to read message arg 0x%x, response 0x%x param 0x%x\n" , +dev_err (adev->dev,"Failed to read message arg 0x%x, response 0x%x param 0x%x\n" , index, ret, param); goto out; }
@@ -161,11 +161,11 @@ int smu_v12_0_check_fw_version(struct smu_context *smu)* of halt driver loading. */ if (if_version != smu->smc_driver_if_version) { -pr_info ("smu driver if version = 0x%08x, smu fw if version = 0x%08x, " +dev_info (smu->adev->dev,"smu driver if version = 0x%08x, smu fw if version = 0x%08x, " "smu fw version = 0x%08x (%d.%d.%d)\n" , smu->smc_driver_if_version, if_version, smu_version, smu_major, smu_minor, smu_debug); -pr_warn ("SMU driver if version not matched\n" ); +dev_warn (smu->adev->dev,"SMU driver if version not matched\n" ); }return ret;
@@ -378,7 +378,7 @@ int smu_v12_0_get_dpm_ultimate_freq(struct smu_context *smu, enum smu_clk_type ccase SMU_SCLK : ret =smu_send_smc_msg (smu, SMU_MSG_GetMaxGfxclkFrequency, max);if (ret) { -pr_err ("Attempt to get max GX frequency from SMC Failed !\n" ); +dev_err (smu->adev->dev,"Attempt to get max GX frequency from SMC Failed !\n" ); goto failed; }break ;
@@ -406,7 +406,7 @@ int smu_v12_0_get_dpm_ultimate_freq(struct smu_context *smu, enum smu_clk_type ccase SMU_SCLK : ret =smu_send_smc_msg (smu, SMU_MSG_GetMinGfxclkFrequency, min);if (ret) { -pr_err ("Attempt to get min GX frequency from SMC Failed !\n" ); +dev_err (smu->adev->dev,"Attempt to get min GX frequency from SMC Failed !\n" ); goto failed; }break ;
Signature · 6 lines
2.27.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/3 drm/amd/powerplay: forbid to use pr_err/warn/info/debug
Use dev_err/warn/info/dbg instead. They are more MGPU friendly.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 10 ++++++++++ drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 10 ++++++++++ drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 10 ++++++++++ drivers/gpu/drm/amd/powerplay/renoir_ppt.c | 9 +++++++++ drivers/gpu/drm/amd/powerplay/sienna_cichlid_ppt.c | 10 ++++++++++ drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 10 ++++++++++ drivers/gpu/drm/amd/powerplay/smu_v12_0.c | 10 ++++++++++ 7 files changed, 69 insertions(+)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +10 -0
@@ -34,6 +34,16 @@#include "sienna_cichlid_ppt.h" #include "renoir_ppt.h" +/* +* DO NOT use these for err/warn/info/debug messages. +* Use dev_err, dev_warn, dev_info and dev_dbg instead. +* They are more MGPU friendly. +*/ +#undef pr_err +#undef pr_warn +#undef pr_info +#undef pr_debug +#undef __SMU_DUMMY_MAP#define __SMU_DUMMY_MAP (type) #typestatic const char * __smu_message_names[] = {
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +10 -0
@@ -42,6 +42,16 @@#include <linux/pci.h> #include "amdgpu_ras.h" +/* +* DO NOT use these for err/warn/info/debug messages. +* Use dev_err, dev_warn, dev_info and dev_dbg instead. +* They are more MGPU friendly. +*/ +#undef pr_err +#undef pr_warn +#undef pr_info +#undef pr_debug +#define to_amdgpu_device (x) (container_of(x, struct amdgpu_device, pm.smu_i2c))#define CTF_OFFSET_EDGE 5
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +10 -0
@@ -40,6 +40,16 @@#include "asic_reg/mp/mp_11_0_sh_mask.h" +/* +* DO NOT use these for err/warn/info/debug messages. +* Use dev_err, dev_warn, dev_info and dev_dbg instead. +* They are more MGPU friendly. +*/ +#undef pr_err +#undef pr_warn +#undef pr_info +#undef pr_debug +#define FEATURE_MASK (feature) (1ULL << feature)#define SMC_DPM_FEATURE ( \ FEATURE_MASK(FEATURE_DPM_PREFETCHER_BIT) | \
drivers/gpu/drm/amd/powerplay/renoir_ppt.c +9 -0
@@ -29,6 +29,15 @@#include "smu_v12_0.h" #include "renoir_ppt.h" +/* +* DO NOT use these for err/warn/info/debug messages. +* Use dev_err, dev_warn, dev_info and dev_dbg instead. +* They are more MGPU friendly. +*/ +#undef pr_err +#undef pr_warn +#undef pr_info +#undef pr_debug#define CLK_MAP (clk, index) \ [SMU_##clk] = {1, (index)}
drivers/gpu/drm/amd/powerplay/sienna_cichlid_ppt.c +10 -0
@@ -40,6 +40,16 @@#include "asic_reg/mp/mp_11_0_sh_mask.h" +/* +* DO NOT use these for err/warn/info/debug messages. +* Use dev_err, dev_warn, dev_info and dev_dbg instead. +* They are more MGPU friendly. +*/ +#undef pr_err +#undef pr_warn +#undef pr_info +#undef pr_debug +#define FEATURE_MASK (feature) (1ULL << feature)#define SMC_DPM_FEATURE ( \ FEATURE_MASK(FEATURE_DPM_PREFETCHER_BIT) | \
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +10 -0
@@ -46,6 +46,16 @@#include "asic_reg/smuio/smuio_11_0_0_offset.h" #include "asic_reg/smuio/smuio_11_0_0_sh_mask.h" +/* +* DO NOT use these for err/warn/info/debug messages. +* Use dev_err, dev_warn, dev_info and dev_dbg instead. +* They are more MGPU friendly. +*/ +#undef pr_err +#undef pr_warn +#undef pr_info +#undef pr_debug +MODULE_FIRMWARE ("amdgpu/arcturus_smc.bin" );MODULE_FIRMWARE ("amdgpu/navi10_smc.bin" );MODULE_FIRMWARE ("amdgpu/navi14_smc.bin" );
drivers/gpu/drm/amd/powerplay/smu_v12_0.c +10 -0
@@ -35,6 +35,16 @@#include "asic_reg/smuio/smuio_12_0_0_offset.h" #include "asic_reg/smuio/smuio_12_0_0_sh_mask.h" +/* +* DO NOT use these for err/warn/info/debug messages. +* Use dev_err, dev_warn, dev_info and dev_dbg instead. +* They are more MGPU friendly. +*/ +#undef pr_err +#undef pr_warn +#undef pr_info +#undef pr_debug +// because some SMU12 based ASICs use older ip offset tables // we should undefine this register from the smuio12 header // to prevent confusion down the road
Signature · 6 lines
2.27.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/3 drm/amd/powerplay: add error messages on some critical paths
In reply to Evan QuanHelpful for error diagnostic.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 118 +++++++++++++++------ 1 file changed, 87 insertions(+), 31 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +87 -31
@@ -457,18 +457,30 @@ int smu_dpm_set_power_gate(struct smu_context *smu, uint32_t block_type,switch (block_type) {case AMD_IP_BLOCK_TYPE_UVD : ret =smu_dpm_set_uvd_enable (smu, !gate); +if (ret) +dev_err (smu->adev->dev,"Failed to power %s UVD!\n" , + gate ?"gate" :"ungate" );break ;case AMD_IP_BLOCK_TYPE_VCE : ret =smu_dpm_set_vce_enable (smu, !gate);break ;case AMD_IP_BLOCK_TYPE_GFX : ret =smu_gfx_off_control (smu, gate); +if (ret) +dev_err (smu->adev->dev,"Failed to %s gfxoff!\n" , + gate ?"enable" :"disable" );break ;case AMD_IP_BLOCK_TYPE_SDMA : ret =smu_powergate_sdma (smu, gate); +if (ret) +dev_err (smu->adev->dev,"Failed to power %s SDMA!\n" , + gate ?"gate" :"ungate" );break ;case AMD_IP_BLOCK_TYPE_JPEG : ret =smu_dpm_set_jpeg_enable (smu, !gate); +if (ret) +dev_err (smu->adev->dev,"Failed to power %s JPEG!\n" , + gate ?"gate" :"ungate" );break ;default :break ;
@@ -788,8 +800,10 @@ static int smu_late_init(void *handle)return 0 ; ret =smu_set_default_od_settings (smu); -if (ret) +if (ret) { +dev_err (adev->dev,"Failed to setup default OD settings!\n" );return ret; + }/* * Set initialized values (get from vbios) to dpm tables context such as
@@ -797,20 +811,28 @@ static int smu_late_init(void *handle)* type of clks. */ ret =smu_populate_smc_tables (smu); -if (ret) +if (ret) { +dev_err (adev->dev,"Failed to setup default dpm clock tables!\n" );return ret; + } ret =smu_init_max_sustainable_clocks (smu); -if (ret) +if (ret) { +dev_err (adev->dev,"Failed to init max sustainable clocks!\n" );return ret; + } ret =smu_populate_umd_state_clk (smu); -if (ret) +if (ret) { +dev_err (adev->dev,"Failed to populate UMD state clocks!\n" );return ret; + } ret =smu_get_power_limit (smu, &smu->default_power_limit, false, false); -if (ret) +if (ret) { +dev_err (adev->dev,"Failed to get default power limit!\n" );return ret; + }smu_get_unique_id (smu);
@@ -954,6 +976,8 @@ static int smu_alloc_memory_pool(struct smu_context *smu) &memory_pool->bo, &memory_pool->mc_address, &memory_pool->cpu_addr); +if (ret) +dev_err (adev->dev,"VRAM allocation for dramlog failed!\n" );break ;default :break ;
@@ -1147,27 +1171,35 @@ static int smu_smc_hw_setup(struct smu_context *smu) } ret =smu_init_display_count (smu,0 ); -if (ret) +if (ret) { +dev_info (adev->dev,"Failed to pre-set display count as 0!\n" );return ret; + } ret =smu_set_driver_table_location (smu); -if (ret) +if (ret) { +dev_err (adev->dev,"Failed to SetDriverDramAddr!\n" );return ret; + }/* * Set PMSTATUSLOG table bo address with SetToolsDramAddr MSG for tools. */ ret =smu_set_tool_table_location (smu); -if (ret) +if (ret) { +dev_err (adev->dev,"Failed to SetToolsDramAddr!\n" );return ret; + }/* * Use msg SetSystemVirtualDramAddr and DramLogSetDramAddr can notify * pool location. */ ret =smu_notify_memory_pool_location (smu); -if (ret) +if (ret) { +dev_err (adev->dev,"Failed to SetDramLogDramAddr!\n" );return ret; + }/* smu_dump_pptable(smu); */ /*
@@ -1175,8 +1207,10 @@ static int smu_smc_hw_setup(struct smu_context *smu)* SetDriverDramAddr and TransferTableDram2Smu. */ ret =smu_write_pptable (smu); -if (ret) +if (ret) { +dev_err (adev->dev,"Failed to transfer pptable to SMC!\n" );return ret; + }/* issue Run*Btc msg */ ret =smu_run_btc (smu);
@@ -1184,12 +1218,16 @@ static int smu_smc_hw_setup(struct smu_context *smu)return ret; ret =smu_feature_set_allowed_mask (smu); -if (ret) +if (ret) { +dev_err (adev->dev,"Failed to set driver allowed features mask!\n" );return ret; + } ret =smu_system_features_control (smu, true); -if (ret) +if (ret) { +dev_err (adev->dev,"Failed to enable requested dpm features!\n" );return ret; + }if (!smu_is_dpm_running (smu))dev_info (adev->dev,"dpm has been disabled\n" );
@@ -1199,8 +1237,10 @@ static int smu_smc_hw_setup(struct smu_context *smu)return ret; ret =smu_enable_thermal_alert (smu); -if (ret) +if (ret) { +dev_err (adev->dev,"Failed to enable thermal alert!\n" );return ret; + } ret =smu_i2c_eeprom_init (smu, &adev->pm.smu_i2c);if (ret)
@@ -1284,7 +1324,7 @@ static int smu_hw_init(void *handle) ret =smu_start_smc_engine (smu);if (ret) { -dev_err (adev->dev,"SMU is not ready yet!\n" ); +dev_err (adev->dev,"SMC engine is not correctly up!\n" );return ret; }
@@ -1300,29 +1340,32 @@ static int smu_hw_init(void *handle)/* get boot_values from vbios to set revision, gfxclk, and etc. */ ret =smu_get_vbios_bootup_values (smu); -if (ret) +if (ret) { +dev_err (adev->dev,"Failed to get VBIOS boot clock values!\n" );return ret; + } ret =smu_setup_pptable (smu); -if (ret) +if (ret) { +dev_err (adev->dev,"Failed to setup pptable!\n" );return ret; + } ret =smu_get_driver_allowed_feature_mask (smu);if (ret) - goto failed; +return ret; ret =smu_smc_hw_setup (smu); -if (ret) - goto failed; +if (ret) { +dev_err (adev->dev,"Failed to setup smc hw!\n" ); +return ret; + } adev->pm.dpm_enabled = true;dev_info (adev->dev,"SMU is initialized successfully!\n" );return 0 ; - -failed: -return ret; }static int smu_disable_dpms (struct smu_context *smu)
@@ -1395,13 +1438,15 @@ static int smu_smc_hw_cleanup(struct smu_context *smu) ret =smu_disable_thermal_alert (smu);if (ret) { -dev_warn (adev->dev,"Fail to stop thermal control!\n" ); +dev_err (adev->dev,"Fail to disable thermal alert!\n" );return ret; } ret =smu_disable_dpms (smu); -if (ret) +if (ret) { +dev_err (adev->dev,"Fail to disable dpm features!\n" );return ret; + }return 0 ; }
@@ -1493,13 +1538,15 @@ static int smu_resume(void *handle) ret =smu_start_smc_engine (smu);if (ret) { -dev_err (adev->dev,"SMU is not ready yet!\n" ); - goto failed; +dev_err (adev->dev,"SMC engine is not correctly up!\n" ); +return ret; } ret =smu_smc_hw_setup (smu); -if (ret) - goto failed; +if (ret) { +dev_err (adev->dev,"Failed to setup smc hw!\n" ); +return ret; + }if (smu->is_apu)smu_set_gfx_cgpg (&adev->smu, true);
@@ -1511,9 +1558,6 @@ static int smu_resume(void *handle)dev_info (adev->dev,"SMU is resumed successfully!\n" );return 0 ; - -failed: -return ret; } int smu_display_configuration_change(struct smu_context *smu,
@@ -2589,6 +2633,9 @@ int smu_set_xgmi_pstate(struct smu_context *smu,mutex_unlock (&smu->mutex); +if (ret) +dev_err (smu->adev->dev,"Failed to set XGMI pstate!\n" ); +return ret; }
@@ -2660,6 +2707,9 @@ int smu_baco_enter(struct smu_context *smu)mutex_unlock (&smu->mutex); +if (ret) +dev_err (smu->adev->dev,"Failed to enter BACO state!\n" ); +return ret; }
@@ -2677,6 +2727,9 @@ int smu_baco_exit(struct smu_context *smu)mutex_unlock (&smu->mutex); +if (ret) +dev_err (smu->adev->dev,"Failed to exit BACO state!\n" ); +return ret; }
@@ -2694,6 +2747,9 @@ int smu_mode2_reset(struct smu_context *smu)mutex_unlock (&smu->mutex); +if (ret) +dev_err (smu->adev->dev,"Mode2 reset failed!\n" ); +return ret; }
Signature · 6 lines
2.27.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 3/3] drm/amd/powerplay: add error messages on some critical paths
Quoted 5 lines · Evan Quan
Helpful for error diagnostic.
Change-Id I983ca308a2ee6ed11e16ec59ad97040d98b90512Signed-off-by Evan Quan <[email protected]>
Series is:
Quoted 317 lines
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 118 +++++++++++++++------ 1 file changed, 87 insertions(+), 31 deletions(-)drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +87
-32@@ -457,18 +457,30 @@ int smu_dpm_set_power_gate(struct smu_context *smu, uint32_t block_type,switch (block_type) {case AMD_IP_BLOCK_TYPE_UVD : ret =smu_dpm_set_uvd_enable (smu, !gate); +if (ret) +dev_err (smu->adev->dev,"Failed to power %s UVD!\n" , + gate ?"gate" :"ungate" );break ;case AMD_IP_BLOCK_TYPE_VCE : ret =smu_dpm_set_vce_enable (smu, !gate);break ;case AMD_IP_BLOCK_TYPE_GFX : ret =smu_gfx_off_control (smu, gate); +if (ret) +dev_err (smu->adev->dev,"Failed to %s gfxoff!\n" , + gate ?"enable" :"disable" );break ;case AMD_IP_BLOCK_TYPE_SDMA : ret =smu_powergate_sdma (smu, gate); +if (ret) +dev_err (smu->adev->dev,"Failed to power %s SDMA!\n" , + gate ?"gate" :"ungate" );break ;case AMD_IP_BLOCK_TYPE_JPEG : ret =smu_dpm_set_jpeg_enable (smu, !gate); +if (ret) +dev_err (smu->adev->dev,"Failed to power %s JPEG!\n" , + gate ?"gate" :"ungate" );break ;default :break ;@@ -788,8 +800,10 @@ static int smu_late_init(void *handle)return 0 ; ret =smu_set_default_od_settings (smu); -if (ret) +if (ret) { +dev_err (adev->dev,"Failed to setup default OD settings!\n" );return ret; + }/* * Set initialized values (get from vbios) to dpm tables context such as @@ -797,20 +811,28 @@ static int smu_late_init(void *handle)* type of clks. */ ret =smu_populate_smc_tables (smu); -if (ret) +if (ret) { +dev_err (adev->dev,"Failed to setup default dpm clock tables!\n" );return ret; + } ret =smu_init_max_sustainable_clocks (smu); -if (ret) +if (ret) { +dev_err (adev->dev,"Failed to init max sustainable clocks!\n" );return ret; + } ret =smu_populate_umd_state_clk (smu); -if (ret) +if (ret) { +dev_err (adev->dev,"Failed to populate UMD state clocks!\n" );return ret; + } ret =smu_get_power_limit (smu, &smu->default_power_limit, false, false); -if (ret) +if (ret) { +dev_err (adev->dev,"Failed to get default power limit!\n" );return ret; + }smu_get_unique_id (smu);@@ -954,6 +976,8 @@ static int smu_alloc_memory_pool(struct smu_context *smu) &memory_pool->bo, &memory_pool->mc_address, &memory_pool->cpu_addr); +if (ret) +dev_err (adev->dev,"VRAM allocation for dramlog failed!\n" );break ;default :break ;@@ -1147,27 +1171,35 @@ static int smu_smc_hw_setup(struct smu_context *smu) } ret =smu_init_display_count (smu,0 ); -if (ret) +if (ret) { +dev_info (adev->dev,"Failed to pre-set display count as 0!\n" );return ret; + } ret =smu_set_driver_table_location (smu); -if (ret) +if (ret) { +dev_err (adev->dev,"Failed to SetDriverDramAddr!\n" );return ret; + }/* * Set PMSTATUSLOG table bo address with SetToolsDramAddr MSG for tools. */ ret =smu_set_tool_table_location (smu); -if (ret) +if (ret) { +dev_err (adev->dev,"Failed to SetToolsDramAddr!\n" );return ret; + }/* * Use msg SetSystemVirtualDramAddr and DramLogSetDramAddr can notify * pool location. */ ret =smu_notify_memory_pool_location (smu); -if (ret) +if (ret) { +dev_err (adev->dev,"Failed to SetDramLogDramAddr!\n" );return ret; + }/* smu_dump_pptable(smu); */ /* @@ -1175,8 +1207,10 @@ static int smu_smc_hw_setup(struct smu_context *smu)* SetDriverDramAddr and TransferTableDram2Smu. */ ret =smu_write_pptable (smu); -if (ret) +if (ret) { +dev_err (adev->dev,"Failed to transfer pptable to SMC!\n" );return ret; + }/* issue Run*Btc msg */ ret =smu_run_btc (smu);@@ -1184,12 +1218,16 @@ static int smu_smc_hw_setup(struct smu_context *smu)return ret; ret =smu_feature_set_allowed_mask (smu); -if (ret) +if (ret) { +dev_err (adev->dev,"Failed to set driver allowed features mask!\n" );return ret; + } ret =smu_system_features_control (smu, true); -if (ret) +if (ret) { +dev_err (adev->dev,"Failed to enable requested dpm features!\n" );return ret; + }if (!smu_is_dpm_running (smu))dev_info (adev->dev,"dpm has been disabled\n" );@@ -1199,8 +1237,10 @@ static int smu_smc_hw_setup(struct smu_context *smu)return ret; ret =smu_enable_thermal_alert (smu); -if (ret) +if (ret) { +dev_err (adev->dev,"Failed to enable thermal alert!\n" );return ret; + } ret =smu_i2c_eeprom_init (smu, &adev->pm.smu_i2c);if (ret)@@ -1284,7 +1324,7 @@ static int smu_hw_init(void *handle) ret =smu_start_smc_engine (smu);if (ret) { -dev_err (adev->dev,"SMU is not ready yet!\n" ); +dev_err (adev->dev,"SMC engine is not correctly up!\n" );return ret; }@@ -1300,29 +1340,32 @@ static int smu_hw_init(void *handle)/* get boot_values from vbios to set revision, gfxclk, and etc. */ ret =smu_get_vbios_bootup_values (smu); -if (ret) +if (ret) { +dev_err (adev->dev,"Failed to get VBIOS boot clock values!\n" );return ret; + } ret =smu_setup_pptable (smu); -if (ret) +if (ret) { +dev_err (adev->dev,"Failed to setup pptable!\n" );return ret; + } ret =smu_get_driver_allowed_feature_mask (smu);if (ret) - goto failed; +return ret; ret =smu_smc_hw_setup (smu); -if (ret) - goto failed; +if (ret) { +dev_err (adev->dev,"Failed to setup smc hw!\n" ); +return ret; + } adev->pm.dpm_enabled = true;dev_info (adev->dev,"SMU is initialized successfully!\n" );return 0 ; - -failed: -return ret; }static int smu_disable_dpms (struct smu_context *smu)@@ -1395,13 +1438,15 @@ static int smu_smc_hw_cleanup(struct smu_context *smu) ret =smu_disable_thermal_alert (smu);if (ret) { -dev_warn (adev->dev,"Fail to stop thermal control!\n" ); +dev_err (adev->dev,"Fail to disable thermal alert!\n" );return ret; } ret =smu_disable_dpms (smu); -if (ret) +if (ret) { +dev_err (adev->dev,"Fail to disable dpm features!\n" );return ret; + }return 0 ; }@@ -1493,13 +1538,15 @@ static int smu_resume(void *handle) ret =smu_start_smc_engine (smu);if (ret) { -dev_err (adev->dev,"SMU is not ready yet!\n" ); - goto failed; +dev_err (adev->dev,"SMC engine is not correctly up!\n" ); +return ret; } ret =smu_smc_hw_setup (smu); -if (ret) - goto failed; +if (ret) { +dev_err (adev->dev,"Failed to setup smc hw!\n" ); +return ret; + }if (smu->is_apu)smu_set_gfx_cgpg (&adev->smu, true);@@ -1511,9 +1558,6 @@ static int smu_resume(void *handle)dev_info (adev->dev,"SMU is resumed successfully!\n" );return 0 ; - -failed: -return ret; } int smu_display_configuration_change(struct smu_context *smu,@@ -2589,6 +2633,9 @@ int smu_set_xgmi_pstate(struct smu_context *smu,mutex_unlock (&smu->mutex); +if (ret) +dev_err (smu->adev->dev,"Failed to set XGMI pstate!\n" ); +return ret; }@@ -2660,6 +2707,9 @@ int smu_baco_enter(struct smu_context *smu)mutex_unlock (&smu->mutex); +if (ret) +dev_err (smu->adev->dev,"Failed to enter BACO state!\n" ); +return ret; }@@ -2677,6 +2727,9 @@ int smu_baco_exit(struct smu_context *smu)mutex_unlock (&smu->mutex); +if (ret) +dev_err (smu->adev->dev,"Failed to exit BACO state!\n" ); +return ret; }@@ -2694,6 +2747,9 @@ int smu_mode2_reset(struct smu_context *smu)mutex_unlock (&smu->mutex); +if (ret) +dev_err (smu->adev->dev,"Mode2 reset failed!\n" ); +return ret; } --2.27.0
Quoted 4 lines
_______________________________________________
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