All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Deucher <alexdeucher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Rex Zhu <Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
Cc: amd-gfx list <amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: Re: [PATCH 6/8] drm/amd/pp: Update avfs voltage when set power state
Date: Tue, 16 Jan 2018 12:07:51 -0500	[thread overview]
Message-ID: <CADnq5_PzNsd1ifA0Dug8GzH8SFR_s=egiN6C2jY36er6Ny1yxQ@mail.gmail.com> (raw)
In-Reply-To: <1516104175-27651-6-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org>

On Tue, Jan 16, 2018 at 7:02 AM, Rex Zhu <Rex.Zhu@amd.com> wrote:
> when Over-driver engine clock and voltage were set,
> need to recalculate AVFS voltage on VI asics.
>
> Change-Id: If2a2226d64c0c2aa37c2e84f36b0dad8b7dee25e
> Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
> ---
>  drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   | 80 ++++++++++++++--------
>  drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.h |  1 +
>  2 files changed, 53 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
> index a0007a8..c69749d 100644
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
> @@ -91,7 +91,6 @@ enum DPM_EVENT_SRC {
>         DPM_EVENT_SRC_DIGITAL_OR_EXTERNAL = 4
>  };
>
> -static int smu7_avfs_control(struct pp_hwmgr *hwmgr, bool enable);
>  static const unsigned long PhwVIslands_Magic = (unsigned long)(PHM_VIslands_Magic);
>  static int smu7_force_clock_level(struct pp_hwmgr *hwmgr,
>                 enum pp_clock_type type, uint32_t mask);
> @@ -1351,6 +1350,53 @@ static int smu7_enable_dpm_tasks(struct pp_hwmgr *hwmgr)
>         return 0;
>  }
>
> +static int smu7_avfs_control(struct pp_hwmgr *hwmgr, bool enable)
> +{
> +       struct smu7_smumgr *smu_data = (struct smu7_smumgr *)(hwmgr->smu_backend);
> +
> +       if (smu_data == NULL)
> +               return -EINVAL;
> +
> +       if (smu_data->avfs.avfs_btc_status == AVFS_BTC_NOTSUPPORTED)
> +               return 0;
> +
> +       if (enable) {
> +               if (!PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device,
> +                               CGS_IND_REG__SMC, FEATURE_STATUS, AVS_ON)) {
> +                       PP_ASSERT_WITH_CODE(!smum_send_msg_to_smc(
> +                                       hwmgr, PPSMC_MSG_EnableAvfs),
> +                                       "Failed to enable AVFS!",
> +                                       return -EINVAL);
> +               }
> +       } else if (PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device,
> +                       CGS_IND_REG__SMC, FEATURE_STATUS, AVS_ON)) {
> +               PP_ASSERT_WITH_CODE(!smum_send_msg_to_smc(
> +                               hwmgr, PPSMC_MSG_DisableAvfs),
> +                               "Failed to disable AVFS!",
> +                               return -EINVAL);
> +       }
> +
> +       return 0;
> +}
> +
> +static int smu7_update_avfs(struct pp_hwmgr *hwmgr)
> +{
> +       struct smu7_smumgr *smu_data = (struct smu7_smumgr *)(hwmgr->smu_backend);
> +
> +       if (smu_data == NULL)
> +               return -EINVAL;
> +
> +       if (smu_data->avfs.avfs_btc_status == AVFS_BTC_NOTSUPPORTED)
> +               return 0;
> +
> +       if (smu_data->avfs.brecalculate_avfs) {
> +               smu7_avfs_control(hwmgr, false);
> +               smu7_avfs_control(hwmgr, true);
> +               smu_data->avfs.brecalculate_avfs = true;

do we need to set brecalculate_avfs here?  Won't it effectively be set
permanently at this point?  When does the driver ever set
brecalculate_avfs to false?

Alex

> +       }
> +       return 0;
> +}
> +
>  int smu7_disable_dpm_tasks(struct pp_hwmgr *hwmgr)
>  {
>         int tmp_result, result = 0;
> @@ -3923,6 +3969,11 @@ static int smu7_set_power_state_tasks(struct pp_hwmgr *hwmgr, const void *input)
>                         "Failed to populate and upload SCLK MCLK DPM levels!",
>                         result = tmp_result);
>
> +       tmp_result = smu7_update_avfs(hwmgr);
> +       PP_ASSERT_WITH_CODE((0 == tmp_result),
> +                       "Failed to update avfs voltages!",
> +                       result = tmp_result);
> +
>         tmp_result = smu7_generate_dpm_level_enable_mask(hwmgr, input);
>         PP_ASSERT_WITH_CODE((0 == tmp_result),
>                         "Failed to generate DPM level enabled mask!",
> @@ -4704,33 +4755,6 @@ static int smu7_set_power_profile_state(struct pp_hwmgr *hwmgr,
>         return result;
>  }
>
> -static int smu7_avfs_control(struct pp_hwmgr *hwmgr, bool enable)
> -{
> -       struct smu7_smumgr *smu_data = (struct smu7_smumgr *)(hwmgr->smu_backend);
> -
> -       if (smu_data == NULL)
> -               return -EINVAL;
> -
> -       if (smu_data->avfs.avfs_btc_status == AVFS_BTC_NOTSUPPORTED)
> -               return 0;
> -
> -       if (enable) {
> -               if (!PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device,
> -                               CGS_IND_REG__SMC, FEATURE_STATUS, AVS_ON))
> -                       PP_ASSERT_WITH_CODE(!smum_send_msg_to_smc(
> -                                       hwmgr, PPSMC_MSG_EnableAvfs),
> -                                       "Failed to enable AVFS!",
> -                                       return -EINVAL);
> -       } else if (PHM_READ_VFPF_INDIRECT_FIELD(hwmgr->device,
> -                       CGS_IND_REG__SMC, FEATURE_STATUS, AVS_ON))
> -               PP_ASSERT_WITH_CODE(!smum_send_msg_to_smc(
> -                               hwmgr, PPSMC_MSG_DisableAvfs),
> -                               "Failed to disable AVFS!",
> -                               return -EINVAL);
> -
> -       return 0;
> -}
> -
>  static int smu7_notify_cac_buffer_info(struct pp_hwmgr *hwmgr,
>                                         uint32_t virtual_addr_low,
>                                         uint32_t virtual_addr_hi,
> diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.h b/drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.h
> index c87263b..fd9ed20 100644
> --- a/drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.h
> +++ b/drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.h
> @@ -40,6 +40,7 @@ struct smu7_buffer_entry {
>  struct smu7_avfs {
>         enum AVFS_BTC_STATUS avfs_btc_status;
>         uint32_t           avfs_btc_param;
> +       bool           brecalculate_avfs;
>  };
>
>  struct smu7_smumgr {
> --
> 1.9.1
>
> _______________________________________________
> 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

  parent reply	other threads:[~2018-01-16 17:07 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-16 12:02 [PATCH 1/8] drm/amd/pp: Add a new pp feature mask bit for OD feature Rex Zhu
     [not found] ` <1516104175-27651-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
2018-01-16 12:02   ` [PATCH 2/8] drm/amd/pp: Add and initialize OD_dpm_table for CI/VI Rex Zhu
2018-01-16 12:02   ` [PATCH 3/8] drm/amd/pp: Add OD driver clock/voltage display on smu7 Rex Zhu
     [not found]     ` <1516104175-27651-3-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
2018-01-16 17:14       ` Alex Deucher
2018-01-16 12:02   ` [PATCH 4/8] drm/amd/pp: Add hwmgr interface for edit dpm table Rex Zhu
     [not found]     ` <1516104175-27651-4-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
2018-01-16 17:14       ` Alex Deucher
2018-01-16 12:02   ` [PATCH 5/8] drm/amd/pp: Move DPMTABLE_* definitions to common header file Rex Zhu
     [not found]     ` <1516104175-27651-5-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
2018-01-16 17:15       ` Alex Deucher
2018-01-16 12:02   ` [PATCH 6/8] drm/amd/pp: Update avfs voltage when set power state Rex Zhu
     [not found]     ` <1516104175-27651-6-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
2018-01-16 17:07       ` Alex Deucher [this message]
2018-01-16 12:02   ` [PATCH 7/8] drm/amd/pp: Implement edit_dpm_table on smu7 Rex Zhu
     [not found]     ` <1516104175-27651-7-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
2018-01-16 17:02       ` Alex Deucher
2018-01-16 12:02   ` [PATCH 8/8] drm/amd/pp: Add edit/show OD clock/voltage support in sysfs Rex Zhu
     [not found]     ` <1516104175-27651-8-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
2018-01-16 17:17       ` Alex Deucher
2018-01-16 17:12   ` [PATCH 1/8] drm/amd/pp: Add a new pp feature mask bit for OD feature Alex Deucher
     [not found]     ` <CADnq5_N7pNmp8RaRGeRAcEsko1HGkLWSKq42o+m3JJBf9v6Vpg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-17  4:47       ` Zhu, Rex
2018-01-16 17:53   ` Grazvydas Ignotas
     [not found]     ` <CANOLnOOmS-uUXg=KdstpXw4ok8cMEQHo1JwLD9LDDfu7+X878w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-17  5:18       ` Zhu, Rex

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADnq5_PzNsd1ifA0Dug8GzH8SFR_s=egiN6C2jY36er6Ny1yxQ@mail.gmail.com' \
    --to=alexdeucher-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=Rex.Zhu-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.