On 11/19/2024 12:06 PM, Kenneth Feng wrote:
> disable pcie speed switching on Intel platform for smu v14.0.2/3
> based on Intel's requirement.
> v2: align the setting with smu v13.
> 
> Signed-off-by: Kenneth Feng <kenneth.f...@amd.com>

Need to revisit later for keeping common logic at one place.

Reviewed-by: Lijo Lazar <lijo.la...@amd.com>

Thanks,
Lijo
> ---
>  .../drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c  | 26 ++++++++++++++++---
>  1 file changed, 23 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c 
> b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
> index 59b369eff30f..342eabd08f0d 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
> @@ -1463,15 +1463,35 @@ static int smu_v14_0_2_update_pcie_parameters(struct 
> smu_context *smu,
>       struct smu_14_0_dpm_context *dpm_context = smu->smu_dpm.dpm_context;
>       struct smu_14_0_pcie_table *pcie_table =
>                               &dpm_context->dpm_tables.pcie_table;
> +     int num_of_levels = pcie_table->num_of_link_levels;
>       uint32_t smu_pcie_arg;
>       int ret, i;
>  
> -     for (i = 0; i < pcie_table->num_of_link_levels; i++) {
> -             if (pcie_table->pcie_gen[i] > pcie_gen_cap)
> +     if (!num_of_levels)
> +             return 0;
> +
> +     if (!(smu->adev->pm.pp_feature & PP_PCIE_DPM_MASK)) {
> +             if (pcie_table->pcie_gen[num_of_levels - 1] < pcie_gen_cap)
> +                     pcie_gen_cap = pcie_table->pcie_gen[num_of_levels - 1];
> +
> +             if (pcie_table->pcie_lane[num_of_levels - 1] < pcie_width_cap)
> +                     pcie_width_cap = pcie_table->pcie_lane[num_of_levels - 
> 1];
> +
> +             /* Force all levels to use the same settings */
> +             for (i = 0; i < num_of_levels; i++) {
>                       pcie_table->pcie_gen[i] = pcie_gen_cap;
> -             if (pcie_table->pcie_lane[i] > pcie_width_cap)
>                       pcie_table->pcie_lane[i] = pcie_width_cap;
> +             }
> +     } else {
> +             for (i = 0; i < num_of_levels; i++) {
> +                     if (pcie_table->pcie_gen[i] > pcie_gen_cap)
> +                             pcie_table->pcie_gen[i] = pcie_gen_cap;
> +                     if (pcie_table->pcie_lane[i] > pcie_width_cap)
> +                             pcie_table->pcie_lane[i] = pcie_width_cap;
> +             }
> +     }
>  
> +     for (i = 0; i < num_of_levels; i++) {
>               smu_pcie_arg = i << 16;
>               smu_pcie_arg |= pcie_table->pcie_gen[i] << 8;
>               smu_pcie_arg |= pcie_table->pcie_lane[i];

Reply via email to