<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);">
<span style="color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;">sorry, please ignore this patch, the patch has been merged.</span><br>
</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,<br>
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> Wang, Kevin(Yang) <Kevin1.Wang@amd.com><br>
<b>Sent:</b> Tuesday, November 3, 2020 1:54 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Feng, Kenneth <Kenneth.Feng@amd.com>; Wang, Kevin(Yang) <Kevin1.Wang@amd.com><br>
<b>Subject:</b> [PATCH] drm/amd/swsmu: correct wrong feature bit mapping</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">1.<br>
when smc feature bit isn't mapped,<br>
the feature state isn't showed on sysfs node of pp_features.<br>
2.<br>
add pp_features table title<br>
<br>
Signed-off-by: Kevin Wang <kevin1.wang@amd.com><br>
---<br>
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 27 ++++++++++++++++----------<br>
 1 file changed, 17 insertions(+), 10 deletions(-)<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 c30d3338825f..92b2ea4c197b 100644<br>
--- a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c<br>
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c<br>
@@ -431,10 +431,9 @@ size_t smu_cmn_get_pp_feature_mask(struct smu_context *smu,<br>
                                    char *buf)<br>
 {<br>
         uint32_t feature_mask[2] = { 0 };<br>
-       int32_t feature_index = 0;<br>
+       int feature_index = 0;<br>
         uint32_t count = 0;<br>
-       uint32_t sort_feature[SMU_FEATURE_COUNT];<br>
-       uint64_t hw_feature_count = 0;<br>
+       int8_t sort_feature[SMU_FEATURE_COUNT];<br>
         size_t size = 0;<br>
         int ret = 0, i;<br>
 <br>
@@ -447,23 +446,31 @@ size_t smu_cmn_get_pp_feature_mask(struct smu_context *smu,<br>
         size =  sprintf(buf + size, "features high: 0x%08x low: 0x%08x\n",<br>
                         feature_mask[1], feature_mask[0]);<br>
 <br>
+       memset(sort_feature, -1, sizeof(sort_feature));<br>
+<br>
         for (i = 0; i < SMU_FEATURE_COUNT; i++) {<br>
                 feature_index = smu_cmn_to_asic_specific_index(smu,<br>
                                                                CMN2ASIC_MAPPING_FEATURE,<br>
                                                                i);<br>
                 if (feature_index < 0)<br>
                         continue;<br>
+<br>
                 sort_feature[feature_index] = i;<br>
-               hw_feature_count++;<br>
         }<br>
 <br>
-       for (i = 0; i < hw_feature_count; i++) {<br>
+       size += sprintf(buf + size, "%-2s. %-20s  %-3s : %-s\n",<br>
+                       "No", "Feature", "Bit", "State");<br>
+<br>
+       for (i = 0; i < SMU_FEATURE_COUNT; i++) {<br>
+               if (sort_feature[i] < 0)<br>
+                       continue;<br>
+<br>
                 size += sprintf(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>
-                              "enabled" : "disabled");<br>
+                               count++,<br>
+                               smu_get_feature_name(smu, sort_feature[i]),<br>
+                               i,<br>
+                               !!smu_cmn_feature_is_enabled(smu, sort_feature[i]) ?<br>
+                               "enabled" : "disabled");<br>
         }<br>
 <br>
         return size;<br>
-- <br>
2.17.1<br>
<br>
</div>
</span></font></div>
</body>
</html>