All of lore.kernel.org
 help / color / mirror / Atom feed
From: Evan Quan <evan.quan@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: Alexander.Deucher@amd.com, Lijo.Lazar@amd.com,
	Evan Quan <evan.quan@amd.com>
Subject: [PATCH V3 6/7] drm/amd/pm: avoid consecutive retrieving for enabled ppfeatures
Date: Fri, 28 Jan 2022 15:04:54 +0800	[thread overview]
Message-ID: <20220128070455.202014-6-evan.quan@amd.com> (raw)
In-Reply-To: <20220128070455.202014-1-evan.quan@amd.com>

As the enabled ppfeatures are just retrieved ahead. We can use
that directly instead of retrieving again and again.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Change-Id: I08827437fcbbc52084418c8ca6a90cfa503306a9
---
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
index 3d263b27b6c2..acb9f0ca191b 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
@@ -680,6 +680,7 @@ size_t smu_cmn_get_pp_feature_mask(struct smu_context *smu,
 	int8_t sort_feature[SMU_FEATURE_COUNT];
 	size_t size = 0;
 	int ret = 0, i;
+	int feature_id;
 
 	ret = smu_cmn_get_enabled_mask(smu,
 				       &feature_mask);
@@ -708,11 +709,18 @@ size_t smu_cmn_get_pp_feature_mask(struct smu_context *smu,
 		if (sort_feature[i] < 0)
 			continue;
 
+		/* convert to asic spcific feature ID */
+		feature_id = smu_cmn_to_asic_specific_index(smu,
+							    CMN2ASIC_MAPPING_FEATURE,
+							    sort_feature[i]);
+		if (feature_id < 0)
+			continue;
+
 		size += sysfs_emit_at(buf, size, "%02d. %-20s (%2d) : %s\n",
 				count++,
 				smu_get_feature_name(smu, sort_feature[i]),
 				i,
-				!!smu_cmn_feature_is_enabled(smu, sort_feature[i]) ?
+				!!test_bit(feature_id, (unsigned long *)&feature_mask) ?
 				"enabled" : "disabled");
 	}
 
-- 
2.29.0


  parent reply	other threads:[~2022-01-28  7:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-28  7:04 [PATCH V3 1/7] drm/amd/pm: correct the way for retrieving enabled ppfeatures on Renoir Evan Quan
2022-01-28  7:04 ` [PATCH V3 2/7] drm/amd/pm: unify the interface for retrieving enabled ppfeatures Evan Quan
2022-01-28 14:53   ` Deucher, Alexander
2022-01-28  7:04 ` [PATCH V3 3/7] drm/amd/pm: update the data type " Evan Quan
2022-01-28  7:04 ` [PATCH V3 4/7] drm/amd/pm: correct the usage for 'supported' member of smu_feature structure Evan Quan
2022-01-28 14:54   ` Deucher, Alexander
2022-02-08 18:24   ` Nathan Chancellor
2022-01-28  7:04 ` [PATCH V3 5/7] drm/amd/pm: drop the cache for enabled ppfeatures Evan Quan
2022-01-28 14:55   ` Deucher, Alexander
2022-01-28  7:04 ` Evan Quan [this message]
2022-01-28 14:56   ` [PATCH V3 6/7] drm/amd/pm: avoid consecutive retrieving " Deucher, Alexander
2022-01-28  7:04 ` [PATCH V3 7/7] drm/amd/pm: revise the implementation of smu_cmn_disable_all_features_with_exception Evan Quan
2022-01-28 14:58   ` Deucher, Alexander

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220128070455.202014-6-evan.quan@amd.com \
    --to=evan.quan@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Lijo.Lazar@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.