Skip to content

Commit a6c42e8

Browse files
Kevin Wangalexdeucher
authored andcommitted
drm/amd/swsmu: correct wrong feature bit mapping
1. when smc feature bit isn't mapped, the feature state isn't showed on sysfs node of pp_features. 2. add pp_features table title Signed-off-by: Kevin Wang <kevin1.wang@amd.com> Reviewed-by: Kenneth Feng <kenneth.feng@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent f1bcddf commit a6c42e8

1 file changed

Lines changed: 17 additions & 10 deletions

File tree

‎drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c‎

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -431,10 +431,9 @@ size_t smu_cmn_get_pp_feature_mask(struct smu_context *smu,
431431
char *buf)
432432
{
433433
uint32_t feature_mask[2] = { 0 };
434-
int32_t feature_index = 0;
434+
int feature_index = 0;
435435
uint32_t count = 0;
436-
uint32_t sort_feature[SMU_FEATURE_COUNT];
437-
uint64_t hw_feature_count = 0;
436+
int8_t sort_feature[SMU_FEATURE_COUNT];
438437
size_t size = 0;
439438
int ret = 0, i;
440439

@@ -447,23 +446,31 @@ size_t smu_cmn_get_pp_feature_mask(struct smu_context *smu,
447446
size = sprintf(buf + size, "features high: 0x%08x low: 0x%08x\n",
448447
feature_mask[1], feature_mask[0]);
449448

449+
memset(sort_feature, -1, sizeof(sort_feature));
450+
450451
for (i = 0; i < SMU_FEATURE_COUNT; i++) {
451452
feature_index = smu_cmn_to_asic_specific_index(smu,
452453
CMN2ASIC_MAPPING_FEATURE,
453454
i);
454455
if (feature_index < 0)
455456
continue;
457+
456458
sort_feature[feature_index] = i;
457-
hw_feature_count++;
458459
}
459460

460-
for (i = 0; i < hw_feature_count; i++) {
461+
size += sprintf(buf + size, "%-2s. %-20s %-3s : %-s\n",
462+
"No", "Feature", "Bit", "State");
463+
464+
for (i = 0; i < SMU_FEATURE_COUNT; i++) {
465+
if (sort_feature[i] < 0)
466+
continue;
467+
461468
size += sprintf(buf + size, "%02d. %-20s (%2d) : %s\n",
462-
count++,
463-
smu_get_feature_name(smu, sort_feature[i]),
464-
i,
465-
!!smu_cmn_feature_is_enabled(smu, sort_feature[i]) ?
466-
"enabled" : "disabled");
469+
count++,
470+
smu_get_feature_name(smu, sort_feature[i]),
471+
i,
472+
!!smu_cmn_feature_is_enabled(smu, sort_feature[i]) ?
473+
"enabled" : "disabled");
467474
}
468475

469476
return size;

0 commit comments

Comments
 (0)