[PATCH] drm/amd/pm: Fix esm reg mask use to get pcie speed

Ma, Le Le.Ma at amd.com
Wed Feb 28 09:22:54 UTC 2024


[AMD Official Use Only - General]

Reviewed-by: Le Ma <le.ma at amd.com>

> -----Original Message-----
> From: Kamal, Asad <Asad.Kamal at amd.com>
> Sent: Wednesday, February 28, 2024 2:52 PM
> To: amd-gfx at lists.freedesktop.org
> Cc: Lazar, Lijo <Lijo.Lazar at amd.com>; Zhang, Hawking
> <Hawking.Zhang at amd.com>; Ma, Le <Le.Ma at amd.com>; Zhang, Morris
> <Shiwu.Zhang at amd.com>; Kamal, Asad <Asad.Kamal at amd.com>
> Subject: [PATCH] drm/amd/pm: Fix esm reg mask use to get pcie speed
>
> Fix mask used for esm ctrl register to get pcie link speed on smu_v11_0_3,
> smu_v13_0_2 & smu_v13_0_6
>
> Fixes: 511a95552ec8 ("drm/amd/pm: Add SMU 13.0.6 support")
> Fixes: c05d1c401572 ("drm/amd/swsmu: add aldebaran smu13 ip support (v3)")
> Fixes: f1c378593153 ("drm/amd/powerplay: add Arcturus support for gpu
> metrics export")
> Signed-off-by: Asad Kamal <asad.kamal at amd.com>
> Reviewed-by: Lijo Lazar <lijo.lazar at amd.com>
> ---
>  drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c    | 4 ++--
>  drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c   | 4 ++--
>  drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 4 ++--
>  3 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c
> b/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c
> index bcad42534da4..1d96eb274d72 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c
> @@ -2272,8 +2272,8 @@ static uint16_t
> arcturus_get_current_pcie_link_speed(struct smu_context *smu)
>
>       /* TODO: confirm this on real target */
>       esm_ctrl = RREG32_PCIE(smnPCIE_ESM_CTRL);
> -     if ((esm_ctrl >> 15) & 0x1FFFF)
> -             return (uint16_t)(((esm_ctrl >> 8) & 0x3F) + 128);
> +     if ((esm_ctrl >> 15) & 0x1)
> +             return (uint16_t)(((esm_ctrl >> 8) & 0x7F) + 128);
>
>       return smu_v11_0_get_current_pcie_link_speed(smu);
>  }
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
> b/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
> index f122ef49106c..0467864a1aa8 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
> @@ -1683,8 +1683,8 @@ static int
> aldebaran_get_current_pcie_link_speed(struct smu_context *smu)
>
>       /* TODO: confirm this on real target */
>       esm_ctrl = RREG32_PCIE(smnPCIE_ESM_CTRL);
> -     if ((esm_ctrl >> 15) & 0x1FFFF)
> -             return (((esm_ctrl >> 8) & 0x3F) + 128);
> +     if ((esm_ctrl >> 15) & 0x1)
> +             return (((esm_ctrl >> 8) & 0x7F) + 128);
>
>       return smu_v13_0_get_current_pcie_link_speed(smu);
>  }
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
> b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
> index 69c64bc6e2dc..744c84f3029f 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
> @@ -2148,8 +2148,8 @@ static int
> smu_v13_0_6_get_current_pcie_link_speed(struct smu_context *smu)
>
>       /* TODO: confirm this on real target */
>       esm_ctrl = RREG32_PCIE(smnPCIE_ESM_CTRL);
> -     if ((esm_ctrl >> 15) & 0x1FFFF)
> -             return (((esm_ctrl >> 8) & 0x3F) + 128);
> +     if ((esm_ctrl >> 15) & 0x1)
> +             return (((esm_ctrl >> 8) & 0x7F) + 128);
>
>       speed_level = (RREG32_PCIE(smnPCIE_LC_SPEED_CNTL) &
>               PCIE_LC_SPEED_CNTL__LC_CURRENT_DATA_RATE_MASK)
> --
> 2.42.0



More information about the amd-gfx mailing list