if any DPM feature is enabled, then DPM is running, return true.
if all DPM feature is disabled, the DPM is not running, return false.
so the macro of  "SMC_DPM_FEATURE" should be include all dpm feature, whether 
is enabled or supported.
i think the @Gui, Jack<mailto:[email protected]>'s patch is right.

Best Regards,
Kevin

________________________________
From: amd-gfx <[email protected]> on behalf of Quan, Evan 
<[email protected]>
Sent: Monday, August 12, 2019 5:38 PM
To: Gui, Jack <[email protected]>; [email protected] 
<[email protected]>
Cc: Gui, Jack <[email protected]>
Subject: RE: [PATCH 2/2] drm/amd/powerplay: add arcturus_is_dpm_running 
function for arcturus

Please set FEATURE_DPM_PREFETCHER_MASK | FEATURE_DPM_GFXCLK_MASK only. For now, 
only these two are enabled on arcturus.

With that fixed, the patch is reviewed-by: Evan Quan <[email protected]>
> -----Original Message-----
> From: amd-gfx <[email protected]> On Behalf Of
> Chengming Gui
> Sent: Monday, August 12, 2019 4:22 PM
> To: [email protected]
> Cc: Gui, Jack <[email protected]>
> Subject: [PATCH 2/2] drm/amd/powerplay: add arcturus_is_dpm_running
> function for arcturus
>
> add arcturus_is_dpm_running function
>
> Signed-off-by: Chengming Gui <[email protected]>
> ---
>  drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 21
> +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
> b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
> index 03ce871..9107beb 100644
> --- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
> +++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
> @@ -51,6 +51,15 @@
>  #define SMU_FEATURES_HIGH_MASK       0xFFFFFFFF00000000
>  #define SMU_FEATURES_HIGH_SHIFT      32
>
> +#define SMC_DPM_FEATURE ( \
> +     FEATURE_DPM_PREFETCHER_MASK | \
> +     FEATURE_DPM_GFXCLK_MASK | \
> +     FEATURE_DPM_UCLK_MASK | \
> +     FEATURE_DPM_SOCCLK_MASK | \
> +     FEATURE_DPM_MP0CLK_MASK | \
> +     FEATURE_DPM_FCLK_MASK | \
> +     FEATURE_DPM_XGMI_MASK)
> +
>  /* possible frequency drift (1Mhz) */
>  #define EPSILON                              1
>
> @@ -1873,6 +1882,17 @@ static void arcturus_dump_pptable(struct
> smu_context *smu)
>
>  }
>
> +static bool arcturus_is_dpm_running(struct smu_context *smu) {
> +     int ret = 0;
> +     uint32_t feature_mask[2];
> +     unsigned long feature_enabled;
> +     ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);
> +     feature_enabled = (unsigned long)((uint64_t)feature_mask[0] |
> +                        ((uint64_t)feature_mask[1] << 32));
> +     return !!(feature_enabled & SMC_DPM_FEATURE); }
> +
>  static const struct pptable_funcs arcturus_ppt_funcs = {
>        /* translate smu index into arcturus specific index */
>        .get_smu_msg_index = arcturus_get_smu_msg_index, @@ -1910,6
> +1930,7 @@ static const struct pptable_funcs arcturus_ppt_funcs = {
>        /* debug (internal used) */
>        .dump_pptable = arcturus_dump_pptable,
>        .get_power_limit = arcturus_get_power_limit,
> +     .is_dpm_running = arcturus_is_dpm_running,
>  };
>
>  void arcturus_set_ppt_funcs(struct smu_context *smu)
> --
> 2.7.4
>
> _______________________________________________
> amd-gfx mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to