drm/amd/pm: fulfill SMU13.0.0 cstate control interface
Subsystems (3)
PATCH v3 1/3 drm/amd/pm: fulfill SMU13.0.0 cstate control interface
Fulfill the functionality for cstate control.
--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +11 -0
@@ -119,6 +119,7 @@ static struct cmn2asic_msg_mapping smu_v13_0_0_message_map[SMU_MSG_MAX_COUNT] =MSG_MAP (NotifyPowerSource, PPSMC_MSG_NotifyPowerSource,0 ),MSG_MAP (Mode1Reset, PPSMC_MSG_Mode1Reset,0 ),MSG_MAP (PrepareMp1ForUnload, PPSMC_MSG_PrepareMp1ForUnload,0 ), + MSG_MAP(DFCstateControl, PPSMC_MSG_SetExternalClientDfCstateAllow, 0), }; static struct cmn2asic_mapping smu_v13_0_0_clk_map[SMU_CLK_COUNT] = {
@@ -1753,6 +1754,15 @@ static int smu_v13_0_0_set_mp1_state(struct smu_context *smu,return ret; } +static int smu_v13_0_0_set_df_cstate (struct smu_context *smu, +enum pp_df_cstate state) +{ +return smu_cmn_send_smc_msg_with_param (smu, + SMU_MSG_DFCstateControl, + state, +NULL ); +} +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 +1832,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, + .set_df_cstate = smu_v13_0_0_set_df_cstate, };void smu_v13_0_0_set_ppt_funcs (struct smu_context *smu)
Signature · 1 line
2.34.1
PATCH v3 2/3 drm/amd/pm: fulfill SMU13.0.7 cstate control interface
Fulfill the functionality for cstate control.
--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +12 -0
@@ -121,6 +121,7 @@ static struct cmn2asic_msg_mapping smu_v13_0_7_message_map[SMU_MSG_MAX_COUNT] =MSG_MAP (Mode1Reset, PPSMC_MSG_Mode1Reset,0 ),MSG_MAP (PrepareMp1ForUnload, PPSMC_MSG_PrepareMp1ForUnload,0 ),MSG_MAP (SetMGpuFanBoostLimitRpm, PPSMC_MSG_SetMGpuFanBoostLimitRpm,0 ), + MSG_MAP(DFCstateControl, PPSMC_MSG_SetExternalClientDfCstateAllow, 0), }; static struct cmn2asic_mapping smu_v13_0_7_clk_map[SMU_CLK_COUNT] = {
@@ -1587,6 +1588,16 @@ static bool smu_v13_0_7_is_mode1_reset_supported(struct smu_context *smu)return true; } + +static int smu_v13_0_7_set_df_cstate (struct smu_context *smu, +enum pp_df_cstate state) +{ +return smu_cmn_send_smc_msg_with_param (smu, + SMU_MSG_DFCstateControl, + state, +NULL ); +} +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,
@@ -1649,6 +1660,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, + .set_df_cstate = smu_v13_0_7_set_df_cstate, };void smu_v13_0_7_set_ppt_funcs (struct smu_context *smu)
Signature · 1 line
2.34.1
PATCH v3 3/3 drm/amd/pm: disable cstate feature for gpu reset scenario
In reply to Evan QuanSuggested by PMFW team and same as what did for gfxoff feature. This can address some Mode1Reset failures observed on SMU13.0.0.
--v1->v2:
- revise the code comments(Alex)
- limit this to SMU13.0.0 and 13.0.7v2->v3:
- make this happen before display suspending
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++++++ drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c | 7 +++++++ drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 7 +++++++ 3 files changed, 22 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8 -0
@@ -2928,6 +2928,14 @@ static int amdgpu_device_ip_suspend_phase1(struct amdgpu_device *adev)amdgpu_device_set_pg_state (adev,AMD_PG_STATE_UNGATE );amdgpu_device_set_cg_state (adev,AMD_CG_STATE_UNGATE ); +/* +* Per PMFW team's suggestion, driver needs to handle gfxoff +* and df cstate features disablement for gpu reset(e.g. Mode1Reset) +* scenario. Add the missing df cstate disablement here. +*/ +if (amdgpu_dpm_set_df_cstate (adev,DF_CSTATE_DISALLOW )) +dev_warn (adev->dev,"Failed to disallow df cstate" ); +for (i = adev->num_ip_blocks -1 ; i >=0 ; i--) {if (!adev->ip_blocks[i].status.valid)continue ;
drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c +7 -0
@@ -2245,6 +2245,13 @@ static int arcturus_set_df_cstate(struct smu_context *smu,uint32_t smu_version;int ret; +/* +* Arcturus does not need the cstate disablement +* prerequisite for gpu reset. +*/ +if (amdgpu_in_reset (adev) || adev->in_suspend) +return 0 ; + ret =smu_cmn_get_smc_version (smu,NULL , &smu_version);if (ret) {dev_err (smu->adev->dev,"Failed to get smu version!\n" );
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +7 -0
@@ -1640,6 +1640,13 @@ static bool aldebaran_is_baco_supported(struct smu_context *smu)static int aldebaran_set_df_cstate (struct smu_context *smu,enum pp_df_cstate state) { +/* +* Aldebaran does not need the cstate disablement +* prerequisite for gpu reset. +*/ +if (amdgpu_in_reset (adev) || adev->in_suspend) +return 0 ; +return smu_cmn_send_smc_msg_with_param (smu, SMU_MSG_DFCstateControl, state,NULL ); }
Signature · 1 line
2.34.1
Re: [PATCH V3 3/3] drm/amd/pm: disable cstate feature for gpu reset scenario
Quoted 6 lines · Evan Quan
Suggested by PMFW team and same as what did for gfxoff feature. This can address some Mode1Reset failures observed on SMU13.0.0.
Signed-off-by Evan Quan <[email protected]>Reviewed-by Hawking Zhang <[email protected]>Change-Id Ieb4e204c49abd405b1dce559c2ff75bb3887b6f9
Quoted 6 lines
--
v1->v2:
- revise the code comments(Alex)
- limit this to SMU13.0.0 and 13.0.7v2->v3:
- make this happen before display suspending
A better thing would be do
Quoted 12 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++++++ drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c | 7 +++++++ drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 7 +++++++ 3 files changed, 22 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0@@ -2928,6 +2928,14 @@ static int amdgpu_device_ip_suspend_phase1(struct amdgpu_device *adev)amdgpu_device_set_pg_state (adev,AMD_PG_STATE_UNGATE );
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_device_ip_suspend_phase1(struct amdgpu_device *adev) · line 2938
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8
-0amdgpu_device_set_cg_state (adev,AMD_CG_STATE_UNGATE ); +/* +* Per PMFW team's suggestion, driver needs to handle gfxoff +* and df cstate features disablement for gpu reset(e.g. Mode1Reset) +* scenario. Add the missing df cstate disablement here. +*/ +if (amdgpu_dpm_set_df_cstate (adev,DF_CSTATE_DISALLOW )) +dev_warn (adev->dev,"Failed to disallow df cstate" ); +
If it's only related to display, you could move this right after below line so that headless systems don't need to take care of this. That will avoid any special handling needed for Aldebaran/Arcuturus also.
if (adev->ip_blocks[i].version->type !=
AMD_IP_BLOCK_TYPE_DCE)
continue;Thanks,
Lijo
Quoted 39 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0for (i = adev->num_ip_blocks -1 ; i >=0 ; i--) {if (!adev->ip_blocks[i].status.valid)continue ;drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c +7
-0@@ -2245,6 +2245,13 @@ static int arcturus_set_df_cstate(struct smu_context *smu,uint32_t smu_version;int ret; +/* +* Arcturus does not need the cstate disablement +* prerequisite for gpu reset. +*/ +if (amdgpu_in_reset (adev) || adev->in_suspend) +return 0 ; + ret =smu_cmn_get_smc_version (smu,NULL , &smu_version);if (ret) {dev_err (smu->adev->dev,"Failed to get smu version!\n" );drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +7
-0@@ -1640,6 +1640,13 @@ static bool aldebaran_is_baco_supported(struct smu_context *smu)static int aldebaran_set_df_cstate (struct smu_context *smu,enum pp_df_cstate state) { +/* +* Aldebaran does not need the cstate disablement +* prerequisite for gpu reset. +*/ +if (amdgpu_in_reset (adev) || adev->in_suspend) +return 0 ; +return smu_cmn_send_smc_msg_with_param (smu, SMU_MSG_DFCstateControl, state,NULL ); }
RE: [PATCH V3 3/3] drm/amd/pm: disable cstate feature for gpu reset scenario
[AMD Official Use Only - General]
Quoted 42 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Thursday, October 13, 2022 12:14 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>
Subject: Re: [PATCH V3 3/3] drm/amd/pm: disable cstate feature for gpu reset scenarioQuoted 6 lines · Evan Quan
Suggested by PMFW team and same as what did for gfxoff feature. This can address some Mode1Reset failures observed on SMU13.0.0.
Signed-off-by Evan Quan <[email protected]>Reviewed-by Hawking Zhang <[email protected]>Change-Id Ieb4e204c49abd405b1dce559c2ff75bb3887b6f9Quoted 6 lines
--
v1->v2:
- revise the code comments(Alex)
- limit this to SMU13.0.0 and 13.0.7v2->v3:
- make this happen before display suspendingA better thing would be do
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int
Quoted 12 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++++++ drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c | 7 +++++++ drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 7 +++++++ 3 files changed, 22 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0@@ -2928,6 +2928,14 @@ static int
amdgpu_device_ip_suspend_phase1(struct amdgpu_device *adev)Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0amdgpu_device_set_pg_state (adev,AMD_PG_STATE_UNGATE );amdgpu_device_set_cg_state (adev,AMD_CG_STATE_UNGATE );
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_device_ip_suspend_phase1(struct amdgpu_device *adev) · line 2938
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8
-0+/* +* Per PMFW team's suggestion, driver needs to handle gfxoff +* and df cstate features disablement for gpu reset(e.g. Mode1Reset) +* scenario. Add the missing df cstate disablement here. +*/ +if (amdgpu_dpm_set_df_cstate (adev,DF_CSTATE_DISALLOW )) +dev_warn (adev->dev,"Failed to disallow df cstate" ); +If it's only related to display, you could move this right after below line so that headless systems don't need to take care of this. That will avoid any special handling needed for Aldebaran/Arcuturus also.
[Quan, Evan] Not quite sure. I know df cstate affects DAL a lot(MALL related features). But I'm not sure whether there is other clients/IPs which are affected by df cstate. I want this(cstate disablement) performed before all 'consumers'.
BR
Evan
Quoted 53 lines
if (adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_DCE) continue;Thanks,
Lijodrivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c static int arcturus_set_df_cstate(struct
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0for (i = adev->num_ip_blocks -1 ; i >=0 ; i--) {if (!adev->ip_blocks[i].status.valid)continue ;drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c +0
-0@@ -2245,6 +2245,13 @@ static int arcturus_set_df_cstate(struct
smu_context*smu,drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c static int arcturus_set_df_cstate(struct smu_context *smu, · line 2257
Quoted 13 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c +7
-0uint32_t smu_version;int ret; +/* +* Arcturus does not need the cstate disablement +* prerequisite for gpu reset. +*/ +if (amdgpu_in_reset (adev) || adev->in_suspend) +return 0 ; + ret =smu_cmn_get_smc_version (smu,NULL , &smu_version);if (ret) {dev_err (smu->adev->dev,"Failed to get smu version!\n" );diff
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static bool aldebaran_is_baco_supported(struct
Quoted 6 lines
--git
a/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.cb/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.cindex619aee51b123..93a0f7f6a34e100644drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +0
-0@@ -1640,6 +1640,13 @@ static bool aldebaran_is_baco_supported(struct
smu_context*smu)drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static bool aldebaran_is_baco_supported(struct smu_context *smu)
Quoted 11 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +7
-0static int aldebaran_set_df_cstate (struct smu_context *smu,enum pp_df_cstate state) { +/* +* Aldebaran does not need the cstate disablement +* prerequisite for gpu reset. +*/ +if (amdgpu_in_reset (adev) || adev->in_suspend) +return 0 ; + return smu_cmn_send_smc_msg_with_param(smu,
SMU_MSG_DFCstateControl, state, NULL);Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +0
-0}
Lazar, Lijo
Reviewed-byRe: [PATCH V3 3/3] drm/amd/pm: disable cstate feature for gpu reset scenario
Quoted 58 lines · Evan
[AMD Official Use Only - General]
Quoted 42 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Thursday, October 13, 2022 12:14 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>
Subject: Re: [PATCH V3 3/3] drm/amd/pm: disable cstate feature for gpu reset scenarioQuoted 6 lines · Evan Quan
Suggested by PMFW team and same as what did for gfxoff feature. This can address some Mode1Reset failures observed on SMU13.0.0.
Signed-off-by Evan Quan <[email protected]>Reviewed-by Hawking Zhang <[email protected]>Change-Id Ieb4e204c49abd405b1dce559c2ff75bb3887b6f9Quoted 6 lines
--
v1->v2:
- revise the code comments(Alex)
- limit this to SMU13.0.0 and 13.0.7v2->v3:
- make this happen before display suspendingA better thing would be do
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int
Quoted 12 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++++++ drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c | 7 +++++++ drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 7 +++++++ 3 files changed, 22 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0@@ -2928,6 +2928,14 @@ static int
amdgpu_device_ip_suspend_phase1(struct amdgpu_device *adev)Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0amdgpu_device_set_pg_state (adev,AMD_PG_STATE_UNGATE );amdgpu_device_set_cg_state (adev,AMD_CG_STATE_UNGATE );Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_device_ip_suspend_phase1(struct amdgpu_device *adev) · line 2938
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8
-0+/* +* Per PMFW team's suggestion, driver needs to handle gfxoff +* and df cstate features disablement for gpu reset(e.g. Mode1Reset) +* scenario. Add the missing df cstate disablement here. +*/ +if (amdgpu_dpm_set_df_cstate (adev,DF_CSTATE_DISALLOW )) +dev_warn (adev->dev,"Failed to disallow df cstate" ); +If it's only related to display, you could move this right after below line so that headless systems don't need to take care of this. That will avoid any special handling needed for Aldebaran/Arcuturus also.
Quoted 4 lines
[Quan, Evan] Not quite sure. I know df cstate affects DAL a lot(MALL related features). But I'm not sure whether there is other clients/IPs which are affected by df cstate. I want this(cstate disablement) performed before all 'consumers'.
Thanks for the clarification.
Series is
Thanks,
Lijo
Quoted 55 lines
BR
EvanQuoted 53 lines
if (adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_DCE) continue;Thanks,
Lijodrivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c static int arcturus_set_df_cstate(struct
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0for (i = adev->num_ip_blocks -1 ; i >=0 ; i--) {if (!adev->ip_blocks[i].status.valid)continue ;drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c +0
-0@@ -2245,6 +2245,13 @@ static int arcturus_set_df_cstate(struct
smu_context*smu,drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c static int arcturus_set_df_cstate(struct smu_context *smu, · line 2257
Quoted 13 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c +7
-0uint32_t smu_version;int ret; +/* +* Arcturus does not need the cstate disablement +* prerequisite for gpu reset. +*/ +if (amdgpu_in_reset (adev) || adev->in_suspend) +return 0 ; + ret =smu_cmn_get_smc_version (smu,NULL , &smu_version);if (ret) {dev_err (smu->adev->dev,"Failed to get smu version!\n" );diff
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static bool aldebaran_is_baco_supported(struct
Quoted 6 lines
--git
a/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.cb/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.cindex619aee51b123..93a0f7f6a34e100644drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +0
-0@@ -1640,6 +1640,13 @@ static bool aldebaran_is_baco_supported(struct
smu_context*smu)drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static bool aldebaran_is_baco_supported(struct smu_context *smu)
Quoted 11 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +7
-0static int aldebaran_set_df_cstate (struct smu_context *smu,enum pp_df_cstate state) { +/* +* Aldebaran does not need the cstate disablement +* prerequisite for gpu reset. +*/ +if (amdgpu_in_reset (adev) || adev->in_suspend) +return 0 ; + return smu_cmn_send_smc_msg_with_param(smu,
SMU_MSG_DFCstateControl, state, NULL);Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +0
-0}