<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:#008000;margin:15pt;" align="Left">
[Public]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Reviewed-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, January 28, 2022 2:04 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>; Lazar, Lijo <Lijo.Lazar@amd.com>; Quan, Evan <Evan.Quan@amd.com><br>
<b>Subject:</b> [PATCH V3 6/7] drm/amd/pm: avoid consecutive retrieving for enabled ppfeatures</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">As the enabled ppfeatures are just retrieved ahead. We can use<br>
that directly instead of retrieving again and again.<br>
<br>
Signed-off-by: Evan Quan <evan.quan@amd.com><br>
Change-Id: I08827437fcbbc52084418c8ca6a90cfa503306a9<br>
---<br>
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 10 +++++++++-<br>
 1 file changed, 9 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c<br>
index 3d263b27b6c2..acb9f0ca191b 100644<br>
--- a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c<br>
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c<br>
@@ -680,6 +680,7 @@ size_t smu_cmn_get_pp_feature_mask(struct smu_context *smu,<br>
         int8_t sort_feature[SMU_FEATURE_COUNT];<br>
         size_t size = 0;<br>
         int ret = 0, i;<br>
+       int feature_id;<br>
 <br>
         ret = smu_cmn_get_enabled_mask(smu,<br>
                                        &feature_mask);<br>
@@ -708,11 +709,18 @@ size_t smu_cmn_get_pp_feature_mask(struct smu_context *smu,<br>
                 if (sort_feature[i] < 0)<br>
                         continue;<br>
 <br>
+               /* convert to asic spcific feature ID */<br>
+               feature_id = smu_cmn_to_asic_specific_index(smu,<br>
+                                                           CMN2ASIC_MAPPING_FEATURE,<br>
+                                                           sort_feature[i]);<br>
+               if (feature_id < 0)<br>
+                       continue;<br>
+<br>
                 size += sysfs_emit_at(buf, size, "%02d. %-20s (%2d) : %s\n",<br>
                                 count++,<br>
                                 smu_get_feature_name(smu, sort_feature[i]),<br>
                                 i,<br>
-                               !!smu_cmn_feature_is_enabled(smu, sort_feature[i]) ?<br>
+                               !!test_bit(feature_id, (unsigned long *)&feature_mask) ?<br>
                                 "enabled" : "disabled");<br>
         }<br>
 <br>
-- <br>
2.29.0<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>