<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 style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
i will addressed it before submit patch.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
thanks.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Best Regards,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Kevin</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Quan, Evan <Evan.Quan@amd.com><br>
<b>Sent:</b> Thursday, July 25, 2019 5:29 PM<br>
<b>To:</b> Wang, Kevin(Yang) <Kevin1.Wang@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Deucher, Alexander <Alexander.Deucher@amd.com>; Huang, Ray <Ray.Huang@amd.com>; Feng, Kenneth <Kenneth.Feng@amd.com>; Wang, Kevin(Yang) <Kevin1.Wang@amd.com><br>
<b>Subject:</b> RE: [PATCH 4/5] drm/amd/powerplay: move smu_feature_update_enable_state to up level</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">+ feature_mask = 1UL << feature_id;<br>
Use "ULL" here. That can guard it to be 64bits long even on 32bits target.<br>
With that fixed, reviewed-by: Evan Quan <evan.quan@amd.com><br>
<br>
> -----Original Message-----<br>
> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of<br>
> Wang, Kevin(Yang)<br>
> Sent: Thursday, July 25, 2019 1:11 PM<br>
> To: amd-gfx@lists.freedesktop.org<br>
> Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; Huang, Ray<br>
> <Ray.Huang@amd.com>; Feng, Kenneth <Kenneth.Feng@amd.com>; Wang,<br>
> Kevin(Yang) <Kevin1.Wang@amd.com><br>
> Subject: [PATCH 4/5] drm/amd/powerplay: move<br>
> smu_feature_update_enable_state to up level<br>
> <br>
> this function is not ip or asic related function,<br>
> so move it to top level as public api in smu.<br>
> <br>
> Signed-off-by: Kevin Wang <kevin1.wang@amd.com><br>
> ---<br>
> drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 40<br>
> ++++++++++++++++++-<br>
> .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 4 +-<br>
> drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 39 ------------------<br>
> 3 files changed, 40 insertions(+), 43 deletions(-)<br>
> <br>
> diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c<br>
> b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c<br>
> index 8563f9083f4e..e881de955388 100644<br>
> --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c<br>
> +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c<br>
> @@ -507,6 +507,41 @@ int smu_feature_init_dpm(struct smu_context<br>
> *smu)<br>
> <br>
> return ret;<br>
> }<br>
> +int smu_feature_update_enable_state(struct smu_context *smu, uint64_t<br>
> feature_mask, bool enabled)<br>
> +{<br>
> + uint32_t feature_low = 0, feature_high = 0;<br>
> + int ret = 0;<br>
> +<br>
> + if (!smu->pm_enabled)<br>
> + return ret;<br>
> +<br>
> + feature_low = (feature_mask >> 0 ) & 0xffffffff;<br>
> + feature_high = (feature_mask >> 32) & 0xffffffff;<br>
> +<br>
> + if (enabled) {<br>
> + ret = smu_send_smc_msg_with_param(smu,<br>
> SMU_MSG_EnableSmuFeaturesLow,<br>
> + feature_low);<br>
> + if (ret)<br>
> + return ret;<br>
> + ret = smu_send_smc_msg_with_param(smu,<br>
> SMU_MSG_EnableSmuFeaturesHigh,<br>
> + feature_high);<br>
> + if (ret)<br>
> + return ret;<br>
> +<br>
> + } else {<br>
> + ret = smu_send_smc_msg_with_param(smu,<br>
> SMU_MSG_DisableSmuFeaturesLow,<br>
> + feature_low);<br>
> + if (ret)<br>
> + return ret;<br>
> + ret = smu_send_smc_msg_with_param(smu,<br>
> SMU_MSG_DisableSmuFeaturesHigh,<br>
> + feature_high);<br>
> + if (ret)<br>
> + return ret;<br>
> +<br>
> + }<br>
> +<br>
> + return ret;<br>
> +}<br>
> <br>
> int smu_feature_is_enabled(struct smu_context *smu, enum<br>
> smu_feature_mask mask)<br>
> {<br>
> @@ -532,6 +567,7 @@ int smu_feature_set_enabled(struct smu_context<br>
> *smu, enum smu_feature_mask mask,<br>
> {<br>
> struct smu_feature *feature = &smu->smu_feature;<br>
> int feature_id;<br>
> + uint64_t feature_mask = 0;<br>
> int ret = 0;<br>
> <br>
> feature_id = smu_feature_get_index(smu, mask);<br>
> @@ -540,8 +576,10 @@ int smu_feature_set_enabled(struct smu_context<br>
> *smu, enum smu_feature_mask mask,<br>
> <br>
> WARN_ON(feature_id > feature->feature_num);<br>
> <br>
> + feature_mask = 1UL << feature_id;<br>
> +<br>
> mutex_lock(&feature->mutex);<br>
> - ret = smu_feature_update_enable_state(smu, feature_id, enable);<br>
> + ret = smu_feature_update_enable_state(smu, feature_mask,<br>
> enable);<br>
> if (ret)<br>
> goto failed;<br>
> <br>
> diff --git a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h<br>
> b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h<br>
> index ba2385026b89..abc2644b4c07 100644<br>
> --- a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h<br>
> +++ b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h<br>
> @@ -479,7 +479,6 @@ struct smu_funcs<br>
> int (*init_display_count)(struct smu_context *smu, uint32_t count);<br>
> int (*set_allowed_mask)(struct smu_context *smu);<br>
> int (*get_enabled_mask)(struct smu_context *smu, uint32_t<br>
> *feature_mask, uint32_t num);<br>
> - int (*update_feature_enable_state)(struct smu_context *smu,<br>
> uint32_t feature_id, bool enabled);<br>
> int (*notify_display_change)(struct smu_context *smu);<br>
> int (*get_power_limit)(struct smu_context *smu, uint32_t *limit,<br>
> bool def);<br>
> int (*set_power_limit)(struct smu_context *smu, uint32_t n);<br>
> @@ -595,8 +594,6 @@ struct smu_funcs<br>
> ((smu)->funcs->get_enabled_mask? (smu)->funcs-<br>
> >get_enabled_mask((smu), (mask), (num)) : 0)<br>
> #define smu_is_dpm_running(smu) \<br>
> ((smu)->ppt_funcs->is_dpm_running ? (smu)->ppt_funcs-<br>
> >is_dpm_running((smu)) : 0)<br>
> -#define smu_feature_update_enable_state(smu, feature_id, enabled) \<br>
> - ((smu)->funcs->update_feature_enable_state? (smu)->funcs-<br>
> >update_feature_enable_state((smu), (feature_id), (enabled)) : 0)<br>
> #define smu_notify_display_change(smu) \<br>
> ((smu)->funcs->notify_display_change? (smu)->funcs-<br>
> >notify_display_change((smu)) : 0)<br>
> #define smu_store_powerplay_table(smu) \<br>
> @@ -804,6 +801,7 @@ enum amd_dpm_forced_level<br>
> smu_get_performance_level(struct smu_context *smu);<br>
> int smu_force_performance_level(struct smu_context *smu, enum<br>
> amd_dpm_forced_level level);<br>
> int smu_set_display_count(struct smu_context *smu, uint32_t count);<br>
> bool smu_clk_dpm_is_enabled(struct smu_context *smu, enum<br>
> smu_clk_type clk_type);<br>
> +int smu_feature_update_enable_state(struct smu_context *smu, uint64_t<br>
> feature_mask, bool enabled);<br>
> const char *smu_get_message_name(struct smu_context *smu, enum<br>
> smu_message_type type);<br>
> const char *smu_get_feature_name(struct smu_context *smu, enum<br>
> smu_feature_mask feature);<br>
> <br>
> diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c<br>
> b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c<br>
> index ccf6af055d03..93f3ffb8b471 100644<br>
> --- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c<br>
> +++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c<br>
> @@ -795,44 +795,6 @@ static int smu_v11_0_init_display_count(struct<br>
> smu_context *smu, uint32_t count)<br>
> return ret;<br>
> }<br>
> <br>
> -static int smu_v11_0_update_feature_enable_state(struct smu_context<br>
> *smu, uint32_t feature_id, bool enabled)<br>
> -{<br>
> - uint32_t feature_low = 0, feature_high = 0;<br>
> - int ret = 0;<br>
> -<br>
> - if (!smu->pm_enabled)<br>
> - return ret;<br>
> - if (feature_id >= 0 && feature_id < 31)<br>
> - feature_low = (1 << feature_id);<br>
> - else if (feature_id > 31 && feature_id < 63)<br>
> - feature_high = (1 << feature_id);<br>
> - else<br>
> - return -EINVAL;<br>
> -<br>
> - if (enabled) {<br>
> - ret = smu_send_smc_msg_with_param(smu,<br>
> SMU_MSG_EnableSmuFeaturesLow,<br>
> - feature_low);<br>
> - if (ret)<br>
> - return ret;<br>
> - ret = smu_send_smc_msg_with_param(smu,<br>
> SMU_MSG_EnableSmuFeaturesHigh,<br>
> - feature_high);<br>
> - if (ret)<br>
> - return ret;<br>
> -<br>
> - } else {<br>
> - ret = smu_send_smc_msg_with_param(smu,<br>
> SMU_MSG_DisableSmuFeaturesLow,<br>
> - feature_low);<br>
> - if (ret)<br>
> - return ret;<br>
> - ret = smu_send_smc_msg_with_param(smu,<br>
> SMU_MSG_DisableSmuFeaturesHigh,<br>
> - feature_high);<br>
> - if (ret)<br>
> - return ret;<br>
> -<br>
> - }<br>
> -<br>
> - return ret;<br>
> -}<br>
> <br>
> static int smu_v11_0_set_allowed_mask(struct smu_context *smu)<br>
> {<br>
> @@ -1781,7 +1743,6 @@ static const struct smu_funcs smu_v11_0_funcs = {<br>
> .set_allowed_mask = smu_v11_0_set_allowed_mask,<br>
> .get_enabled_mask = smu_v11_0_get_enabled_mask,<br>
> .system_features_control = smu_v11_0_system_features_control,<br>
> - .update_feature_enable_state =<br>
> smu_v11_0_update_feature_enable_state,<br>
> .notify_display_change = smu_v11_0_notify_display_change,<br>
> .get_power_limit = smu_v11_0_get_power_limit,<br>
> .set_power_limit = smu_v11_0_set_power_limit,<br>
> --<br>
> 2.22.0<br>
> <br>
> _______________________________________________<br>
> amd-gfx mailing list<br>
> amd-gfx@lists.freedesktop.org<br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
</div>
</span></font></div>
</body>
</html>