> -----Original Message-----
> From: amd-gfx <amd-gfx-boun...@lists.freedesktop.org> On Behalf Of Evan
> Quan
> Sent: Monday, September 17, 2018 3:14 AM
> To: amd-gfx@lists.freedesktop.org
> Cc: Quan, Evan <evan.q...@amd.com>
> Subject: [PATCH 1/3] drm/amd/powerplay: update OD feature judgement
> 
> Update the conditions to judge whether an OD feature should be supported
> on vega20.
> 
> Change-Id: Iaabdd4db8f685fb94c960263fe38a21b36377aa2
> Signed-off-by: Evan Quan <evan.q...@amd.com>

Series is:
Acked-by: Alex Deucher <alexander.deuc...@amd.com>

> ---
>  .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c    | 81 +++++++++++++---
> ---
>  .../drm/amd/powerplay/hwmgr/vega20_pptable.h  |  2 +
>  2 files changed, 57 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
> b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
> index ce123096c365..6295244a1737 100644
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
> @@ -47,6 +47,8 @@
>  #include "pp_overdriver.h"
>  #include "pp_thermal.h"
> 
> +#define VOLTAGE_SCALE 4
> +
>  static void vega20_set_default_registry_data(struct pp_hwmgr *hwmgr)  {
>       struct vega20_hwmgr *data =
> @@ -832,58 +834,85 @@ static int vega20_od8_set_feature_capabilities(
>       struct phm_ppt_v3_information *pptable_information =
>               (struct phm_ppt_v3_information *)hwmgr->pptable;
>       struct vega20_hwmgr *data = (struct vega20_hwmgr *)(hwmgr-
> >backend);
> +     PPTable_t *pp_table = &(data->smc_state_table.pp_table);
>       struct vega20_od8_settings *od_settings = &(data->od8_settings);
> 
>       od_settings->overdrive8_capabilities = 0;
> 
>       if (data->smu_features[GNLD_DPM_GFXCLK].enabled) {
> -             if (pptable_information-
> >od_settings_max[ATOM_VEGA20_ODSETTING_GFXCLKFMAX] > 0 &&
> -                 pptable_information-
> >od_settings_min[ATOM_VEGA20_ODSETTING_GFXCLKFMAX] > 0 &&
> -                 pptable_information-
> >od_settings_max[ATOM_VEGA20_ODSETTING_GFXCLKFMIN] > 0 &&
> -                 pptable_information-
> >od_settings_min[ATOM_VEGA20_ODSETTING_GFXCLKFMIN] > 0)
> +             if (pptable_information-
> >od_feature_capabilities[ATOM_VEGA20_ODFEATURE_GFXCLK_LIMITS] &&
> +                 pptable_information-
> >od_settings_max[OD8_SETTING_GFXCLK_FMAX] > 0 &&
> +                 pptable_information-
> >od_settings_min[OD8_SETTING_GFXCLK_FMIN] > 0 &&
> +                 (pptable_information-
> >od_settings_max[OD8_SETTING_GFXCLK_FMAX] >=
> +                 pptable_information-
> >od_settings_min[OD8_SETTING_GFXCLK_FMIN]))
>                       od_settings->overdrive8_capabilities |=
> OD8_GFXCLK_LIMITS;
> 
> -             if (pptable_information-
> >od_settings_min[ATOM_VEGA20_ODSETTING_VDDGFXCURVEFREQ_P1] >
> 0 &&
> -                 pptable_information-
> >od_settings_min[ATOM_VEGA20_ODSETTING_VDDGFXCURVEFREQ_P2] >
> 0 &&
> -                 pptable_information-
> >od_settings_min[ATOM_VEGA20_ODSETTING_VDDGFXCURVEFREQ_P3] >
> 0 &&
> -                 pptable_information-
> >od_settings_max[ATOM_VEGA20_ODSETTING_VDDGFXCURVEFREQ_P1] >
> 0 &&
> -                 pptable_information-
> >od_settings_max[ATOM_VEGA20_ODSETTING_VDDGFXCURVEFREQ_P2] >
> 0 &&
> -                 pptable_information-
> >od_settings_max[ATOM_VEGA20_ODSETTING_VDDGFXCURVEFREQ_P3] >
> 0 &&
> -                 pptable_information-
> >od_settings_min[ATOM_VEGA20_ODSETTING_VDDGFXCURVEVOLTAGEOF
> FSET_P1] > 0 &&
> -                 pptable_information-
> >od_settings_min[ATOM_VEGA20_ODSETTING_VDDGFXCURVEVOLTAGEOF
> FSET_P2] > 0 &&
> -                 pptable_information-
> >od_settings_min[ATOM_VEGA20_ODSETTING_VDDGFXCURVEVOLTAGEOF
> FSET_P3] > 0 &&
> -                 pptable_information-
> >od_settings_max[ATOM_VEGA20_ODSETTING_VDDGFXCURVEVOLTAGEO
> FFSET_P1] > 0 &&
> -                 pptable_information-
> >od_settings_max[ATOM_VEGA20_ODSETTING_VDDGFXCURVEVOLTAGEO
> FFSET_P2] > 0 &&
> -                 pptable_information-
> >od_settings_max[ATOM_VEGA20_ODSETTING_VDDGFXCURVEVOLTAGEO
> FFSET_P3] > 0)
> +             if (pptable_information-
> >od_feature_capabilities[ATOM_VEGA20_ODFEATURE_GFXCLK_CURVE] &&
> +                 (pptable_information-
> >od_settings_min[OD8_SETTING_GFXCLK_VOLTAGE1] >=
> +                  pp_table->MinVoltageGfx / VOLTAGE_SCALE) &&
> +                 (pptable_information-
> >od_settings_max[OD8_SETTING_GFXCLK_VOLTAGE3] <=
> +                  pp_table->MaxVoltageGfx / VOLTAGE_SCALE) &&
> +                 (pptable_information-
> >od_settings_max[OD8_SETTING_GFXCLK_VOLTAGE3] >=
> +
> +pptable_information-
> >od_settings_min[OD8_SETTING_GFXCLK_VOLTAGE1]))
>                       od_settings->overdrive8_capabilities |=
> OD8_GFXCLK_CURVE;
>       }
> 
>       if (data->smu_features[GNLD_DPM_UCLK].enabled) {
> -             if (pptable_information-
> >od_settings_min[ATOM_VEGA20_ODSETTING_UCLKFMAX] > 0 &&
> -                 pptable_information-
> >od_settings_max[ATOM_VEGA20_ODSETTING_UCLKFMAX] > 0)
> +             if (pptable_information-
> >od_feature_capabilities[ATOM_VEGA20_ODFEATURE_UCLK_MAX] &&
> +                 pptable_information-
> >od_settings_min[OD8_SETTING_UCLK_FMAX] > 0 &&
> +                 pptable_information-
> >od_settings_max[OD8_SETTING_UCLK_FMAX] > 0 &&
> +                 (pptable_information-
> >od_settings_max[OD8_SETTING_UCLK_FMAX] >=
> +                 pptable_information-
> >od_settings_min[OD8_SETTING_UCLK_FMAX]))
>                       od_settings->overdrive8_capabilities |=
> OD8_UCLK_MAX;
>       }
> 
> -     if (pptable_information-
> >od_settings_max[ATOM_VEGA20_ODSETTING_POWERPERCENTAGE] > 0
> &&
> -         pptable_information-
> >od_settings_max[ATOM_VEGA20_ODSETTING_POWERPERCENTAGE] <=
> 100)
> +     if (pptable_information-
> >od_feature_capabilities[ATOM_VEGA20_ODFEATURE_POWER_LIMIT] &&
> +         pptable_information-
> >od_settings_max[OD8_SETTING_POWER_PERCENTAGE] > 0 &&
> +         pptable_information-
> >od_settings_max[OD8_SETTING_POWER_PERCENTAGE] <= 100 &&
> +         pptable_information-
> >od_settings_min[OD8_SETTING_POWER_PERCENTAGE] > 0 &&
> +         pptable_information-
> >od_settings_min[OD8_SETTING_POWER_PERCENTAGE]
> +<= 100)
>               od_settings->overdrive8_capabilities |= OD8_POWER_LIMIT;
> 
>       if (data->smu_features[GNLD_FAN_CONTROL].enabled) {
> -             if (pptable_information-
> >od_settings_max[ATOM_VEGA20_ODSETTING_FANRPMMIN] > 0)
> -                     od_settings->overdrive8_capabilities |=
> OD8_FAN_SPEED_MIN;
> -
> -             if (pptable_information-
> >od_settings_max[ATOM_VEGA20_ODSETTING_FANRPMACOUSTICLIMIT] >
> 0)
> +             if (pptable_information-
> >od_feature_capabilities[ATOM_VEGA20_ODFEATURE_FAN_ACOUSTIC_LI
> MIT] &&
> +                 pptable_information-
> >od_settings_min[OD8_SETTING_FAN_ACOUSTIC_LIMIT] > 0 &&
> +                 pptable_information-
> >od_settings_max[OD8_SETTING_FAN_ACOUSTIC_LIMIT] > 0 &&
> +                 (pptable_information-
> >od_settings_max[OD8_SETTING_FAN_ACOUSTIC_LIMIT] >=
> +
> +pptable_information-
> >od_settings_min[OD8_SETTING_FAN_ACOUSTIC_LIMIT]))
>                       od_settings->overdrive8_capabilities |=
> OD8_ACOUSTIC_LIMIT_SCLK;
> +
> +             if (pptable_information-
> >od_feature_capabilities[ATOM_VEGA20_ODFEATURE_FAN_SPEED_MIN]
> &&
> +                 (pptable_information-
> >od_settings_min[OD8_SETTING_FAN_MIN_SPEED] >=
> +                 (pp_table->FanPwmMin * pp_table->FanMaximumRpm /
> 100)) &&
> +                 pptable_information-
> >od_settings_max[OD8_SETTING_FAN_MIN_SPEED] > 0 &&
> +                 (pptable_information-
> >od_settings_max[OD8_SETTING_FAN_MIN_SPEED] >=
> +                  pptable_information-
> >od_settings_min[OD8_SETTING_FAN_MIN_SPEED]))
> +                     od_settings->overdrive8_capabilities |=
> OD8_FAN_SPEED_MIN;
>       }
> 
>       if (data->smu_features[GNLD_THERMAL].enabled) {
> -             if (pptable_information-
> >od_settings_max[ATOM_VEGA20_ODSETTING_FANTARGETTEMPERATURE
> ] > 0)
> +             if (pptable_information-
> >od_feature_capabilities[ATOM_VEGA20_ODFEATURE_TEMPERATURE_FAN
> ] &&
> +                 pptable_information-
> >od_settings_max[OD8_SETTING_FAN_TARGET_TEMP] > 0 &&
> +                 pptable_information-
> >od_settings_min[OD8_SETTING_FAN_TARGET_TEMP] > 0 &&
> +                 (pptable_information-
> >od_settings_max[OD8_SETTING_FAN_TARGET_TEMP] >=
> +
> +pptable_information-
> >od_settings_min[OD8_SETTING_FAN_TARGET_TEMP]))
>                       od_settings->overdrive8_capabilities |=
> OD8_TEMPERATURE_FAN;
> 
> -             if (pptable_information-
> >od_settings_max[ATOM_VEGA20_ODSETTING_OPERATINGTEMPMAX] >
> 0)
> +             if (pptable_information-
> >od_feature_capabilities[ATOM_VEGA20_ODFEATURE_TEMPERATURE_SYS
> TEM] &&
> +                 pptable_information-
> >od_settings_max[OD8_SETTING_OPERATING_TEMP_MAX] > 0 &&
> +                 pptable_information-
> >od_settings_min[OD8_SETTING_OPERATING_TEMP_MAX] > 0 &&
> +                 (pptable_information-
> >od_settings_max[OD8_SETTING_OPERATING_TEMP_MAX] >=
> +
> +pptable_information-
> >od_settings_min[OD8_SETTING_OPERATING_TEMP_MAX]))
>                       od_settings->overdrive8_capabilities |=
> OD8_TEMPERATURE_SYSTEM;
>       }
> 
> +     if (pptable_information-
> >od_feature_capabilities[ATOM_VEGA20_ODFEATURE_MEMORY_TIMING_
> TUNE])
> +             od_settings->overdrive8_capabilities |=
> OD8_MEMORY_TIMING_TUNE;
> +
> +     if (pptable_information-
> >od_feature_capabilities[ATOM_VEGA20_ODFEATURE_FAN_ZERO_RPM_C
> ONTROL] &&
> +         pp_table->FanZeroRpmEnable)
> +             od_settings->overdrive8_capabilities |=
> OD8_FAN_ZERO_RPM_CONTROL;
> +
>       return 0;
>  }
> 
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_pptable.h
> b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_pptable.h
> index b104f6af81a4..2222e29405c6 100644
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_pptable.h
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_pptable.h
> @@ -49,6 +49,8 @@ enum ATOM_VEGA20_ODFEATURE_ID {
>    ATOM_VEGA20_ODFEATURE_FAN_SPEED_MIN,         //FanMinimumPwm
>    ATOM_VEGA20_ODFEATURE_TEMPERATURE_FAN,
> //FanTargetTemperature
>    ATOM_VEGA20_ODFEATURE_TEMPERATURE_SYSTEM,    //MaxOpTemp
> +  ATOM_VEGA20_ODFEATURE_MEMORY_TIMING_TUNE,
> +  ATOM_VEGA20_ODFEATURE_FAN_ZERO_RPM_CONTROL,
>    ATOM_VEGA20_ODFEATURE_COUNT,
>  };
> 
> --
> 2.19.0
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to