[PATCH v3] drm/amdgpu/pm: Add notification for no DC support

Deucher, Alexander Alexander.Deucher at amd.com
Wed Aug 16 18:11:05 UTC 2023


[AMD Official Use Only - General]

> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of Bokun
> Zhang
> Sent: Wednesday, August 16, 2023 2:07 PM
> To: amd-gfx at lists.freedesktop.org
> Cc: Zhang, Bokun <Bokun.Zhang at amd.com>; Quan, Evan
> <Evan.Quan at amd.com>
> Subject: [PATCH v3] drm/amdgpu/pm: Add notification for no DC support
>
> - There is a DPM issue where if DC is not present,
>   FCLK will stay at low level.
>   We need to send a SMU message to configure the DPM
>
> - Reuse smu_v13_0_notify_display_change() for this purpose
>
> Reviewed-by: Evan Quan <evan.quan at amd.com>
> Signed-off-by: Bokun Zhang <bokun.zhang at amd.com>
> ---
>  drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h          |  5 +----
>  .../drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h   |  5 ++++-
>  drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h           |  3 ++-
>  drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c         | 10 ++++------
>  drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c   |  2 ++
>  5 files changed, 13 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h
> b/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h
> index 6e2069dcb6b9..a719ad9f7bd0 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h
> +++ b/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h
> @@ -1043,10 +1043,7 @@ struct pptable_funcs {
>                                                  enum smu_feature_mask
> mask);
>
>       /**
> -      * @notify_display_change: Enable fast memory clock switching.
> -      *
> -      * Allows for fine grained memory clock switching but has more
> stringent
> -      * timing requirements.
> +      * @notify_display_change: General interface call to let SMU know
> +about DC change
>        */
>       int (*notify_display_change)(struct smu_context *smu);
>
> diff --git
> a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h
> b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h
> index 10cff75b44d5..e2ee855c7748 100644
> ---
> a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h
> +++
> b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h
> @@ -138,7 +138,10 @@
>  #define PPSMC_MSG_SetBadMemoryPagesRetiredFlagsPerChannel 0x4A
>  #define PPSMC_MSG_SetPriorityDeltaGain           0x4B
>  #define PPSMC_MSG_AllowIHHostInterrupt           0x4C
> -#define PPSMC_Message_Count                      0x4D
> +
> +#define PPSMC_MSG_DALNotPresent                  0x4E
> +
> +#define PPSMC_Message_Count                      0x4F
>
>  //Debug Dump Message
>  #define DEBUGSMC_MSG_TestMessage                    0x1
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h
> b/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h
> index 297b70b9388f..f71fc99447f2 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h
> +++ b/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h
> @@ -245,7 +245,8 @@
>       __SMU_DUMMY_MAP(AllowGpo),      \
>       __SMU_DUMMY_MAP(Mode2Reset),    \
>       __SMU_DUMMY_MAP(RequestI2cTransaction), \
> -     __SMU_DUMMY_MAP(GetMetricsTable),
> +     __SMU_DUMMY_MAP(GetMetricsTable), \
> +     __SMU_DUMMY_MAP(DALNotPresent),
>
>  #undef __SMU_DUMMY_MAP
>  #define __SMU_DUMMY_MAP(type)        SMU_MSG_##type
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
> b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
> index 895cda8e6934..4b8842fc9574 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
> @@ -838,12 +838,10 @@ int smu_v13_0_notify_display_change(struct
> smu_context *smu)  {
>       int ret = 0;
>
> -     if (!smu->pm_enabled)
> -             return ret;
> -
> -     if (smu_cmn_feature_is_enabled(smu,
> SMU_FEATURE_DPM_UCLK_BIT) &&
> -         smu->adev->gmc.vram_type == AMDGPU_VRAM_TYPE_HBM)
> -             ret = smu_cmn_send_smc_msg_with_param(smu,
> SMU_MSG_SetUclkFastSwitch, 1, NULL);
> +     if (!amdgpu_device_has_dc_support(smu->adev))
> +     {

Kernel coding style checkers will complain about this.  Please move the { onto the same line as the if statement or you can drop them altogether since it's only a single line.  With that fixed:
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>


> +             ret = smu_cmn_send_smc_msg(smu,
> SMU_MSG_DALNotPresent, NULL);
> +     }
>
>       return ret;
>  }
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
> b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
> index 48b03524a52d..d75f500b50ee 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
> @@ -160,6 +160,7 @@ static struct cmn2asic_msg_mapping
> smu_v13_0_0_message_map[SMU_MSG_MAX_COUNT] =
>       MSG_MAP(AllowGpo,                       PPSMC_MSG_SetGpoAllow,
> 0),
>       MSG_MAP(AllowIHHostInterrupt,
>       PPSMC_MSG_AllowIHHostInterrupt,       0),
>       MSG_MAP(ReenableAcDcInterrupt,
>       PPSMC_MSG_ReenableAcDcInterrupt,       0),
> +     MSG_MAP(DALNotPresent,
>       PPSMC_MSG_DALNotPresent,       0),
>  };
>
>  static struct cmn2asic_mapping smu_v13_0_0_clk_map[SMU_CLK_COUNT] =
> { @@ -2680,6 +2681,7 @@ static const struct pptable_funcs
> smu_v13_0_0_ppt_funcs = {
>       .send_hbm_bad_channel_flag =
> smu_v13_0_0_send_bad_mem_channel_flag,
>       .gpo_control = smu_v13_0_gpo_control,
>       .get_ecc_info = smu_v13_0_0_get_ecc_info,
> +     .notify_display_change = smu_v13_0_notify_display_change,
>  };
>
>  void smu_v13_0_0_set_ppt_funcs(struct smu_context *smu)
> --
> 2.25.1



More information about the amd-gfx mailing list