* [PATCH V2 1/7] drm/amd/pm: add support for 3794 pptable for SMU13.0.0
@ 2022-09-19 2:02 Evan Quan
2022-09-19 2:02 ` [PATCH V2 2/7] drm/amd/pm: drop the pptable related workarounds for SMU 13.0.0 Evan Quan
` (7 more replies)
0 siblings, 8 replies; 13+ messages in thread
From: Evan Quan @ 2022-09-19 2:02 UTC (permalink / raw)
To: amd-gfx; +Cc: Alexander.Deucher, Evan Quan, guchun.chen
Enable 3794 pptable support for SMU13.0.0.
Signed-off-by: Evan Quan <evan.quan@amd.com>
Change-Id: Ia208531c9eb96611b6136975bcbd8d27007b9e14
---
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
index de779f8089d3..a6b7319fbfe6 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
@@ -406,6 +406,7 @@ static int smu_v13_0_0_setup_pptable(struct smu_context *smu)
case 3664:
case 3715:
case 3795:
+ case 3794:
pptable_id = 0;
break;
case 3683:
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH V2 2/7] drm/amd/pm: drop the pptable related workarounds for SMU 13.0.0
2022-09-19 2:02 [PATCH V2 1/7] drm/amd/pm: add support for 3794 pptable for SMU13.0.0 Evan Quan
@ 2022-09-19 2:02 ` Evan Quan
2022-09-20 1:04 ` Quan, Evan
2022-09-20 3:42 ` Lazar, Lijo
2022-09-19 2:02 ` [PATCH V2 3/7] drm/amd/pm: revise the implementations for pptable retrieving Evan Quan
` (6 subsequent siblings)
7 siblings, 2 replies; 13+ messages in thread
From: Evan Quan @ 2022-09-19 2:02 UTC (permalink / raw)
To: amd-gfx; +Cc: Alexander.Deucher, Evan Quan, guchun.chen
The pptable in the vbios is fully ready. The related workarounds
in driver are not needed any more.
Signed-off-by: Evan Quan <evan.quan@amd.com>
Change-Id: I2549cd1acd6eebde361ed8e27d5631bd57644e52
--
v1->v2:
- drop unrelated and unnecessary changes(Alex, Guchun)
---
.../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 46 ++--------------
.../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 54 ++-----------------
2 files changed, 6 insertions(+), 94 deletions(-)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
index 4fd685af8fa4..53d26bca524a 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
@@ -210,7 +210,8 @@ int smu_v13_0_init_pptable_microcode(struct smu_context *smu)
if (!adev->scpm_enabled)
return 0;
- if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 7))
+ if ((adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 7)) ||
+ (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 0)))
return 0;
/* override pptable_id from driver parameter */
@@ -219,27 +220,6 @@ int smu_v13_0_init_pptable_microcode(struct smu_context *smu)
dev_info(adev->dev, "override pptable id %d\n", pptable_id);
} else {
pptable_id = smu->smu_table.boot_values.pp_table_id;
-
- /*
- * Temporary solution for SMU V13.0.0 with SCPM enabled:
- * - use vbios carried pptable when pptable_id is 3664, 3715 or 3795
- * - use 36831 soft pptable when pptable_id is 3683
- */
- if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 0)) {
- switch (pptable_id) {
- case 3664:
- case 3715:
- case 3795:
- pptable_id = 0;
- break;
- case 3683:
- pptable_id = 36831;
- break;
- default:
- dev_err(adev->dev, "Unsupported pptable id %d\n", pptable_id);
- return -EINVAL;
- }
- }
}
/* "pptable_id == 0" means vbios carries the pptable. */
@@ -475,28 +455,8 @@ int smu_v13_0_setup_pptable(struct smu_context *smu)
} else {
pptable_id = smu->smu_table.boot_values.pp_table_id;
- /*
- * Temporary solution for SMU V13.0.0 with SCPM disabled:
- * - use 3664, 3683 or 3715 on request
- * - use 3664 when pptable_id is 0
- * TODO: drop these when the pptable carried in vbios is ready.
- */
- if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 0)) {
- switch (pptable_id) {
- case 0:
- pptable_id = 3664;
- break;
- case 3664:
- case 3683:
- case 3715:
- break;
- default:
- dev_err(adev->dev, "Unsupported pptable id %d\n", pptable_id);
- return -EINVAL;
- }
- } else if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 10)) {
+ if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 10))
pptable_id = 6666;
- }
}
/* force using vbios pptable in sriov mode */
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
index a6b7319fbfe6..1d454485e0d9 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
@@ -375,59 +375,11 @@ static int smu_v13_0_0_setup_pptable(struct smu_context *smu)
{
struct smu_table_context *smu_table = &smu->smu_table;
struct amdgpu_device *adev = smu->adev;
- uint32_t pptable_id;
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).
- */
- if (adev->scpm_enabled) {
- ret = smu_v13_0_0_get_pptable_from_pmfw(smu,
- &smu_table->power_play_table,
- &smu_table->power_play_table_size);
- } else {
- /* override pptable_id from driver parameter */
- if (amdgpu_smu_pptable_id >= 0) {
- pptable_id = amdgpu_smu_pptable_id;
- dev_info(adev->dev, "override pptable id %d\n", pptable_id);
- } else {
- pptable_id = smu_table->boot_values.pp_table_id;
- }
-
- /*
- * Temporary solution for SMU V13.0.0 with SCPM disabled:
- * - use vbios carried pptable when pptable_id is 3664, 3715 or 3795
- * - use soft pptable when pptable_id is 3683
- */
- if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 0)) {
- switch (pptable_id) {
- case 3664:
- case 3715:
- case 3795:
- case 3794:
- pptable_id = 0;
- break;
- case 3683:
- break;
- default:
- dev_err(adev->dev, "Unsupported pptable id %d\n", pptable_id);
- return -EINVAL;
- }
- }
-
- /* force using vbios pptable in sriov mode */
- if ((amdgpu_sriov_vf(adev) || !pptable_id) && (amdgpu_emu_mode != 1))
- ret = smu_v13_0_0_get_pptable_from_pmfw(smu,
- &smu_table->power_play_table,
- &smu_table->power_play_table_size);
- else
- ret = smu_v13_0_get_pptable_from_firmware(smu,
- &smu_table->power_play_table,
- &smu_table->power_play_table_size,
- pptable_id);
- }
+ ret = smu_v13_0_0_get_pptable_from_pmfw(smu,
+ &smu_table->power_play_table,
+ &smu_table->power_play_table_size);
if (ret)
return ret;
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH V2 3/7] drm/amd/pm: revise the implementations for pptable retrieving
2022-09-19 2:02 [PATCH V2 1/7] drm/amd/pm: add support for 3794 pptable for SMU13.0.0 Evan Quan
2022-09-19 2:02 ` [PATCH V2 2/7] drm/amd/pm: drop the pptable related workarounds for SMU 13.0.0 Evan Quan
@ 2022-09-19 2:02 ` Evan Quan
2022-09-19 2:02 ` [PATCH V2 4/7] drm/amd/pm: move SMU13.0.0 related pptable settings to smu_v13_0_0_ppt.c Evan Quan
` (5 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Evan Quan @ 2022-09-19 2:02 UTC (permalink / raw)
To: amd-gfx; +Cc: Alexander.Deucher, Evan Quan, guchun.chen
Add a new member to flag where to get the pptable. So that,
we can separate those ASIC specific ones from common helpers.
Signed-off-by: Evan Quan <evan.quan@amd.com>
Change-Id: I814db70b5cedc225578bcb4988663de7dcf535af
---
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 31 ++++++++++++
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h | 14 ++++++
.../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 48 ++++++-------------
3 files changed, 60 insertions(+), 33 deletions(-)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index 13c5c7f1ecb9..610f9b68ef73 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
@@ -1024,6 +1024,35 @@ static void smu_interrupt_work_fn(struct work_struct *work)
smu->ppt_funcs->interrupt_work(smu);
}
+static void smu_pptable_source_init(struct smu_context *smu)
+{
+ switch (smu->adev->ip_versions[MP1_HWIP][0]) {
+ case IP_VERSION(13, 0, 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;
+ break;
+ default:
+ smu->pptable_source = PPTABLE_SOURCE_VBIOS;
+ smu->pptable_id = smu->smu_table.boot_values.pp_table_id;
+ break;
+ }
+
+ if (smu->ppt_funcs && smu->ppt_funcs->pptable_source_init)
+ smu->ppt_funcs->pptable_source_init(smu);
+
+ /* override pptable_id from driver parameter */
+ if (amdgpu_smu_pptable_id >= 0) {
+ dev_info(smu->adev->dev, "override pptable id %d\n", amdgpu_smu_pptable_id);
+ smu->pptable_id = amdgpu_smu_pptable_id;
+ smu->pptable_source = PPTABLE_SOURCE_INTERNAL_HARDCOPY;
+ }
+}
+
static int smu_sw_init(void *handle)
{
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -1085,6 +1114,8 @@ static int smu_sw_init(void *handle)
return ret;
}
+ smu_pptable_source_init(smu);
+
ret = smu_init_pptable_microcode(smu);
if (ret) {
dev_err(adev->dev, "Failed to setup pptable firmware!\n");
diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h
index e2fa3b066b96..daa6be72bf00 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h
+++ b/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h
@@ -477,6 +477,12 @@ struct stb_context {
#define WORKLOAD_POLICY_MAX 7
+enum smu_pptable_source {
+ PPTABLE_SOURCE_VBIOS,
+ PPTABLE_SOURCE_PMFW,
+ PPTABLE_SOURCE_INTERNAL_HARDCOPY,
+};
+
struct smu_context
{
struct amdgpu_device *adev;
@@ -568,6 +574,9 @@ struct smu_context
u32 param_reg;
u32 msg_reg;
u32 resp_reg;
+
+ enum smu_pptable_source pptable_source;
+ int pptable_id;
};
struct i2c_adapter;
@@ -1335,6 +1344,11 @@ struct pptable_funcs {
* @init_pptable_microcode: Prepare the pptable microcode to upload via PSP
*/
int (*init_pptable_microcode)(struct smu_context *smu);
+
+ /**
+ * @pptable_source_init: Get the smu->pptable_source/pptable_id settings
+ */
+ void (*pptable_source_init)(struct smu_context *smu);
};
typedef enum {
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
index 53d26bca524a..e5d742c85416 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
@@ -196,7 +196,7 @@ int smu_v13_0_init_pptable_microcode(struct smu_context *smu)
{
struct amdgpu_device *adev = smu->adev;
struct amdgpu_firmware_info *ucode = NULL;
- uint32_t size = 0, pptable_id = 0;
+ uint32_t size = 0;
int ret = 0;
void *table;
@@ -210,23 +210,10 @@ int smu_v13_0_init_pptable_microcode(struct smu_context *smu)
if (!adev->scpm_enabled)
return 0;
- if ((adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 7)) ||
- (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 0)))
+ if (smu->pptable_source != PPTABLE_SOURCE_INTERNAL_HARDCOPY)
return 0;
- /* override pptable_id from driver parameter */
- if (amdgpu_smu_pptable_id >= 0) {
- pptable_id = amdgpu_smu_pptable_id;
- dev_info(adev->dev, "override pptable id %d\n", pptable_id);
- } else {
- pptable_id = smu->smu_table.boot_values.pp_table_id;
- }
-
- /* "pptable_id == 0" means vbios carries the pptable. */
- if (!pptable_id)
- return 0;
-
- ret = smu_v13_0_get_pptable_from_firmware(smu, &table, &size, pptable_id);
+ ret = smu_v13_0_get_pptable_from_firmware(smu, &table, &size, smu->pptable_id);
if (ret)
return ret;
@@ -443,28 +430,23 @@ int smu_v13_0_get_pptable_from_firmware(struct smu_context *smu,
int smu_v13_0_setup_pptable(struct smu_context *smu)
{
- struct amdgpu_device *adev = smu->adev;
- uint32_t size = 0, pptable_id = 0;
+ uint32_t pptable_id = smu->pptable_id;
+ uint32_t size = 0;
void *table;
int ret = 0;
- /* override pptable_id from driver parameter */
- if (amdgpu_smu_pptable_id >= 0) {
- pptable_id = amdgpu_smu_pptable_id;
- dev_info(adev->dev, "override pptable id %d\n", pptable_id);
- } else {
- pptable_id = smu->smu_table.boot_values.pp_table_id;
-
- if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 10))
- pptable_id = 6666;
- }
-
- /* force using vbios pptable in sriov mode */
- if ((amdgpu_sriov_vf(adev) || !pptable_id) && (amdgpu_emu_mode != 1))
+ switch (smu->pptable_source) {
+ case PPTABLE_SOURCE_VBIOS:
ret = smu_v13_0_get_pptable_from_vbios(smu, &table, &size);
- else
+ break;
+ case PPTABLE_SOURCE_INTERNAL_HARDCOPY:
ret = smu_v13_0_get_pptable_from_firmware(smu, &table, &size, pptable_id);
-
+ break;
+ case PPTABLE_SOURCE_PMFW:
+ default:
+ ret = -EINVAL;
+ break;
+ }
if (ret)
return ret;
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH V2 4/7] drm/amd/pm: move SMU13.0.0 related pptable settings to smu_v13_0_0_ppt.c
2022-09-19 2:02 [PATCH V2 1/7] drm/amd/pm: add support for 3794 pptable for SMU13.0.0 Evan Quan
2022-09-19 2:02 ` [PATCH V2 2/7] drm/amd/pm: drop the pptable related workarounds for SMU 13.0.0 Evan Quan
2022-09-19 2:02 ` [PATCH V2 3/7] drm/amd/pm: revise the implementations for pptable retrieving Evan Quan
@ 2022-09-19 2:02 ` Evan Quan
2022-09-19 13:48 ` Alex Deucher
2022-09-19 2:02 ` [PATCH V2 5/7] drm/amd/pm: move SMU13.0.7 related pptable settings to smu_v13_0_7_ppt.c Evan Quan
` (4 subsequent siblings)
7 siblings, 1 reply; 13+ messages in thread
From: Evan Quan @ 2022-09-19 2:02 UTC (permalink / raw)
To: amd-gfx; +Cc: Alexander.Deucher, Evan Quan, guchun.chen
Separate those ASIC specific settings from common helpers.
Signed-off-by: Evan Quan <evan.quan@amd.com>
Change-Id: Ie3224b8719d48c6e6936b738df379959bd1df4ad
---
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 1 -
.../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 16 +++++++++++++---
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index 610f9b68ef73..7adbdd3cc13b 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
@@ -1027,7 +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, 0):
case IP_VERSION(13, 0, 7):
smu->pptable_source = PPTABLE_SOURCE_PMFW;
smu->pptable_id = smu->smu_table.boot_values.pp_table_id;
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
index 1d454485e0d9..fd405e2420cd 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
@@ -377,9 +377,12 @@ static int smu_v13_0_0_setup_pptable(struct smu_context *smu)
struct amdgpu_device *adev = smu->adev;
int ret = 0;
- ret = smu_v13_0_0_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_0_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;
@@ -1753,6 +1756,12 @@ static int smu_v13_0_0_set_mp1_state(struct smu_context *smu,
return ret;
}
+static void smu_v13_0_0_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_0_ppt_funcs = {
.get_allowed_feature_mask = smu_v13_0_0_get_allowed_feature_mask,
.set_default_dpm_table = smu_v13_0_0_set_default_dpm_table,
@@ -1822,6 +1831,7 @@ static const struct pptable_funcs smu_v13_0_0_ppt_funcs = {
.mode1_reset_is_support = smu_v13_0_0_is_mode1_reset_supported,
.mode1_reset = smu_v13_0_mode1_reset,
.set_mp1_state = smu_v13_0_0_set_mp1_state,
+ .pptable_source_init = smu_v13_0_0_pptable_source_init,
};
void smu_v13_0_0_set_ppt_funcs(struct smu_context *smu)
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH V2 5/7] drm/amd/pm: move SMU13.0.7 related pptable settings to smu_v13_0_7_ppt.c
2022-09-19 2:02 [PATCH V2 1/7] drm/amd/pm: add support for 3794 pptable for SMU13.0.0 Evan Quan
` (2 preceding siblings ...)
2022-09-19 2:02 ` [PATCH V2 4/7] drm/amd/pm: move SMU13.0.0 related pptable settings to smu_v13_0_0_ppt.c Evan Quan
@ 2022-09-19 2:02 ` Evan Quan
2022-09-19 2:02 ` [PATCH V2 6/7] drm/amd/pm: move SMU13.0.10 related pptable settings to smu_v13_0_0_ppt.c Evan Quan
` (3 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Evan Quan @ 2022-09-19 2:02 UTC (permalink / raw)
To: amd-gfx; +Cc: Alexander.Deucher, Evan Quan, guchun.chen
Separate those ASIC specific settings from common helpers.
Signed-off-by: Evan Quan <evan.quan@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
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH V2 6/7] drm/amd/pm: move SMU13.0.10 related pptable settings to smu_v13_0_0_ppt.c
2022-09-19 2:02 [PATCH V2 1/7] drm/amd/pm: add support for 3794 pptable for SMU13.0.0 Evan Quan
` (3 preceding siblings ...)
2022-09-19 2:02 ` [PATCH V2 5/7] drm/amd/pm: move SMU13.0.7 related pptable settings to smu_v13_0_7_ppt.c Evan Quan
@ 2022-09-19 2:02 ` Evan Quan
2022-09-19 2:02 ` [PATCH V2 7/7] drm/amd/pm: revise SMU11 pptable setup Evan Quan
` (2 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Evan Quan @ 2022-09-19 2:02 UTC (permalink / raw)
To: amd-gfx; +Cc: Alexander.Deucher, Evan Quan, guchun.chen
SMU13.0.10 shares the same implementation with SMU13.0.0.
Signed-off-by: Evan Quan <evan.quan@amd.com>
Change-Id: Ic3720ee8fd05f75f39e4e9242fc4c57d92efd6b2
---
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 12 ++----------
.../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 14 ++++++++++++--
2 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index 24be318adf7a..1c354321630a 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
@@ -1026,16 +1026,8 @@ 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, 10):
- smu->pptable_source = PPTABLE_SOURCE_INTERNAL_HARDCOPY;
- smu->pptable_id = 6666;
- break;
- default:
- smu->pptable_source = PPTABLE_SOURCE_VBIOS;
- smu->pptable_id = smu->smu_table.boot_values.pp_table_id;
- break;
- }
+ smu->pptable_source = PPTABLE_SOURCE_VBIOS;
+ smu->pptable_id = smu->smu_table.boot_values.pp_table_id;
if (smu->ppt_funcs && smu->ppt_funcs->pptable_source_init)
smu->ppt_funcs->pptable_source_init(smu);
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
index fd405e2420cd..18b02b99ee95 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
@@ -1758,8 +1758,18 @@ static int smu_v13_0_0_set_mp1_state(struct smu_context *smu,
static void smu_v13_0_0_pptable_source_init(struct smu_context *smu)
{
- smu->pptable_source = PPTABLE_SOURCE_PMFW;
- smu->pptable_id = smu->smu_table.boot_values.pp_table_id;
+ switch (smu->adev->ip_versions[MP1_HWIP][0]) {
+ case IP_VERSION(13, 0, 0):
+ 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;
+ break;
+ default:
+ break;
+ }
}
static const struct pptable_funcs smu_v13_0_0_ppt_funcs = {
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH V2 7/7] drm/amd/pm: revise SMU11 pptable setup
2022-09-19 2:02 [PATCH V2 1/7] drm/amd/pm: add support for 3794 pptable for SMU13.0.0 Evan Quan
` (4 preceding siblings ...)
2022-09-19 2:02 ` [PATCH V2 6/7] drm/amd/pm: move SMU13.0.10 related pptable settings to smu_v13_0_0_ppt.c Evan Quan
@ 2022-09-19 2:02 ` Evan Quan
2022-09-19 3:17 ` [PATCH V2 1/7] drm/amd/pm: add support for 3794 pptable for SMU13.0.0 Chen, Guchun
2022-09-20 3:42 ` Lazar, Lijo
7 siblings, 0 replies; 13+ messages in thread
From: Evan Quan @ 2022-09-19 2:02 UTC (permalink / raw)
To: amd-gfx; +Cc: Alexander.Deucher, Evan Quan, guchun.chen
Make the code more readable and scalable.
Signed-off-by: Evan Quan <evan.quan@amd.com>
Change-Id: Ie4e5dd7b409acf91cc41ea59c00dcfe58e291e80
---
drivers/gpu/drm/amd/pm/swsmu/inc/smu_v11_0.h | 1 +
.../gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c | 1 +
.../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 1 +
.../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 1 +
.../gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 73 ++++++++++++-------
5 files changed, 49 insertions(+), 28 deletions(-)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/smu_v11_0.h b/drivers/gpu/drm/amd/pm/swsmu/inc/smu_v11_0.h
index a9215494dcdd..256641c650ab 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/inc/smu_v11_0.h
+++ b/drivers/gpu/drm/amd/pm/swsmu/inc/smu_v11_0.h
@@ -318,5 +318,6 @@ int smu_v11_0_restore_user_od_settings(struct smu_context *smu);
void smu_v11_0_set_smu_mailbox_registers(struct smu_context *smu);
+void smu_v11_0_pptable_source_init(struct smu_context *smu);
#endif
#endif
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c
index 445005571f76..d691b64577af 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c
@@ -2499,6 +2499,7 @@ static const struct pptable_funcs arcturus_ppt_funcs = {
.interrupt_work = smu_v11_0_interrupt_work,
.smu_handle_passthrough_sbr = smu_v11_0_handle_passthrough_sbr,
.set_mp1_state = smu_cmn_set_mp1_state,
+ .pptable_source_init = smu_v11_0_pptable_source_init,
};
void arcturus_set_ppt_funcs(struct smu_context *smu)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
index 0bcd4fe0ef17..0d48258fc50f 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
@@ -3569,6 +3569,7 @@ static const struct pptable_funcs navi10_ppt_funcs = {
.set_mp1_state = smu_cmn_set_mp1_state,
.get_default_config_table_settings = navi10_get_default_config_table_settings,
.set_config_table = navi10_set_config_table,
+ .pptable_source_init = smu_v11_0_pptable_source_init,
};
void navi10_set_ppt_funcs(struct smu_context *smu)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
index 74996a8fb671..f020e6b17597 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
@@ -4414,6 +4414,7 @@ static const struct pptable_funcs sienna_cichlid_ppt_funcs = {
.get_unique_id = sienna_cichlid_get_unique_id,
.mode2_reset_is_support = sienna_cichlid_is_mode2_reset_supported,
.mode2_reset = sienna_cichlid_mode2_reset,
+ .pptable_source_init = smu_v11_0_pptable_source_init,
};
void sienna_cichlid_set_ppt_funcs(struct smu_context *smu)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
index 6008450370e8..b56ef76a35f0 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
@@ -338,6 +338,15 @@ static int smu_v11_0_set_pptable_v2_1(struct smu_context *smu, void **table,
return 0;
}
+void smu_v11_0_pptable_source_init(struct smu_context *smu)
+{
+ smu->pptable_id = smu->smu_table.boot_values.pp_table_id;
+ if (smu->pptable_id && !amdgpu_sriov_vf(smu->adev))
+ smu->pptable_source = PPTABLE_SOURCE_INTERNAL_HARDCOPY;
+ else
+ smu->pptable_source = PPTABLE_SOURCE_VBIOS;
+}
+
int smu_v11_0_setup_pptable(struct smu_context *smu)
{
struct amdgpu_device *adev = smu->adev;
@@ -349,41 +358,49 @@ int smu_v11_0_setup_pptable(struct smu_context *smu)
void *table;
uint16_t version_major, version_minor;
- if (!amdgpu_sriov_vf(adev)) {
+ switch (smu->pptable_source) {
+ case PPTABLE_SOURCE_INTERNAL_HARDCOPY:
+ dev_info(adev->dev, "use driver provided pptable %d\n", smu->smu_table.boot_values.pp_table_id);
+
hdr = (const struct smc_firmware_header_v1_0 *) adev->pm.fw->data;
version_major = le16_to_cpu(hdr->header.header_version_major);
version_minor = le16_to_cpu(hdr->header.header_version_minor);
- if (version_major == 2 && smu->smu_table.boot_values.pp_table_id > 0) {
- dev_info(adev->dev, "use driver provided pptable %d\n", smu->smu_table.boot_values.pp_table_id);
- switch (version_minor) {
- case 0:
- ret = smu_v11_0_set_pptable_v2_0(smu, &table, &size);
- break;
- case 1:
- ret = smu_v11_0_set_pptable_v2_1(smu, &table, &size,
- smu->smu_table.boot_values.pp_table_id);
- break;
- default:
- ret = -EINVAL;
- break;
- }
- if (ret)
- return ret;
- goto out;
+
+ if (version_major != 2)
+ return -EINVAL;
+
+ switch (version_minor) {
+ case 0:
+ ret = smu_v11_0_set_pptable_v2_0(smu, &table, &size);
+ break;
+ case 1:
+ ret = smu_v11_0_set_pptable_v2_1(smu, &table, &size,
+ smu->smu_table.boot_values.pp_table_id);
+ break;
+ default:
+ ret = -EINVAL;
+ break;
}
- }
+ if (ret)
+ return ret;
+ break;
- dev_info(adev->dev, "use vbios provided pptable\n");
- index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
- powerplayinfo);
+ case PPTABLE_SOURCE_VBIOS:
+ dev_info(adev->dev, "use vbios provided pptable\n");
- ret = amdgpu_atombios_get_data_table(adev, index, &atom_table_size, &frev, &crev,
- (uint8_t **)&table);
- if (ret)
- return ret;
- size = atom_table_size;
+ index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
+ powerplayinfo);
+ ret = amdgpu_atombios_get_data_table(adev, index, &atom_table_size, &frev, &crev,
+ (uint8_t **)&table);
+ if (ret)
+ return ret;
+ size = atom_table_size;
+ break;
+
+ default:
+ return -EINVAL;
+ }
-out:
if (!smu->smu_table.power_play_table)
smu->smu_table.power_play_table = table;
if (!smu->smu_table.power_play_table_size)
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* RE: [PATCH V2 1/7] drm/amd/pm: add support for 3794 pptable for SMU13.0.0
2022-09-19 2:02 [PATCH V2 1/7] drm/amd/pm: add support for 3794 pptable for SMU13.0.0 Evan Quan
` (5 preceding siblings ...)
2022-09-19 2:02 ` [PATCH V2 7/7] drm/amd/pm: revise SMU11 pptable setup Evan Quan
@ 2022-09-19 3:17 ` Chen, Guchun
2022-09-20 3:42 ` Lazar, Lijo
7 siblings, 0 replies; 13+ messages in thread
From: Chen, Guchun @ 2022-09-19 3:17 UTC (permalink / raw)
To: Quan, Evan, amd-gfx; +Cc: Deucher, Alexander
Acked-by: Guchun Chen <guchun.chen@amd.com> for this series.
Regards,
Guchun
-----Original Message-----
From: Quan, Evan <Evan.Quan@amd.com>
Sent: Monday, September 19, 2022 10:03 AM
To: amd-gfx@lists.freedesktop.org
Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; Chen, Guchun <Guchun.Chen@amd.com>; Quan, Evan <Evan.Quan@amd.com>
Subject: [PATCH V2 1/7] drm/amd/pm: add support for 3794 pptable for SMU13.0.0
Enable 3794 pptable support for SMU13.0.0.
Signed-off-by: Evan Quan <evan.quan@amd.com>
Change-Id: Ia208531c9eb96611b6136975bcbd8d27007b9e14
---
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
index de779f8089d3..a6b7319fbfe6 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
@@ -406,6 +406,7 @@ static int smu_v13_0_0_setup_pptable(struct smu_context *smu)
case 3664:
case 3715:
case 3795:
+ case 3794:
pptable_id = 0;
break;
case 3683:
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH V2 4/7] drm/amd/pm: move SMU13.0.0 related pptable settings to smu_v13_0_0_ppt.c
2022-09-19 2:02 ` [PATCH V2 4/7] drm/amd/pm: move SMU13.0.0 related pptable settings to smu_v13_0_0_ppt.c Evan Quan
@ 2022-09-19 13:48 ` Alex Deucher
2022-09-19 14:09 ` Alex Deucher
0 siblings, 1 reply; 13+ messages in thread
From: Alex Deucher @ 2022-09-19 13:48 UTC (permalink / raw)
To: Evan Quan; +Cc: Alexander.Deucher, guchun.chen, amd-gfx
On Sun, Sep 18, 2022 at 10:04 PM Evan Quan <evan.quan@amd.com> wrote:
>
> Separate those ASIC specific settings from common helpers.
>
> Signed-off-by: Evan Quan <evan.quan@amd.com>
> Change-Id: Ie3224b8719d48c6e6936b738df379959bd1df4ad
> ---
> drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 1 -
> .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 16 +++++++++++++---
> 2 files changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> index 610f9b68ef73..7adbdd3cc13b 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> @@ -1027,7 +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, 0):
Is this change intended?
Alex
> case IP_VERSION(13, 0, 7):
> smu->pptable_source = PPTABLE_SOURCE_PMFW;
> smu->pptable_id = smu->smu_table.boot_values.pp_table_id;
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
> index 1d454485e0d9..fd405e2420cd 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
> @@ -377,9 +377,12 @@ static int smu_v13_0_0_setup_pptable(struct smu_context *smu)
> struct amdgpu_device *adev = smu->adev;
> int ret = 0;
>
> - ret = smu_v13_0_0_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_0_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;
>
> @@ -1753,6 +1756,12 @@ static int smu_v13_0_0_set_mp1_state(struct smu_context *smu,
> return ret;
> }
>
> +static void smu_v13_0_0_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_0_ppt_funcs = {
> .get_allowed_feature_mask = smu_v13_0_0_get_allowed_feature_mask,
> .set_default_dpm_table = smu_v13_0_0_set_default_dpm_table,
> @@ -1822,6 +1831,7 @@ static const struct pptable_funcs smu_v13_0_0_ppt_funcs = {
> .mode1_reset_is_support = smu_v13_0_0_is_mode1_reset_supported,
> .mode1_reset = smu_v13_0_mode1_reset,
> .set_mp1_state = smu_v13_0_0_set_mp1_state,
> + .pptable_source_init = smu_v13_0_0_pptable_source_init,
> };
>
> void smu_v13_0_0_set_ppt_funcs(struct smu_context *smu)
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH V2 4/7] drm/amd/pm: move SMU13.0.0 related pptable settings to smu_v13_0_0_ppt.c
2022-09-19 13:48 ` Alex Deucher
@ 2022-09-19 14:09 ` Alex Deucher
0 siblings, 0 replies; 13+ messages in thread
From: Alex Deucher @ 2022-09-19 14:09 UTC (permalink / raw)
To: Evan Quan; +Cc: Alexander.Deucher, guchun.chen, amd-gfx
On Mon, Sep 19, 2022 at 9:48 AM Alex Deucher <alexdeucher@gmail.com> wrote:
>
> On Sun, Sep 18, 2022 at 10:04 PM Evan Quan <evan.quan@amd.com> wrote:
> >
> > Separate those ASIC specific settings from common helpers.
> >
> > Signed-off-by: Evan Quan <evan.quan@amd.com>
> > Change-Id: Ie3224b8719d48c6e6936b738df379959bd1df4ad
> > ---
> > drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 1 -
> > .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 16 +++++++++++++---
> > 2 files changed, 13 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> > index 610f9b68ef73..7adbdd3cc13b 100644
> > --- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> > +++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> > @@ -1027,7 +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, 0):
>
> Is this change intended?
Nevermind, I missed your response on the original thread.
Alex
>
> Alex
>
> > case IP_VERSION(13, 0, 7):
> > smu->pptable_source = PPTABLE_SOURCE_PMFW;
> > smu->pptable_id = smu->smu_table.boot_values.pp_table_id;
> > diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
> > index 1d454485e0d9..fd405e2420cd 100644
> > --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
> > +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
> > @@ -377,9 +377,12 @@ static int smu_v13_0_0_setup_pptable(struct smu_context *smu)
> > struct amdgpu_device *adev = smu->adev;
> > int ret = 0;
> >
> > - ret = smu_v13_0_0_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_0_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;
> >
> > @@ -1753,6 +1756,12 @@ static int smu_v13_0_0_set_mp1_state(struct smu_context *smu,
> > return ret;
> > }
> >
> > +static void smu_v13_0_0_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_0_ppt_funcs = {
> > .get_allowed_feature_mask = smu_v13_0_0_get_allowed_feature_mask,
> > .set_default_dpm_table = smu_v13_0_0_set_default_dpm_table,
> > @@ -1822,6 +1831,7 @@ static const struct pptable_funcs smu_v13_0_0_ppt_funcs = {
> > .mode1_reset_is_support = smu_v13_0_0_is_mode1_reset_supported,
> > .mode1_reset = smu_v13_0_mode1_reset,
> > .set_mp1_state = smu_v13_0_0_set_mp1_state,
> > + .pptable_source_init = smu_v13_0_0_pptable_source_init,
> > };
> >
> > void smu_v13_0_0_set_ppt_funcs(struct smu_context *smu)
> > --
> > 2.34.1
> >
^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: [PATCH V2 2/7] drm/amd/pm: drop the pptable related workarounds for SMU 13.0.0
2022-09-19 2:02 ` [PATCH V2 2/7] drm/amd/pm: drop the pptable related workarounds for SMU 13.0.0 Evan Quan
@ 2022-09-20 1:04 ` Quan, Evan
2022-09-20 3:42 ` Lazar, Lijo
1 sibling, 0 replies; 13+ messages in thread
From: Quan, Evan @ 2022-09-20 1:04 UTC (permalink / raw)
To: amd-gfx, Deucher, Alexander, Lazar, Lijo; +Cc: Chen, Guchun
[AMD Official Use Only - General]
@Deucher, Alexander @Lazar, Lijo Can I have your RB for the first two patches of this series? I know there is some arguments for other patches.
As that(missing of the first two patches) is gating the integration of the new IFWIs for SMU13.0.0 ASIC.
BR
Evan
> -----Original Message-----
> From: Quan, Evan <Evan.Quan@amd.com>
> Sent: Monday, September 19, 2022 10:03 AM
> To: amd-gfx@lists.freedesktop.org
> Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; Chen, Guchun
> <Guchun.Chen@amd.com>; Quan, Evan <Evan.Quan@amd.com>
> Subject: [PATCH V2 2/7] drm/amd/pm: drop the pptable related
> workarounds for SMU 13.0.0
>
> The pptable in the vbios is fully ready. The related workarounds in driver are
> not needed any more.
>
> Signed-off-by: Evan Quan <evan.quan@amd.com>
> Change-Id: I2549cd1acd6eebde361ed8e27d5631bd57644e52
> --
> v1->v2:
> - drop unrelated and unnecessary changes(Alex, Guchun)
> ---
> .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 46 ++--------------
> .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 54 ++-----------------
> 2 files changed, 6 insertions(+), 94 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
> b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
> index 4fd685af8fa4..53d26bca524a 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
> @@ -210,7 +210,8 @@ int smu_v13_0_init_pptable_microcode(struct
> smu_context *smu)
> if (!adev->scpm_enabled)
> return 0;
>
> - if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 7))
> + if ((adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 7)) ||
> + (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 0)))
> return 0;
>
> /* override pptable_id from driver parameter */ @@ -219,27 +220,6
> @@ int smu_v13_0_init_pptable_microcode(struct smu_context *smu)
> dev_info(adev->dev, "override pptable id %d\n",
> pptable_id);
> } else {
> pptable_id = smu->smu_table.boot_values.pp_table_id;
> -
> - /*
> - * Temporary solution for SMU V13.0.0 with SCPM enabled:
> - * - use vbios carried pptable when pptable_id is 3664, 3715
> or 3795
> - * - use 36831 soft pptable when pptable_id is 3683
> - */
> - if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0,
> 0)) {
> - switch (pptable_id) {
> - case 3664:
> - case 3715:
> - case 3795:
> - pptable_id = 0;
> - break;
> - case 3683:
> - pptable_id = 36831;
> - break;
> - default:
> - dev_err(adev->dev, "Unsupported pptable
> id %d\n", pptable_id);
> - return -EINVAL;
> - }
> - }
> }
>
> /* "pptable_id == 0" means vbios carries the pptable. */ @@ -475,28
> +455,8 @@ int smu_v13_0_setup_pptable(struct smu_context *smu)
> } else {
> pptable_id = smu->smu_table.boot_values.pp_table_id;
>
> - /*
> - * Temporary solution for SMU V13.0.0 with SCPM disabled:
> - * - use 3664, 3683 or 3715 on request
> - * - use 3664 when pptable_id is 0
> - * TODO: drop these when the pptable carried in vbios is
> ready.
> - */
> - if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0,
> 0)) {
> - switch (pptable_id) {
> - case 0:
> - pptable_id = 3664;
> - break;
> - case 3664:
> - case 3683:
> - case 3715:
> - break;
> - default:
> - dev_err(adev->dev, "Unsupported pptable
> id %d\n", pptable_id);
> - return -EINVAL;
> - }
> - } else if (adev->ip_versions[MP1_HWIP][0] ==
> IP_VERSION(13, 0, 10)) {
> + if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0,
> 10))
> pptable_id = 6666;
> - }
> }
>
> /* force using vbios pptable in sriov mode */ diff --git
> a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
> b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
> index a6b7319fbfe6..1d454485e0d9 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
> @@ -375,59 +375,11 @@ static int smu_v13_0_0_setup_pptable(struct
> smu_context *smu) {
> struct smu_table_context *smu_table = &smu->smu_table;
> struct amdgpu_device *adev = smu->adev;
> - uint32_t pptable_id;
> 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).
> - */
> - if (adev->scpm_enabled) {
> - ret = smu_v13_0_0_get_pptable_from_pmfw(smu,
> - &smu_table-
> >power_play_table,
> - &smu_table-
> >power_play_table_size);
> - } else {
> - /* override pptable_id from driver parameter */
> - if (amdgpu_smu_pptable_id >= 0) {
> - pptable_id = amdgpu_smu_pptable_id;
> - dev_info(adev->dev, "override pptable id %d\n",
> pptable_id);
> - } else {
> - pptable_id = smu_table->boot_values.pp_table_id;
> - }
> -
> - /*
> - * Temporary solution for SMU V13.0.0 with SCPM disabled:
> - * - use vbios carried pptable when pptable_id is 3664, 3715
> or 3795
> - * - use soft pptable when pptable_id is 3683
> - */
> - if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0,
> 0)) {
> - switch (pptable_id) {
> - case 3664:
> - case 3715:
> - case 3795:
> - case 3794:
> - pptable_id = 0;
> - break;
> - case 3683:
> - break;
> - default:
> - dev_err(adev->dev, "Unsupported pptable
> id %d\n", pptable_id);
> - return -EINVAL;
> - }
> - }
> -
> - /* force using vbios pptable in sriov mode */
> - if ((amdgpu_sriov_vf(adev) || !pptable_id) &&
> (amdgpu_emu_mode != 1))
> - ret = smu_v13_0_0_get_pptable_from_pmfw(smu,
> - &smu_table-
> >power_play_table,
> - &smu_table-
> >power_play_table_size);
> - else
> - ret = smu_v13_0_get_pptable_from_firmware(smu,
> - &smu_table-
> >power_play_table,
> - &smu_table-
> >power_play_table_size,
> - pptable_id);
> - }
> + ret = smu_v13_0_0_get_pptable_from_pmfw(smu,
> + &smu_table-
> >power_play_table,
> + &smu_table-
> >power_play_table_size);
> if (ret)
> return ret;
>
> --
> 2.34.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH V2 1/7] drm/amd/pm: add support for 3794 pptable for SMU13.0.0
2022-09-19 2:02 [PATCH V2 1/7] drm/amd/pm: add support for 3794 pptable for SMU13.0.0 Evan Quan
` (6 preceding siblings ...)
2022-09-19 3:17 ` [PATCH V2 1/7] drm/amd/pm: add support for 3794 pptable for SMU13.0.0 Chen, Guchun
@ 2022-09-20 3:42 ` Lazar, Lijo
7 siblings, 0 replies; 13+ messages in thread
From: Lazar, Lijo @ 2022-09-20 3:42 UTC (permalink / raw)
To: Evan Quan, amd-gfx; +Cc: Alexander.Deucher, guchun.chen
On 9/19/2022 7:32 AM, Evan Quan wrote:
> Enable 3794 pptable support for SMU13.0.0.
>
> Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Thanks,
Lijo
> Change-Id: Ia208531c9eb96611b6136975bcbd8d27007b9e14
> ---
> drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
> index de779f8089d3..a6b7319fbfe6 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
> @@ -406,6 +406,7 @@ static int smu_v13_0_0_setup_pptable(struct smu_context *smu)
> case 3664:
> case 3715:
> case 3795:
> + case 3794:
> pptable_id = 0;
> break;
> case 3683:
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH V2 2/7] drm/amd/pm: drop the pptable related workarounds for SMU 13.0.0
2022-09-19 2:02 ` [PATCH V2 2/7] drm/amd/pm: drop the pptable related workarounds for SMU 13.0.0 Evan Quan
2022-09-20 1:04 ` Quan, Evan
@ 2022-09-20 3:42 ` Lazar, Lijo
1 sibling, 0 replies; 13+ messages in thread
From: Lazar, Lijo @ 2022-09-20 3:42 UTC (permalink / raw)
To: Evan Quan, amd-gfx; +Cc: Alexander.Deucher, guchun.chen
On 9/19/2022 7:32 AM, Evan Quan wrote:
> The pptable in the vbios is fully ready. The related workarounds
> in driver are not needed any more.
>
> Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Thanks,
Lijo
> Change-Id: I2549cd1acd6eebde361ed8e27d5631bd57644e52
> --
> v1->v2:
> - drop unrelated and unnecessary changes(Alex, Guchun)
> ---
> .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 46 ++--------------
> .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 54 ++-----------------
> 2 files changed, 6 insertions(+), 94 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
> index 4fd685af8fa4..53d26bca524a 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
> @@ -210,7 +210,8 @@ int smu_v13_0_init_pptable_microcode(struct smu_context *smu)
> if (!adev->scpm_enabled)
> return 0;
>
> - if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 7))
> + if ((adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 7)) ||
> + (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 0)))
> return 0;
>
> /* override pptable_id from driver parameter */
> @@ -219,27 +220,6 @@ int smu_v13_0_init_pptable_microcode(struct smu_context *smu)
> dev_info(adev->dev, "override pptable id %d\n", pptable_id);
> } else {
> pptable_id = smu->smu_table.boot_values.pp_table_id;
> -
> - /*
> - * Temporary solution for SMU V13.0.0 with SCPM enabled:
> - * - use vbios carried pptable when pptable_id is 3664, 3715 or 3795
> - * - use 36831 soft pptable when pptable_id is 3683
> - */
> - if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 0)) {
> - switch (pptable_id) {
> - case 3664:
> - case 3715:
> - case 3795:
> - pptable_id = 0;
> - break;
> - case 3683:
> - pptable_id = 36831;
> - break;
> - default:
> - dev_err(adev->dev, "Unsupported pptable id %d\n", pptable_id);
> - return -EINVAL;
> - }
> - }
> }
>
> /* "pptable_id == 0" means vbios carries the pptable. */
> @@ -475,28 +455,8 @@ int smu_v13_0_setup_pptable(struct smu_context *smu)
> } else {
> pptable_id = smu->smu_table.boot_values.pp_table_id;
>
> - /*
> - * Temporary solution for SMU V13.0.0 with SCPM disabled:
> - * - use 3664, 3683 or 3715 on request
> - * - use 3664 when pptable_id is 0
> - * TODO: drop these when the pptable carried in vbios is ready.
> - */
> - if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 0)) {
> - switch (pptable_id) {
> - case 0:
> - pptable_id = 3664;
> - break;
> - case 3664:
> - case 3683:
> - case 3715:
> - break;
> - default:
> - dev_err(adev->dev, "Unsupported pptable id %d\n", pptable_id);
> - return -EINVAL;
> - }
> - } else if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 10)) {
> + if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 10))
> pptable_id = 6666;
> - }
> }
>
> /* force using vbios pptable in sriov mode */
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
> index a6b7319fbfe6..1d454485e0d9 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
> @@ -375,59 +375,11 @@ static int smu_v13_0_0_setup_pptable(struct smu_context *smu)
> {
> struct smu_table_context *smu_table = &smu->smu_table;
> struct amdgpu_device *adev = smu->adev;
> - uint32_t pptable_id;
> 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).
> - */
> - if (adev->scpm_enabled) {
> - ret = smu_v13_0_0_get_pptable_from_pmfw(smu,
> - &smu_table->power_play_table,
> - &smu_table->power_play_table_size);
> - } else {
> - /* override pptable_id from driver parameter */
> - if (amdgpu_smu_pptable_id >= 0) {
> - pptable_id = amdgpu_smu_pptable_id;
> - dev_info(adev->dev, "override pptable id %d\n", pptable_id);
> - } else {
> - pptable_id = smu_table->boot_values.pp_table_id;
> - }
> -
> - /*
> - * Temporary solution for SMU V13.0.0 with SCPM disabled:
> - * - use vbios carried pptable when pptable_id is 3664, 3715 or 3795
> - * - use soft pptable when pptable_id is 3683
> - */
> - if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 0)) {
> - switch (pptable_id) {
> - case 3664:
> - case 3715:
> - case 3795:
> - case 3794:
> - pptable_id = 0;
> - break;
> - case 3683:
> - break;
> - default:
> - dev_err(adev->dev, "Unsupported pptable id %d\n", pptable_id);
> - return -EINVAL;
> - }
> - }
> -
> - /* force using vbios pptable in sriov mode */
> - if ((amdgpu_sriov_vf(adev) || !pptable_id) && (amdgpu_emu_mode != 1))
> - ret = smu_v13_0_0_get_pptable_from_pmfw(smu,
> - &smu_table->power_play_table,
> - &smu_table->power_play_table_size);
> - else
> - ret = smu_v13_0_get_pptable_from_firmware(smu,
> - &smu_table->power_play_table,
> - &smu_table->power_play_table_size,
> - pptable_id);
> - }
> + ret = smu_v13_0_0_get_pptable_from_pmfw(smu,
> + &smu_table->power_play_table,
> + &smu_table->power_play_table_size);
> if (ret)
> return ret;
>
>
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2022-09-20 3:43 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-19 2:02 [PATCH V2 1/7] drm/amd/pm: add support for 3794 pptable for SMU13.0.0 Evan Quan
2022-09-19 2:02 ` [PATCH V2 2/7] drm/amd/pm: drop the pptable related workarounds for SMU 13.0.0 Evan Quan
2022-09-20 1:04 ` Quan, Evan
2022-09-20 3:42 ` Lazar, Lijo
2022-09-19 2:02 ` [PATCH V2 3/7] drm/amd/pm: revise the implementations for pptable retrieving Evan Quan
2022-09-19 2:02 ` [PATCH V2 4/7] drm/amd/pm: move SMU13.0.0 related pptable settings to smu_v13_0_0_ppt.c Evan Quan
2022-09-19 13:48 ` Alex Deucher
2022-09-19 14:09 ` Alex Deucher
2022-09-19 2:02 ` [PATCH V2 5/7] drm/amd/pm: move SMU13.0.7 related pptable settings to smu_v13_0_7_ppt.c Evan Quan
2022-09-19 2:02 ` [PATCH V2 6/7] drm/amd/pm: move SMU13.0.10 related pptable settings to smu_v13_0_0_ppt.c Evan Quan
2022-09-19 2:02 ` [PATCH V2 7/7] drm/amd/pm: revise SMU11 pptable setup Evan Quan
2022-09-19 3:17 ` [PATCH V2 1/7] drm/amd/pm: add support for 3794 pptable for SMU13.0.0 Chen, Guchun
2022-09-20 3:42 ` Lazar, Lijo
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.