[PATCH v2] drm/amdgpu/pm: drop pp_power_profile_mode support for yellow carp

Alex Deucher alexdeucher at gmail.com
Fri Oct 29 20:57:41 UTC 2021


On Fri, Oct 29, 2021 at 11:34 AM Mario Limonciello
<mario.limonciello at amd.com> wrote:
>
> This was added by commit bd8dcea93a7d ("drm/amd/pm: add callbacks to
> read/write sysfs file pp_power_profile_mode") but the feature was
> deprecated from PMFW.  Remove it from the driver.
>
> Signed-off-by: Mario Limonciello <mario.limonciello at amd.com>

Probably want something like the following too:
diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c
b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
index c255b4b8e685..c1b8ed9f7ba8 100644
--- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
@@ -2092,6 +2092,9 @@ static int default_attr_update(struct
amdgpu_device *adev, struct amdgpu_device_
        } else if (DEVICE_ATTR_IS(pp_dpm_dclk)) {
                if (!(asic_type == CHIP_VANGOGH || asic_type ==
CHIP_SIENNA_CICHLID))
                        *states = ATTR_STATE_UNSUPPORTED;
+       } else if (DEVICE_ATTR_IS(pp_power_profile_mode)) {
+               if (asic_type == CHIP_YELLOW_CARP)
+                       *states = ATTR_STATE_UNSUPPORTED;
        }

        switch (asic_type) {

So we don't expose the sysfs knob on the YC, but that can be a follow
up patch if you want.

Acked-by: Alex Deucher <alexander.deucher at amd.com>

> ---
> Changes from v1->v2:
>  * Drop changes to RN and VGH as the deprecation is only in YC.
>  * Leave PPSMC_MSG_ActiveProcessNotify message but mark deprecated
>  * Rename PPSMC_MSG_SPARE0 to align to the name used by PMFW (PPSMC_MSG_SPARE)
>
>  .../gpu/drm/amd/pm/inc/smu_v13_0_1_ppsmc.h    |  4 +-
>  .../drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c  | 87 -------------------
>  2 files changed, 2 insertions(+), 89 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/inc/smu_v13_0_1_ppsmc.h b/drivers/gpu/drm/amd/pm/inc/smu_v13_0_1_ppsmc.h
> index 1d3447991d0c..fc9198846e70 100644
> --- a/drivers/gpu/drm/amd/pm/inc/smu_v13_0_1_ppsmc.h
> +++ b/drivers/gpu/drm/amd/pm/inc/smu_v13_0_1_ppsmc.h
> @@ -51,7 +51,7 @@
>  #define PPSMC_MSG_PowerUpVcn                    0x07 ///< Power up VCN; VCN is power gated by default
>  #define PPSMC_MSG_SetHardMinVcn                 0x08 ///< For wireless display
>  #define PPSMC_MSG_SetSoftMinGfxclk              0x09 ///< Set SoftMin for GFXCLK, argument is frequency in MHz
> -#define PPSMC_MSG_ActiveProcessNotify           0x0A ///< Set active work load type
> +#define PPSMC_MSG_ActiveProcessNotify           0x0A ///< Deprecated (Not to be used)
>  #define PPSMC_MSG_ForcePowerDownGfx             0x0B ///< Force power down GFX, i.e. enter GFXOFF
>  #define PPSMC_MSG_PrepareMp1ForUnload           0x0C ///< Prepare PMFW for GFX driver unload
>  #define PPSMC_MSG_SetDriverDramAddrHigh         0x0D ///< Set high 32 bits of DRAM address for Driver table transfer
> @@ -63,7 +63,7 @@
>  #define PPSMC_MSG_SetHardMinSocclkByFreq        0x13 ///< Set hard min for SOC CLK
>  #define PPSMC_MSG_SetSoftMinFclk                0x14 ///< Set hard min for FCLK
>  #define PPSMC_MSG_SetSoftMinVcn                 0x15 ///< Set soft min for VCN clocks (VCLK and DCLK)
> -#define PPSMC_MSG_SPARE0                        0x16 ///< Spared
> +#define PPSMC_MSG_SPARE                         0x16 ///< Spare
>  #define PPSMC_MSG_GetGfxclkFrequency            0x17 ///< Get GFX clock frequency
>  #define PPSMC_MSG_GetFclkFrequency              0x18 ///< Get FCLK frequency
>  #define PPSMC_MSG_AllowGfxOff                   0x19 ///< Inform PMFW of allowing GFXOFF entry
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c
> index a403657151ba..8215bbf5ed7c 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c
> @@ -64,7 +64,6 @@ static struct cmn2asic_msg_mapping yellow_carp_message_map[SMU_MSG_MAX_COUNT] =
>         MSG_MAP(PowerDownVcn,                   PPSMC_MSG_PowerDownVcn,                 1),
>         MSG_MAP(PowerUpVcn,                     PPSMC_MSG_PowerUpVcn,                   1),
>         MSG_MAP(SetHardMinVcn,                  PPSMC_MSG_SetHardMinVcn,                1),
> -       MSG_MAP(ActiveProcessNotify,            PPSMC_MSG_ActiveProcessNotify,          1),
>         MSG_MAP(PrepareMp1ForUnload,            PPSMC_MSG_PrepareMp1ForUnload,      1),
>         MSG_MAP(SetDriverDramAddrHigh,          PPSMC_MSG_SetDriverDramAddrHigh,        1),
>         MSG_MAP(SetDriverDramAddrLow,           PPSMC_MSG_SetDriverDramAddrLow,         1),
> @@ -135,14 +134,6 @@ static struct cmn2asic_mapping yellow_carp_table_map[SMU_TABLE_COUNT] = {
>         TAB_MAP_VALID(CUSTOM_DPM),
>         TAB_MAP_VALID(DPMCLOCKS),
>  };
> -
> -static struct cmn2asic_mapping yellow_carp_workload_map[PP_SMC_POWER_PROFILE_COUNT] = {
> -       WORKLOAD_MAP(PP_SMC_POWER_PROFILE_FULLSCREEN3D,         WORKLOAD_PPLIB_FULL_SCREEN_3D_BIT),
> -       WORKLOAD_MAP(PP_SMC_POWER_PROFILE_VIDEO,                WORKLOAD_PPLIB_VIDEO_BIT),
> -       WORKLOAD_MAP(PP_SMC_POWER_PROFILE_VR,                   WORKLOAD_PPLIB_VR_BIT),
> -       WORKLOAD_MAP(PP_SMC_POWER_PROFILE_COMPUTE,              WORKLOAD_PPLIB_COMPUTE_BIT),
> -       WORKLOAD_MAP(PP_SMC_POWER_PROFILE_CUSTOM,               WORKLOAD_PPLIB_CUSTOM_BIT),
> -};
>
>  static int yellow_carp_init_smc_tables(struct smu_context *smu)
>  {
> @@ -543,81 +534,6 @@ static int yellow_carp_set_watermarks_table(struct smu_context *smu,
>         return 0;
>  }
>
> -static int yellow_carp_get_power_profile_mode(struct smu_context *smu,
> -                                               char *buf)
> -{
> -       static const char *profile_name[] = {
> -                                       "BOOTUP_DEFAULT",
> -                                       "3D_FULL_SCREEN",
> -                                       "POWER_SAVING",
> -                                       "VIDEO",
> -                                       "VR",
> -                                       "COMPUTE",
> -                                       "CUSTOM"};
> -       uint32_t i, size = 0;
> -       int16_t workload_type = 0;
> -
> -       if (!buf)
> -               return -EINVAL;
> -
> -       for (i = 0; i <= PP_SMC_POWER_PROFILE_CUSTOM; i++) {
> -               /*
> -                * Conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT.
> -                * Not all profile modes are supported on yellow carp.
> -                */
> -               workload_type = smu_cmn_to_asic_specific_index(smu,
> -                                                              CMN2ASIC_MAPPING_WORKLOAD,
> -                                                              i);
> -
> -               if (workload_type < 0)
> -                       continue;
> -
> -               size += sysfs_emit_at(buf, size, "%2d %14s%s\n",
> -                       i, profile_name[i], (i == smu->power_profile_mode) ? "*" : " ");
> -       }
> -
> -       return size;
> -}
> -
> -static int yellow_carp_set_power_profile_mode(struct smu_context *smu,
> -                                               long *input, uint32_t size)
> -{
> -       int workload_type, ret;
> -       uint32_t profile_mode = input[size];
> -
> -       if (profile_mode > PP_SMC_POWER_PROFILE_CUSTOM) {
> -               dev_err(smu->adev->dev, "Invalid power profile mode %d\n", profile_mode);
> -               return -EINVAL;
> -       }
> -
> -       if (profile_mode == PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT ||
> -                       profile_mode == PP_SMC_POWER_PROFILE_POWERSAVING)
> -               return 0;
> -
> -       /* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */
> -       workload_type = smu_cmn_to_asic_specific_index(smu,
> -                                                      CMN2ASIC_MAPPING_WORKLOAD,
> -                                                      profile_mode);
> -       if (workload_type < 0) {
> -               dev_dbg(smu->adev->dev, "Unsupported power profile mode %d on YELLOWCARP\n",
> -                                       profile_mode);
> -               return -EINVAL;
> -       }
> -
> -       ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_ActiveProcessNotify,
> -                                   1 << workload_type,
> -                                   NULL);
> -       if (ret) {
> -               dev_err_once(smu->adev->dev, "Fail to set workload type %d\n",
> -                                       workload_type);
> -               return ret;
> -       }
> -
> -       smu->power_profile_mode = profile_mode;
> -
> -       return 0;
> -}
> -
>  static ssize_t yellow_carp_get_gpu_metrics(struct smu_context *smu,
>                                                 void **table)
>  {
> @@ -1238,8 +1154,6 @@ static const struct pptable_funcs yellow_carp_ppt_funcs = {
>         .read_sensor = yellow_carp_read_sensor,
>         .is_dpm_running = yellow_carp_is_dpm_running,
>         .set_watermarks_table = yellow_carp_set_watermarks_table,
> -       .get_power_profile_mode = yellow_carp_get_power_profile_mode,
> -       .set_power_profile_mode = yellow_carp_set_power_profile_mode,
>         .get_gpu_metrics = yellow_carp_get_gpu_metrics,
>         .get_enabled_mask = smu_cmn_get_enabled_32_bits_mask,
>         .get_pp_feature_mask = smu_cmn_get_pp_feature_mask,
> @@ -1261,6 +1175,5 @@ void yellow_carp_set_ppt_funcs(struct smu_context *smu)
>         smu->message_map = yellow_carp_message_map;
>         smu->feature_map = yellow_carp_feature_mask_map;
>         smu->table_map = yellow_carp_table_map;
> -       smu->workload_map = yellow_carp_workload_map;
>         smu->is_apu = true;
>  }
>
> base-commit: b785098f70a5ed2488becbdd5921054053034439
> --
> 2.25.1
>


More information about the amd-gfx mailing list