<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Arial;font-size:10pt;color:#0078D7;margin:15pt;" align="Left">
[AMD Official Use Only - Internal Distribution Only]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Acked-by: Alex Deucher <alexander.deucher@amd.com><br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Quan, Evan <Evan.Quan@amd.com><br>
<b>Sent:</b> Friday, August 7, 2020 5:30 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Deucher, Alexander <Alexander.Deucher@amd.com>; Kuehling, Felix <Felix.Kuehling@amd.com>; Quan, Evan <Evan.Quan@amd.com><br>
<b>Subject:</b> [PATCH] drm/amd/powerplay: correct Vega20 cached smu feature state</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Correct the cached smu feature state on pp_features sysfs<br>
setting.<br>
<br>
Change-Id: Icc4c3ce764876a0ffdc86ad4c8a8b9c9f0ed0e97<br>
Signed-off-by: Evan Quan <evan.quan@amd.com><br>
---<br>
.../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 38 +++++++++----------<br>
1 file changed, 19 insertions(+), 19 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c<br>
index 90c78f127f7e..acc926c20c55 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c<br>
@@ -984,10 +984,7 @@ static int vega20_disable_all_smu_features(struct pp_hwmgr *hwmgr)<br>
{<br>
struct vega20_hwmgr *data =<br>
(struct vega20_hwmgr *)(hwmgr->backend);<br>
- uint64_t features_enabled;<br>
- int i;<br>
- bool enabled;<br>
- int ret = 0;<br>
+ int i, ret = 0;<br>
<br>
PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc(hwmgr,<br>
PPSMC_MSG_DisableAllSmuFeatures,<br>
@@ -995,17 +992,8 @@ static int vega20_disable_all_smu_features(struct pp_hwmgr *hwmgr)<br>
"[DisableAllSMUFeatures] Failed to disable all smu features!",<br>
return ret);<br>
<br>
- ret = vega20_get_enabled_smc_features(hwmgr, &features_enabled);<br>
- PP_ASSERT_WITH_CODE(!ret,<br>
- "[DisableAllSMUFeatures] Failed to get enabled smc features!",<br>
- return ret);<br>
-<br>
- for (i = 0; i < GNLD_FEATURES_MAX; i++) {<br>
- enabled = (features_enabled & data->smu_features[i].smu_feature_bitmap) ?<br>
- true : false;<br>
- data->smu_features[i].enabled = enabled;<br>
- data->smu_features[i].supported = enabled;<br>
- }<br>
+ for (i = 0; i < GNLD_FEATURES_MAX; i++)<br>
+ data->smu_features[i].enabled = 0;<br>
<br>
return 0;<br>
}<br>
@@ -3242,10 +3230,11 @@ static int vega20_get_ppfeature_status(struct pp_hwmgr *hwmgr, char *buf)<br>
<br>
static int vega20_set_ppfeature_status(struct pp_hwmgr *hwmgr, uint64_t new_ppfeature_masks)<br>
{<br>
- uint64_t features_enabled;<br>
- uint64_t features_to_enable;<br>
- uint64_t features_to_disable;<br>
- int ret = 0;<br>
+ struct vega20_hwmgr *data =<br>
+ (struct vega20_hwmgr *)(hwmgr->backend);<br>
+ uint64_t features_enabled, features_to_enable, features_to_disable;<br>
+ int i, ret = 0;<br>
+ bool enabled;<br>
<br>
if (new_ppfeature_masks >= (1ULL << GNLD_FEATURES_MAX))<br>
return -EINVAL;<br>
@@ -3274,6 +3263,17 @@ static int vega20_set_ppfeature_status(struct pp_hwmgr *hwmgr, uint64_t new_ppfe<br>
return ret;<br>
}<br>
<br>
+ /* Update the cached feature enablement state */<br>
+ ret = vega20_get_enabled_smc_features(hwmgr, &features_enabled);<br>
+ if (ret)<br>
+ return ret;<br>
+<br>
+ for (i = 0; i < GNLD_FEATURES_MAX; i++) {<br>
+ enabled = (features_enabled & data->smu_features[i].smu_feature_bitmap) ?<br>
+ true : false;<br>
+ data->smu_features[i].enabled = enabled;<br>
+ }<br>
+<br>
return 0;<br>
}<br>
<br>
-- <br>
2.28.0<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>