drm/amd/pm: add support for 3794 pptable for SMU13.0.0
Subsystems (3)
PATCH v2 1/7 drm/amd/pm: add support for 3794 pptable for SMU13.0.0
Enable 3794 pptable support for SMU13.0.0.
--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +1 -0
@@ -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 :
Signature · 1 line
2.34.1
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.
--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(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +3 -43
@@ -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 */
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +3 -51
62 lines not on this page · raw message
Signature · 1 line
2.34.1
RE: [PATCH V2 2/7] drm/amd/pm: drop the pptable related workarounds for SMU 13.0.0
[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
Quoted 188 lines
-----Original Message-----
From: Quan, Evan <[email protected]>
Sent: Monday, September 19, 2022 10:03 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Chen, Guchun <[email protected]>; Quan, Evan <[email protected]>
Subject: [PATCH V2 2/7] drm/amd/pm: drop the pptable related workarounds for SMU 13.0.0The pptable in the vbios is fully ready. The related workarounds in driver are not needed any more.
Signed-off-by Evan Quan <[email protected]>Change-Id I2549cd1acd6eebde361ed8e27d5631bd57644e52--
v1->v2:
- drop unrelated and unnecessarychanges(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(-)drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +2
-1@@ -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_idfrom driver parameter */ @@ -219,27 +220,6
@@ intsmu_v13_0_init_pptable_microcode(struct smu_context *smu)
dev_info(adev->dev, "override pptable id %d\n",pptable_id);drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0
-4}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
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0
-3-* - use 36831 soft pptable when pptable_id is 3683 -*/ - if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0,0)) {
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0
-11-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 pptableid %d\n",
pptable_id);drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +1
-8-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.
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0
-2-*/ - if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0,0)) {
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0
-10-switch (pptable_id) { -case 0 : - pptable_id =3664 ; -break ; -case 3664 : -case 3683 : -case 3715 : -break ; -default : - dev_err(adev->dev, "Unsupported pptableid %d\n",
pptable_id);drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0
-3-return -EINVAL ; - } - } else if (adev->ip_versions[MP1_HWIP][0] ==
IP_VERSION(13, 0, 10)) {drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +1
-0+ if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0,10))
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0
-1pptable_id =6666 ; - } } /* force using vbios pptable in sriov mode */ diff --git
a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.cb/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.cindexa6b7319fbfe6..1d454485e0d9100644drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +0
-22@@ -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
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +0
-3-* - use soft pptable when pptable_id is 3683 -*/ - if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0,0)) {
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +0
-11-switch (pptable_id) { -case 3664 : -case 3715 : -case 3795 : -case 3794 : - pptable_id =0 ; -break ; -case 3683 : -break ; -default : - dev_err(adev->dev, "Unsupported pptableid %d\n",
pptable_id);drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +0
-6-return -EINVAL ; - } - } - -/* force using vbios pptable in sriov mode */ - if ((amdgpu_sriov_vf(adev) || !pptable_id) &&(
amdgpu_emu_mode!= 1))drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +0
-2- ret = smu_v13_0_0_get_pptable_from_pmfw(smu, - &smu_table-Quoted 1 line
power_play_table,drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +0
-1- &smu_table-Quoted 1 line
power_play_table_size);drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +0
-3-else - ret = smu_v13_0_get_pptable_from_firmware(smu, - &smu_table-Quoted 1 line
power_play_table,drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +0
-1- &smu_table-Quoted 1 line
power_play_table_size,drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +2
-2- pptable_id); - } + ret = smu_v13_0_0_get_pptable_from_pmfw(smu, + &smu_table-Quoted 1 line
power_play_table,drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +1
-0+ &smu_table-Quoted 1 line
power_play_table_size);drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +0
-1if (ret)return ret; --2.34.1
Re: [PATCH V2 2/7] drm/amd/pm: drop the pptable related workarounds for SMU 13.0.0
In reply to Evan QuanQuoted 4 lines · Evan Quan
The pptable in the vbios is fully ready. The related workarounds in driver are not needed any more.
Signed-off-by Evan Quan <[email protected]>
Thanks,
Lijo
Quoted 149 lines
Change-Id: I2549cd1acd6eebde361ed8e27d5631bd57644e52 --
v1->v2:
- drop unrelated and unnecessarychanges(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(-)drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +3
-43@@ -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 */ drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +3
-51@@ -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;
PATCH v2 3/7 drm/amd/pm: revise the implementations for pptable retrieving
In reply to Evan QuanAdd a new member to flag where to get the pptable. So that, we can separate those ASIC specific ones from common helpers.
--- 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(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +31 -0
@@ -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" );
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +14 -0
@@ -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_contextu32 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 {
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +15 -33
73 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v2 4/7 drm/amd/pm: move SMU13.0.0 related pptable settings to smu_v13_0_0_ppt.c
In reply to Evan QuanSeparate those ASIC specific settings from common helpers.
--- 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(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -1
@@ -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;
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +13 -3
@@ -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)
Signature · 1 line
2.34.1
Re: [PATCH V2 4/7] drm/amd/pm: move SMU13.0.0 related pptable settings to smu_v13_0_0_ppt.c
Quoted 15 lines · Evan Quan
Separate those ASIC specific settings from common helpers.
Signed-off-by Evan Quan <[email protected]>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(-)drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0
-0
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c static void smu_interrupt_work_fn(struct work_struct *work) · line 1030
Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0
-1@@ -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
Quoted 47 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0
-0case IP_VERSION (13 ,0 ,7 ): smu->pptable_source =PPTABLE_SOURCE_PMFW ; smu->pptable_id = smu->smu_table.boot_values.pp_table_id;drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +13
-4@@ -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
Re: [PATCH V2 4/7] drm/amd/pm: move SMU13.0.0 related pptable settings to smu_v13_0_0_ppt.c
Quoted 12 lines · Alex Deucher
Quoted 10 lines · Evan Quan
Separate those ASIC specific settings from common helpers.
Signed-off-by Evan Quan <[email protected]>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(-)
Quoted 11 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c static void smu_interrupt_work_fn(struct work_struct *work) · line 1030
Quoted 9 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0
-1@@ -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
Quoted 50 lines
Alex
Quoted 47 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0
-0case IP_VERSION (13 ,0 ,7 ): smu->pptable_source =PPTABLE_SOURCE_PMFW ; smu->pptable_id = smu->smu_table.boot_values.pp_table_id;drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +13
-4@@ -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
PATCH v2 5/7 drm/amd/pm: move SMU13.0.7 related pptable settings to smu_v13_0_7_ppt.c
In reply to Evan QuanSeparate those ASIC specific settings from common helpers.
--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(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -4
@@ -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 ;
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +16 -6
@@ -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)
Signature · 1 line
2.34.1
PATCH v2 6/7 drm/amd/pm: move SMU13.0.10 related pptable settings to smu_v13_0_0_ppt.c
In reply to Evan QuanSMU13.0.10 shares the same implementation with SMU13.0.0.
--- 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(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -10
@@ -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);
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +12 -2
@@ -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 = {
Signature · 1 line
2.34.1
PATCH v2 7/7 drm/amd/pm: revise SMU11 pptable setup
In reply to Evan QuanMake the code more readable and scalable.
--- 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(-)
drivers/gpu/drm/amd/pm/swsmu/inc/smu_v11_0.h +1 -0
@@ -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
drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c +1 -0
@@ -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)
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +1 -0
@@ -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)
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1 -0
@@ -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)
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +45 -28
92 lines not on this page · raw message
Signature · 1 line
2.34.1
Regards,
Guchun
-----Original Message-----
From: Quan, Evan <[email protected]>
Sent: Monday, September 19, 2022 10:03 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Chen, Guchun <[email protected]>; Quan, Evan <[email protected]>
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.
--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +1 -0
@@ -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 :
Signature · 1 line
2.34.1
Quoted 3 lines · Evan Quan
Enable 3794 pptable support for SMU13.0.0.
Signed-off-by Evan Quan <[email protected]>
Thanks,
Lijo
Quoted 18 lines
Change-Id: Ia208531c9eb96611b6136975bcbd8d27007b9e14
--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 1 + 1 file changed, 1 insertion(+)drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +1
-0@@ -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 :