drm/amd/powerplay: drop unnecessary wrapper around pcie parameters setting
Subsystems (2)
PATCH 1/2 drm/amd/powerplay: drop unnecessary wrapper around pcie parameters setting
This can also help to maintain clear code layer.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 33 ++++++++++++++- drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 1 - .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 1 - drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h | 2 - drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 1 - .../drm/amd/powerplay/sienna_cichlid_ppt.c | 1 - drivers/gpu/drm/amd/powerplay/smu_internal.h | 1 - drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 42 ------------------- 8 files changed, 31 insertions(+), 51 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +31 -2
@@ -33,6 +33,7 @@#include "navi10_ppt.h" #include "sienna_cichlid_ppt.h" #include "renoir_ppt.h" +#include "amd_pcie.h" /* * DO NOT use these for err/warn/info/debug messages.
@@ -993,6 +994,7 @@ static int smu_sw_fini(void *handle)static int smu_smc_hw_setup (struct smu_context *smu) {struct amdgpu_device *adev = smu->adev; +uint32_t pcie_gen =0 , pcie_width =0 ;int ret;if (smu_is_dpm_running (smu) && adev->in_suspend) {
@@ -1062,9 +1064,36 @@ static int smu_smc_hw_setup(struct smu_context *smu)if (!smu_is_dpm_running (smu))dev_info (adev->dev,"dpm has been disabled\n" ); - ret =smu_override_pcie_parameters (smu); -if (ret) +if (adev->pm.pcie_gen_mask &CAIL_PCIE_LINK_SPEED_SUPPORT_GEN4 ) + pcie_gen =3 ; +else if (adev->pm.pcie_gen_mask &CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3 ) + pcie_gen =2 ; +else if (adev->pm.pcie_gen_mask &CAIL_PCIE_LINK_SPEED_SUPPORT_GEN2 ) + pcie_gen =1 ; +else if (adev->pm.pcie_gen_mask &CAIL_PCIE_LINK_SPEED_SUPPORT_GEN1 ) + pcie_gen =0 ; + +/* Bit 31:16: LCLK DPM level. 0 is DPM0, and 1 is DPM1 +* Bit 15:8: PCIE GEN, 0 to 3 corresponds to GEN1 to GEN4 +* Bit 7:0: PCIE lane width, 1 to 7 corresponds is x1 to x32 +*/ +if (adev->pm.pcie_mlw_mask &CAIL_PCIE_LINK_WIDTH_SUPPORT_X16 ) + pcie_width =6 ; +else if (adev->pm.pcie_mlw_mask &CAIL_PCIE_LINK_WIDTH_SUPPORT_X12 ) + pcie_width =5 ; +else if (adev->pm.pcie_mlw_mask &CAIL_PCIE_LINK_WIDTH_SUPPORT_X8 ) + pcie_width =4 ; +else if (adev->pm.pcie_mlw_mask &CAIL_PCIE_LINK_WIDTH_SUPPORT_X4 ) + pcie_width =3 ; +else if (adev->pm.pcie_mlw_mask &CAIL_PCIE_LINK_WIDTH_SUPPORT_X2 ) + pcie_width =2 ; +else if (adev->pm.pcie_mlw_mask &CAIL_PCIE_LINK_WIDTH_SUPPORT_X1 ) + pcie_width =1 ; + ret =smu_update_pcie_parameters (smu, pcie_gen, pcie_width); +if (ret) { +dev_err (adev->dev,"Attempt to override pcie params failed!\n" );return ret; + } ret =smu_enable_thermal_alert (smu);if (ret) {
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +0 -1
@@ -2422,7 +2422,6 @@ static const struct pptable_funcs arcturus_ppt_funcs = { .baco_exit = smu_v11_0_baco_exit, .get_dpm_ultimate_freq = smu_v11_0_get_dpm_ultimate_freq, .set_soft_freq_limited_range = smu_v11_0_set_soft_freq_limited_range, - .override_pcie_parameters = NULL, .set_df_cstate = arcturus_set_df_cstate, .allow_xgmi_power_down = arcturus_allow_xgmi_power_down, .log_thermal_throttling_event = arcturus_log_thermal_throttling_event,
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +0 -1
@@ -566,7 +566,6 @@ struct pptable_funcs {int (*mode2_reset)(struct smu_context *smu);int (*get_dpm_ultimate_freq)(struct smu_context *smu,enum smu_clk_type clk_type,uint32_t *min,uint32_t *max);int (*set_soft_freq_limited_range)(struct smu_context *smu,enum smu_clk_type clk_type,uint32_t min,uint32_t max); -int (*override_pcie_parameters)(struct smu_context *smu);int (*disable_umc_cdr_12gbps_workaround)(struct smu_context *smu);int (*set_power_source)(struct smu_context *smu,enum smu_power_src_type power_src);void (*log_thermal_throttling_event)(struct smu_context *smu);
drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h +0 -2
@@ -268,8 +268,6 @@ int smu_v11_0_set_hard_freq_limited_range(struct smu_context *smu,uint32_t min, uint32_t max); -int smu_v11_0_override_pcie_parameters (struct smu_context *smu); -int smu_v11_0_set_performance_level (struct smu_context *smu,enum amd_dpm_forced_level level);
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -1
@@ -2435,7 +2435,6 @@ static const struct pptable_funcs navi10_ppt_funcs = { .baco_exit = smu_v11_0_baco_exit, .get_dpm_ultimate_freq = smu_v11_0_get_dpm_ultimate_freq, .set_soft_freq_limited_range = smu_v11_0_set_soft_freq_limited_range, - .override_pcie_parameters = smu_v11_0_override_pcie_parameters, .set_default_od_settings = navi10_set_default_od_settings, .od_edit_dpm_table = navi10_od_edit_dpm_table, .run_btc = navi10_run_btc,
drivers/gpu/drm/amd/powerplay/sienna_cichlid_ppt.c +0 -1
@@ -2551,7 +2551,6 @@ static const struct pptable_funcs sienna_cichlid_ppt_funcs = { .baco_exit = smu_v11_0_baco_exit, .get_dpm_ultimate_freq = sienna_cichlid_get_dpm_ultimate_freq, .set_soft_freq_limited_range = smu_v11_0_set_soft_freq_limited_range, - .override_pcie_parameters = smu_v11_0_override_pcie_parameters, .set_thermal_range = sienna_cichlid_set_thermal_range, };
drivers/gpu/drm/amd/powerplay/smu_internal.h +0 -1
@@ -90,7 +90,6 @@#define smu_get_dpm_ultimate_freq (smu, param, min, max) smu_ppt_funcs(get_dpm_ultimate_freq, 0, smu, param, min, max)#define smu_asic_set_performance_level (smu, level) smu_ppt_funcs(set_performance_level, -EINVAL, smu, level)#define smu_dump_pptable (smu) smu_ppt_funcs(dump_pptable, 0, smu) -#define smu_override_pcie_parameters (smu) smu_ppt_funcs(override_pcie_parameters, 0, smu)#define smu_update_pcie_parameters (smu, pcie_gen_cap, pcie_width_cap) smu_ppt_funcs(update_pcie_parameters, 0, smu, pcie_gen_cap, pcie_width_cap)#define smu_set_thermal_range (smu, range) smu_ppt_funcs(set_thermal_range, 0, smu, range)#define smu_disable_umc_cdr_12gbps_workaround (smu) smu_ppt_funcs(disable_umc_cdr_12gbps_workaround, 0, smu)
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0 -42
54 lines not on this page · raw message
Signature · 6 lines
2.27.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/2 drm/amd/powerplay: correct the supported pcie GenSpeed and LaneCount
The LCLK dpm table setup should be performed in .update_pcie_parameters(). Otherwise, the updated GenSpeed and LaneCount information will be lost.
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 17 +++++++---------- .../gpu/drm/amd/powerplay/sienna_cichlid_ppt.c | 17 +++++++---------- 2 files changed, 14 insertions(+), 20 deletions(-)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +7 -10
@@ -693,7 +693,6 @@ static int navi10_set_default_dpm_table(struct smu_context *smu)PPTable_t *driver_ppt = smu->smu_table.driver_pptable;struct smu_11_0_dpm_table *dpm_table;int ret =0 ; -int i;/* socclk dpm table setup */ dpm_table = &dpm_context->dpm_tables.soc_table;
@@ -857,12 +856,6 @@ static int navi10_set_default_dpm_table(struct smu_context *smu) dpm_table->max = dpm_table->dpm_levels[0 ].value; } -/* lclk dpm table setup */ -for (i =0 ; i <MAX_PCIE_CONF ; i++) { - dpm_context->dpm_tables.pcie_table.pcie_gen[i] = driver_ppt->PcieGenSpeed[i]; - dpm_context->dpm_tables.pcie_table.pcie_lane[i] = driver_ppt->PcieLaneCount[i]; - } -return 0 ; }
@@ -1936,12 +1929,16 @@ static int navi10_update_pcie_parameters(struct smu_context *smu, uint32_t pcie_gen_cap, uint32_t pcie_width_cap) { +struct smu_11_0_dpm_context *dpm_context = smu->smu_dpm.dpm_context;PPTable_t *pptable = smu->smu_table.driver_pptable; -int ret, i;uint32_t smu_pcie_arg; +int ret, i; -struct smu_dpm_context *smu_dpm = &smu->smu_dpm; -struct smu_11_0_dpm_context *dpm_context = smu_dpm->dpm_context; +/* lclk dpm table setup */ +for (i =0 ; i <MAX_PCIE_CONF ; i++) { + dpm_context->dpm_tables.pcie_table.pcie_gen[i] = pptable->PcieGenSpeed[i]; + dpm_context->dpm_tables.pcie_table.pcie_lane[i] = pptable->PcieLaneCount[i]; + }for (i =0 ; i <NUM_LINK_LEVELS ; i++) { smu_pcie_arg = (i << 16) |
drivers/gpu/drm/amd/powerplay/sienna_cichlid_ppt.c +7 -10
@@ -601,7 +601,6 @@ static int sienna_cichlid_set_default_dpm_table(struct smu_context *smu)PPTable_t *driver_ppt = smu->smu_table.driver_pptable;struct smu_11_0_dpm_table *dpm_table;int ret =0 ; -int i;/* socclk dpm table setup */ dpm_table = &dpm_context->dpm_tables.soc_table;
@@ -819,12 +818,6 @@ static int sienna_cichlid_set_default_dpm_table(struct smu_context *smu) dpm_table->max = dpm_table->dpm_levels[0 ].value; } -/* lclk dpm table setup */ -for (i =0 ; i <MAX_PCIE_CONF ; i++) { - dpm_context->dpm_tables.pcie_table.pcie_gen[i] = driver_ppt->PcieGenSpeed[i]; - dpm_context->dpm_tables.pcie_table.pcie_lane[i] = driver_ppt->PcieLaneCount[i]; - } -return 0 ; }
@@ -1722,12 +1715,16 @@ static int sienna_cichlid_update_pcie_parameters(struct smu_context *smu, uint32_t pcie_gen_cap, uint32_t pcie_width_cap) { +struct smu_11_0_dpm_context *dpm_context = smu->smu_dpm.dpm_context;PPTable_t *pptable = smu->smu_table.driver_pptable; -int ret, i;uint32_t smu_pcie_arg; +int ret, i; -struct smu_dpm_context *smu_dpm = &smu->smu_dpm; -struct smu_11_0_dpm_context *dpm_context = smu_dpm->dpm_context; +/* lclk dpm table setup */ +for (i =0 ; i <MAX_PCIE_CONF ; i++) { + dpm_context->dpm_tables.pcie_table.pcie_gen[i] = pptable->PcieGenSpeed[i]; + dpm_context->dpm_tables.pcie_table.pcie_lane[i] = pptable->PcieLaneCount[i]; + }for (i =0 ; i <NUM_LINK_LEVELS ; i++) { smu_pcie_arg = (i << 16) |
Signature · 6 lines
2.27.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 2/2] drm/amd/powerplay: correct the supported pcie GenSpeed and LaneCount
Quoted 6 lines · Evan Quan
The LCLK dpm table setup should be performed in .update_pcie_parameters(). Otherwise, the updated GenSpeed and LaneCount information will be lost.
Change-Id I028c26ca0e54098cb93d9e9266719f1762ba2d7eSigned-off-by Evan Quan <[email protected]>
Series is:
Thanks,
Alex
Quoted 98 lines
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 17 +++++++---------- .../gpu/drm/amd/powerplay/sienna_cichlid_ppt.c | 17 +++++++---------- 2 files changed, 14 insertions(+), 20 deletions(-)drivers/gpu/drm/amd/powerplay/navi10_ppt.c +7
-10@@ -693,7 +693,6 @@ static int navi10_set_default_dpm_table(struct smu_context *smu)PPTable_t *driver_ppt = smu->smu_table.driver_pptable;struct smu_11_0_dpm_table *dpm_table;int ret =0 ; -int i;/* socclk dpm table setup */ dpm_table = &dpm_context->dpm_tables.soc_table;@@ -857,12 +856,6 @@ static int navi10_set_default_dpm_table(struct smu_context *smu) dpm_table->max = dpm_table->dpm_levels[0 ].value; } -/* lclk dpm table setup */ -for (i =0 ; i <MAX_PCIE_CONF ; i++) { - dpm_context->dpm_tables.pcie_table.pcie_gen[i] = driver_ppt->PcieGenSpeed[i]; - dpm_context->dpm_tables.pcie_table.pcie_lane[i] = driver_ppt->PcieLaneCount[i]; - } -return 0 ; }@@ -1936,12 +1929,16 @@ static int navi10_update_pcie_parameters(struct smu_context *smu, uint32_t pcie_gen_cap, uint32_t pcie_width_cap) { +struct smu_11_0_dpm_context *dpm_context = smu->smu_dpm.dpm_context;PPTable_t *pptable = smu->smu_table.driver_pptable; -int ret, i;uint32_t smu_pcie_arg; +int ret, i; -struct smu_dpm_context *smu_dpm = &smu->smu_dpm; -struct smu_11_0_dpm_context *dpm_context = smu_dpm->dpm_context; +/* lclk dpm table setup */ +for (i =0 ; i <MAX_PCIE_CONF ; i++) { + dpm_context->dpm_tables.pcie_table.pcie_gen[i] = pptable->PcieGenSpeed[i]; + dpm_context->dpm_tables.pcie_table.pcie_lane[i] = pptable->PcieLaneCount[i]; + }for (i =0 ; i <NUM_LINK_LEVELS ; i++) { smu_pcie_arg = (i << 16) |drivers/gpu/drm/amd/powerplay/sienna_cichlid_ppt.c +7
-11@@ -601,7 +601,6 @@ static int sienna_cichlid_set_default_dpm_table(struct smu_context *smu)PPTable_t *driver_ppt = smu->smu_table.driver_pptable;struct smu_11_0_dpm_table *dpm_table;int ret =0 ; -int i;/* socclk dpm table setup */ dpm_table = &dpm_context->dpm_tables.soc_table;@@ -819,12 +818,6 @@ static int sienna_cichlid_set_default_dpm_table(struct smu_context *smu) dpm_table->max = dpm_table->dpm_levels[0 ].value; } -/* lclk dpm table setup */ -for (i =0 ; i <MAX_PCIE_CONF ; i++) { - dpm_context->dpm_tables.pcie_table.pcie_gen[i] = driver_ppt->PcieGenSpeed[i]; - dpm_context->dpm_tables.pcie_table.pcie_lane[i] = driver_ppt->PcieLaneCount[i]; - } -return 0 ; }@@ -1722,12 +1715,16 @@ static int sienna_cichlid_update_pcie_parameters(struct smu_context *smu, uint32_t pcie_gen_cap, uint32_t pcie_width_cap) { +struct smu_11_0_dpm_context *dpm_context = smu->smu_dpm.dpm_context;PPTable_t *pptable = smu->smu_table.driver_pptable; -int ret, i;uint32_t smu_pcie_arg; +int ret, i; -struct smu_dpm_context *smu_dpm = &smu->smu_dpm; -struct smu_11_0_dpm_context *dpm_context = smu_dpm->dpm_context; +/* lclk dpm table setup */ +for (i =0 ; i <MAX_PCIE_CONF ; i++) { + dpm_context->dpm_tables.pcie_table.pcie_gen[i] = pptable->PcieGenSpeed[i]; + dpm_context->dpm_tables.pcie_table.pcie_lane[i] = pptable->PcieLaneCount[i]; + }for (i =0 ; i <NUM_LINK_LEVELS ; i++) { smu_pcie_arg = (i << 16) | --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