[PATCH V2 5/7] drm/amd/pm: move SMU13.0.7 related pptable settings to smu_v13_0_7_ppt.c

Evan Quan evan.quan at amd.com
Mon Sep 19 02:02:49 UTC 2022


Separate those ASIC specific settings from common helpers.

Signed-off-by: Evan Quan <evan.quan at amd.com>
Change-Id: Icbb7dc26d720562ce66c1d7240078a34bea1aae3
--
v1->v2:
  - update the comments to fit the latest code(Guchun)
---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     |  4 ----
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c  | 22 ++++++++++++++-----
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index 7adbdd3cc13b..24be318adf7a 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
@@ -1027,10 +1027,6 @@ static void smu_interrupt_work_fn(struct work_struct *work)
 static void smu_pptable_source_init(struct smu_context *smu)
 {
 	switch (smu->adev->ip_versions[MP1_HWIP][0]) {
-	case IP_VERSION(13, 0, 7):
-		smu->pptable_source = PPTABLE_SOURCE_PMFW;
-		smu->pptable_id = smu->smu_table.boot_values.pp_table_id;
-		break;
 	case IP_VERSION(13, 0, 10):
 		smu->pptable_source = PPTABLE_SOURCE_INTERNAL_HARDCOPY;
 		smu->pptable_id = 6666;
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
index 0a6785eecfc6..d1b321cc0358 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
@@ -426,13 +426,15 @@ static int smu_v13_0_7_setup_pptable(struct smu_context *smu)
 	int ret = 0;
 
 	/*
-	 * With SCPM enabled, the pptable used will be signed. It cannot
-	 * be used directly by driver. To get the raw pptable, we need to
-	 * rely on the combo pptable(and its revelant SMU message).
+	 * For the latest SMU13 asics, the pptable carried in vbios is
+	 * properly signed. We have to rely on SMU to get the desired pptable.
 	 */
-	ret = smu_v13_0_7_get_pptable_from_pmfw(smu,
-						&smu_table->power_play_table,
-						&smu_table->power_play_table_size);
+	if (smu->pptable_source == PPTABLE_SOURCE_PMFW)
+		ret = smu_v13_0_7_get_pptable_from_pmfw(smu,
+							&smu_table->power_play_table,
+							&smu_table->power_play_table_size);
+	else
+		ret = smu_v13_0_setup_pptable(smu);
 	if (ret)
 		return ret;
 
@@ -1595,6 +1597,13 @@ static bool smu_v13_0_7_is_mode1_reset_supported(struct smu_context *smu)
 
 	return true;
 }
+
+static void smu_v13_0_7_pptable_source_init(struct smu_context *smu)
+{
+	smu->pptable_source = PPTABLE_SOURCE_PMFW;
+	smu->pptable_id = smu->smu_table.boot_values.pp_table_id;
+}
+
 static const struct pptable_funcs smu_v13_0_7_ppt_funcs = {
 	.get_allowed_feature_mask = smu_v13_0_7_get_allowed_feature_mask,
 	.set_default_dpm_table = smu_v13_0_7_set_default_dpm_table,
@@ -1657,6 +1666,7 @@ static const struct pptable_funcs smu_v13_0_7_ppt_funcs = {
 	.mode1_reset_is_support = smu_v13_0_7_is_mode1_reset_supported,
 	.mode1_reset = smu_v13_0_mode1_reset,
 	.set_mp1_state = smu_v13_0_7_set_mp1_state,
+	.pptable_source_init = smu_v13_0_7_pptable_source_init,
 };
 
 void smu_v13_0_7_set_ppt_funcs(struct smu_context *smu)
-- 
2.34.1



More information about the amd-gfx mailing list