<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Hi Alex,</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">The avfs btc state is only used in driver
<font size="2"><span style="font-size:11pt;">and not interact with HW.</span></font></p>
<p style="margin-top:0;margin-bottom:0"><font size="2"><span style="font-size:11pt;"></span></font>and we only need to know whether this feature is supported or not by HW.</p>
<p style="margin-top:0;margin-bottom:0">so delete the complex define of avfs btc state and simplify related code.</p>
<p style="margin-top:0;margin-bottom:0">Please review the attached patch.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Best Regards</p>
<p style="margin-top:0;margin-bottom:0">Rex<br>
</p>
<br>
<div style="color: rgb(0, 0, 0);">
<hr tabindex="-1" style="display:inline-block;width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" color="#000000" face="Calibri, sans-serif"><b>From:</b> Alex Deucher <alexdeucher@gmail.com><br>
<b>Sent:</b> Thursday, March 8, 2018 1:12 AM<br>
<b>To:</b> Zhu, Rex<br>
<b>Cc:</b> amd-gfx list<br>
<b>Subject:</b> Re: [PATCH 1/8] drm/amd/pp: Refine code for smu7 in powerplay</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">On Wed, Mar 7, 2018 at 5:46 AM, Rex Zhu <Rex.Zhu@amd.com> wrote:<br>
> 1. Add avfs_support in hwmgr to avoid to visit smu backend struct in<br>
>    hwmgr.so do not need to include smu7_smumgr.h under hwmgr folder.<br>
> 2. simplify the list of enum AVFS_BTC_STATUS<br>
><br>
> Change-Id: I04c769972deff797229339f3ccb1c442b35768a2<br>
> Signed-off-by: Rex Zhu <Rex.Zhu@amd.com><br>
> ---<br>
>  drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c        | 14 ++------------<br>
>  drivers/gpu/drm/amd/powerplay/inc/hwmgr.h               |  2 +-<br>
>  drivers/gpu/drm/amd/powerplay/inc/smumgr.h              | 10 +---------<br>
>  drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c      |  4 +++-<br>
>  drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c |  4 +++-<br>
>  5 files changed, 10 insertions(+), 24 deletions(-)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c<br>
> index d4d1d2e..da25e7f 100644<br>
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c<br>
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c<br>
> @@ -40,7 +40,6 @@<br>
><br>
>  #include "hwmgr.h"<br>
>  #include "smu7_hwmgr.h"<br>
> -#include "smu7_smumgr.h"<br>
>  #include "smu_ucode_xfer_vi.h"<br>
>  #include "smu7_powertune.h"<br>
>  #include "smu7_dyn_defaults.h"<br>
> @@ -1353,12 +1352,7 @@ static int smu7_enable_dpm_tasks(struct pp_hwmgr *hwmgr)<br>
><br>
>  static int smu7_avfs_control(struct pp_hwmgr *hwmgr, bool enable)<br>
>  {<br>
> -       struct smu7_smumgr *smu_data = (struct smu7_smumgr *)(hwmgr->smu_backend);<br>
> -<br>
> -       if (smu_data == NULL)<br>
> -               return -EINVAL;<br>
> -<br>
> -       if (smu_data->avfs.avfs_btc_status == AVFS_BTC_NOTSUPPORTED)<br>
> +       if (!hwmgr->avfs_supported)<br>
>                 return 0;<br>
><br>
>         if (enable) {<br>
> @@ -1382,13 +1376,9 @@ static int smu7_avfs_control(struct pp_hwmgr *hwmgr, bool enable)<br>
><br>
>  static int smu7_update_avfs(struct pp_hwmgr *hwmgr)<br>
>  {<br>
> -       struct smu7_smumgr *smu_data = (struct smu7_smumgr *)(hwmgr->smu_backend);<br>
>         struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);<br>
><br>
> -       if (smu_data == NULL)<br>
> -               return -EINVAL;<br>
> -<br>
> -       if (smu_data->avfs.avfs_btc_status == AVFS_BTC_NOTSUPPORTED)<br>
> +       if (!hwmgr->avfs_supported)<br>
>                 return 0;<br>
><br>
>         if (data->need_update_smu7_dpm_table & DPMTABLE_OD_UPDATE_VDDC) {<br>
> diff --git a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h<br>
> index b151ad85..312fbc3 100644<br>
> --- a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h<br>
> +++ b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h<br>
> @@ -748,7 +748,7 @@ struct pp_hwmgr {<br>
>         struct pp_power_state    *uvd_ps;<br>
>         struct amd_pp_display_configuration display_config;<br>
>         uint32_t feature_mask;<br>
> -<br>
> +       bool avfs_supported;<br>
>         /* UMD Pstate */<br>
>         bool en_umd_pstate;<br>
>         uint32_t power_profile_mode;<br>
> diff --git a/drivers/gpu/drm/amd/powerplay/inc/smumgr.h b/drivers/gpu/drm/amd/powerplay/inc/smumgr.h<br>
> index 9bba0a0..f0ef02a 100644<br>
> --- a/drivers/gpu/drm/amd/powerplay/inc/smumgr.h<br>
> +++ b/drivers/gpu/drm/amd/powerplay/inc/smumgr.h<br>
> @@ -28,23 +28,15 @@<br>
><br>
>  enum AVFS_BTC_STATUS {<br>
>         AVFS_BTC_BOOT = 0,<br>
> -       AVFS_BTC_BOOT_STARTEDSMU,<br>
>         AVFS_LOAD_VIRUS,<br>
>         AVFS_BTC_VIRUS_LOADED,<br>
>         AVFS_BTC_VIRUS_FAIL,<br>
>         AVFS_BTC_COMPLETED_PREVIOUSLY,<br>
>         AVFS_BTC_ENABLEAVFS,<br>
> -       AVFS_BTC_STARTED,<br>
>         AVFS_BTC_FAILED,<br>
> -       AVFS_BTC_RESTOREVFT_FAILED,<br>
> -       AVFS_BTC_SAVEVFT_FAILED,<br>
>         AVFS_BTC_DPMTABLESETUP_FAILED,<br>
> -       AVFS_BTC_COMPLETED_UNSAVED,<br>
> -       AVFS_BTC_COMPLETED_SAVED,<br>
> -       AVFS_BTC_COMPLETED_RESTORED,<br>
>         AVFS_BTC_DISABLED,<br>
> -       AVFS_BTC_NOTSUPPORTED,<br>
> -       AVFS_BTC_SMUMSG_ERROR<br>
> +       AVFS_BTC_NOTSUPPORTED<br>
>  };<br>
<br>
This isn't used to interact with the hw anywhere is it?  If so, this<br>
will break that.  It should probably be split out as a separate patch<br>
since it's not really directly related to the rest of this patch.<br>
With those addresses this patch is:<br>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com><br>
<br>
><br>
>  enum SMU_TABLE {<br>
> diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c<br>
> index 0b2b5d1..573c9be 100644<br>
> --- a/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c<br>
> +++ b/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c<br>
> @@ -360,8 +360,10 @@ static bool fiji_is_hw_avfs_present(struct pp_hwmgr *hwmgr)<br>
><br>
>         if (!atomctrl_read_efuse(hwmgr->device, AVFS_EN_LSB, AVFS_EN_MSB,<br>
>                         mask, &efuse)) {<br>
> -               if (efuse)<br>
> +               if (efuse) {<br>
> +                       hwmgr->avfs_supported = true;<br>
>                         return true;<br>
> +               }<br>
>         }<br>
>         return false;<br>
>  }<br>
> diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c<br>
> index 632d1ca..1075ec1 100644<br>
> --- a/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c<br>
> +++ b/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c<br>
> @@ -357,8 +357,10 @@ static bool polaris10_is_hw_avfs_present(struct pp_hwmgr *hwmgr)<br>
><br>
>         efuse = cgs_read_ind_register(hwmgr->device, CGS_IND_REG__SMC, ixSMU_EFUSE_0 + (49*4));<br>
>         efuse &= 0x00000001;<br>
> -       if (efuse)<br>
> +       if (efuse) {<br>
> +               hwmgr->avfs_supported = true;<br>
>                 return true;<br>
> +       }<br>
><br>
>         return false;<br>
>  }<br>
> --<br>
> 1.9.1<br>
><br>
> _______________________________________________<br>
> amd-gfx mailing list<br>
> amd-gfx@lists.freedesktop.org<br>
> <a previewremoved="true" id="LPlnk605140" href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">
https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a>
<div style="margin-bottom: 20px; overflow: auto; width: 100%; text-indent: 0px;" id="LPBorder_GT_15205915258620.2686861345053829">
<table role="presentation" style="width: 90%; background-color: rgb(255, 255, 255); position: relative; overflow: auto; padding-top: 20px; padding-bottom: 20px; margin-top: 20px; border-top: 1px dotted rgb(200, 200, 200); border-bottom: 1px dotted rgb(200, 200, 200);" id="LPContainer_15205915258590.9282736731640967" cellspacing="0">
<tbody>
<tr style="border-spacing: 0px;" valign="top">
<td colspan="2" style="vertical-align: top; position: relative; padding: 0px; display: table-cell;" id="TextCell_15205915258600.9720307957613028">
<div id="LPRemovePreviewContainer_15205915258600.5747894184804376"></div>
<div style="top: 0px; color: rgb(0, 120, 215); font-weight: 400; font-size: 21px; font-family: "wf_segoe-ui_light","Segoe UI Light","Segoe WP Light","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; line-height: 21px;" id="LPTitle_15205915258600.6420531425137407">
<a target="_blank" href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx" style="text-decoration: none;" id="LPUrlAnchor_15205915258610.5529589204654419">amd-gfx Info Page - freedesktop.org</a></div>
<div style="margin: 10px 0px 16px; color: rgb(102, 102, 102); font-weight: 400; font-family: "wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size: 14px; line-height: 14px;" id="LPMetadata_15205915258610.39476917506447184">
lists.freedesktop.org</div>
<div style="display: block; color: rgb(102, 102, 102); font-weight: 400; font-family: "wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size: 14px; line-height: 20px; max-height: 100px; overflow: hidden;" id="LPDescription_15205915258620.7443088027813343">
Subscribing to amd-gfx: Subscribe to amd-gfx by filling out the following form. Use of all freedesktop.org lists is subject to our Code of ...</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
</div>
</span></font></div>
</div>
</div>
</body>
</html>