From: Xiaojian Du <Xiaojian.Du@amd.com>
To: amd-gfx@lists.freedesktop.org, ray.huang@amd.com,
evan.quan@amd.com, Alexander.Deucher@amd.com,
kevin1.wang@amd.com
Cc: Xiaojian Du <Xiaojian.Du@amd.com>,
xinmei.huang@amd.com, prike.liang@amd.com, changfeng.zhu@amd.com
Subject: [PATCH 08/10] drm/amd/pm: add one new function to get 32 bit feature mask for vangogh
Date: Tue, 27 Oct 2020 17:41:31 +0800 [thread overview]
Message-ID: <20201027094133.21881-8-Xiaojian.Du@amd.com> (raw)
In-Reply-To: <20201027094133.21881-1-Xiaojian.Du@amd.com>
This patch is to add one new function to get 32 bit feature mask for
vangogh.
Signed-off-by: Xiaojian Du <Xiaojian.Du@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
---
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 55 +++++++++++++++++++++++---
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h | 4 ++
2 files changed, 54 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
index 92b2ea4c197b..dc28f22aeb38 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
@@ -346,6 +346,43 @@ int smu_cmn_get_enabled_mask(struct smu_context *smu,
return ret;
}
+int smu_cmn_get_enabled_32_bits_mask(struct smu_context *smu,
+ uint32_t *feature_mask,
+ uint32_t num)
+{
+ uint32_t feature_mask_en_low = 0;
+ uint32_t feature_mask_en_high = 0;
+ struct smu_feature *feature = &smu->smu_feature;
+ int ret = 0;
+
+ if (!feature_mask || num < 2)
+ return -EINVAL;
+
+ if (bitmap_empty(feature->enabled, feature->feature_num)) {
+ ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_GetEnabledSmuFeatures, 0,
+ &feature_mask_en_low);
+
+ if (ret)
+ return ret;
+
+ ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_GetEnabledSmuFeatures, 1,
+ &feature_mask_en_high);
+
+ if (ret)
+ return ret;
+
+ feature_mask[0] = feature_mask_en_low;
+ feature_mask[1] = feature_mask_en_high;
+
+ } else {
+ bitmap_copy((unsigned long *)feature_mask, feature->enabled,
+ feature->feature_num);
+ }
+
+ return ret;
+
+}
+
int smu_cmn_feature_update_enable_state(struct smu_context *smu,
uint64_t feature_mask,
bool enabled)
@@ -437,11 +474,19 @@ size_t smu_cmn_get_pp_feature_mask(struct smu_context *smu,
size_t size = 0;
int ret = 0, i;
- ret = smu_cmn_get_enabled_mask(smu,
- feature_mask,
- 2);
- if (ret)
- return 0;
+ if (!smu->is_apu) {
+ ret = smu_cmn_get_enabled_mask(smu,
+ feature_mask,
+ 2);
+ if (ret)
+ return 0;
+ } else {
+ ret = smu_cmn_get_enabled_32_bits_mask(smu,
+ feature_mask,
+ 2);
+ if (ret)
+ return 0;
+ }
size = sprintf(buf + size, "features high: 0x%08x low: 0x%08x\n",
feature_mask[1], feature_mask[0]);
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h
index ab577be23c15..01e825d83d8d 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h
@@ -52,6 +52,10 @@ int smu_cmn_get_enabled_mask(struct smu_context *smu,
uint32_t *feature_mask,
uint32_t num);
+int smu_cmn_get_enabled_32_bits_mask(struct smu_context *smu,
+ uint32_t *feature_mask,
+ uint32_t num);
+
int smu_cmn_feature_update_enable_state(struct smu_context *smu,
uint64_t feature_mask,
bool enabled);
--
2.17.1
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2020-10-27 9:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-27 9:41 [PATCH 01/10] drm/amd/pm: update the smu v11.5 smc header for vangogh Xiaojian Du
2020-10-27 9:41 ` [PATCH 02/10] drm/amd/pm: update the smu v11.5 firmware " Xiaojian Du
2020-10-27 9:41 ` [PATCH 03/10] drm/amd/pm: add new smc message mapping " Xiaojian Du
2020-10-27 9:41 ` [PATCH 04/10] drm/amd/pm: add UMD Pstate Msg Parameters for vangogh temporarily Xiaojian Du
2020-10-27 9:41 ` [PATCH 05/10] drm/amd/pm: update the smu v11.5 driver interface header for vangogh Xiaojian Du
2020-10-27 9:41 ` [PATCH 06/10] drm/amd/pm: set the initial value of pm info to zero Xiaojian Du
2020-10-27 9:41 ` [PATCH 07/10] drm/amd/pm: remove some redundant smu message mapping for vangogh Xiaojian Du
2020-10-27 9:41 ` Xiaojian Du [this message]
2020-10-27 9:41 ` [PATCH 09/10] drm/amd/pm: add some swSMU functions " Xiaojian Du
2020-10-27 9:41 ` [PATCH 10/10] drm/amd/pm: enable the rest functions of swSMU " Xiaojian Du
2020-10-28 7:21 ` [PATCH 01/10] drm/amd/pm: update the smu v11.5 smc header " Huang Rui
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=20201027094133.21881-8-Xiaojian.Du@amd.com \
--to=xiaojian.du@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=changfeng.zhu@amd.com \
--cc=evan.quan@amd.com \
--cc=kevin1.wang@amd.com \
--cc=prike.liang@amd.com \
--cc=ray.huang@amd.com \
--cc=xinmei.huang@amd.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).