drm/amd/pm: drop the incomplete fix for Navi14 runpm issue
Subsystems (3)
PATCH v3 1/5 drm/amd/pm: drop the incomplete fix for Navi14 runpm issue
As the fix by adding PPSMC_MSG_PrepareMp1ForUnload is proved to be incomplete. Another fix(see link below) has been sent out.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 5 +--- .../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 26 +------------------ 2 files changed, 2 insertions(+), 29 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -4
@@ -2180,10 +2180,7 @@ static int psp_load_smu_fw(struct psp_context *psp)if ((amdgpu_in_reset (adev) && ras && adev->ras_enabled && (adev->asic_type ==CHIP_ARCTURUS || - adev->asic_type ==CHIP_VEGA20 )) || - (adev->in_runpm && - adev->asic_type >=CHIP_NAVI10 && - adev->asic_type <=CHIP_NAVI12 )) { + adev->asic_type ==CHIP_VEGA20 ))) { ret =amdgpu_dpm_set_mp1_state (adev,PP_MP1_STATE_UNLOAD );if (ret) {DRM_WARN ("Failed to set MP1 state prepare for reload\n" );
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +1 -25
@@ -446,30 +446,6 @@ static int navi10_store_powerplay_table(struct smu_context *smu)return 0 ; } -static int navi10_set_mp1_state (struct smu_context *smu, -enum pp_mp1_state mp1_state) -{ -struct amdgpu_device *adev = smu->adev; -uint32_t mp1_fw_flags; -int ret =0 ; - - ret =smu_cmn_set_mp1_state (smu, mp1_state); -if (ret) -return ret; - -if (mp1_state ==PP_MP1_STATE_UNLOAD ) { - mp1_fw_flags =RREG32_PCIE (MP1_Public | - (smnMP1_FIRMWARE_FLAGS &0xffffffff )); - - mp1_fw_flags &= ~MP1_FIRMWARE_FLAGS__INTERRUPTS_ENABLED_MASK ; - -WREG32_PCIE (MP1_Public | - (smnMP1_FIRMWARE_FLAGS &0xffffffff ), mp1_fw_flags); - } - -return 0 ; -} -static int navi10_setup_pptable (struct smu_context *smu) {int ret =0 ;
@@ -3122,7 +3098,7 @@ static const struct pptable_funcs navi10_ppt_funcs = { .get_fan_parameters = navi10_get_fan_parameters, .post_init = navi10_post_smu_init, .interrupt_work = smu_v11_0_interrupt_work, - .set_mp1_state = navi10_set_mp1_state, + .set_mp1_state = smu_cmn_set_mp1_state, };void navi10_set_ppt_funcs (struct smu_context *smu)
Signature · 6 lines
2.29.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH v3 2/5 drm/amd/pm: correct the runpm handling for BACO supported ASIC
Via the fSMC_MSG_ArmD3 message, PMFW can properly act on the Dstate change. Driver involvement for determining the timing for BACO enter/exit is not needed.
---V1->V2:
- limit the changes for Navi1x and Sienna_Cichlid which support the fSMC_MSG_ArmD3 message
--- drivers/gpu/drm/amd/pm/inc/smu_v11_0.h | 3 +++ .../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 27 +++++++++++++++++-- .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 27 +++++++++++++++++-- .../gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 11 ++------ 4 files changed, 55 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/pm/inc/smu_v11_0.h +3 -0
@@ -244,6 +244,9 @@ int smu_v11_0_baco_set_state(struct smu_context *smu, enum smu_baco_state state)int smu_v11_0_baco_enter (struct smu_context *smu);int smu_v11_0_baco_exit (struct smu_context *smu); +int smu_v11_0_baco_set_armd3_sequence (struct smu_context *smu, +enum smu_v11_0_baco_seq baco_seq); +int smu_v11_0_mode1_reset (struct smu_context *smu); int smu_v11_0_get_dpm_ultimate_freq(struct smu_context *smu, enum smu_clk_type clk_type,
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +25 -2
@@ -2243,6 +2243,29 @@ static int navi10_overdrive_get_gfx_clk_base_voltage(struct smu_context *smu,return 0 ; } +static int navi10_baco_enter (struct smu_context *smu) +{ +struct amdgpu_device *adev = smu->adev; + +if (adev->in_runpm) +return smu_v11_0_baco_set_armd3_sequence (smu,BACO_SEQ_BACO ); +else +return smu_v11_0_baco_enter (smu); +} + +static int navi10_baco_exit (struct smu_context *smu) +{ +struct amdgpu_device *adev = smu->adev; + +if (adev->in_runpm) { +/* Wait for PMFW handling for the Dstate change */ +msleep (10 ); +return smu_v11_0_baco_set_armd3_sequence (smu,BACO_SEQ_ULPS ); + }else { +return smu_v11_0_baco_exit (smu); + } +} +static int navi10_set_default_od_settings (struct smu_context *smu) { OverDriveTable_t *od_table =
@@ -3081,8 +3104,8 @@ static const struct pptable_funcs navi10_ppt_funcs = { .baco_is_support = smu_v11_0_baco_is_support, .baco_get_state = smu_v11_0_baco_get_state, .baco_set_state = smu_v11_0_baco_set_state, - .baco_enter = smu_v11_0_baco_enter, - .baco_exit = smu_v11_0_baco_exit, + .baco_enter = navi10_baco_enter, + .baco_exit = navi10_baco_exit, .get_dpm_ultimate_freq = smu_v11_0_get_dpm_ultimate_freq, .set_soft_freq_limited_range = smu_v11_0_set_soft_freq_limited_range, .set_default_od_settings = navi10_set_default_od_settings,
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +25 -2
@@ -2109,6 +2109,29 @@ static int sienna_cichlid_run_btc(struct smu_context *smu)return smu_cmn_send_smc_msg (smu, SMU_MSG_RunDcBtc,NULL ); } +static int sienna_cichlid_baco_enter (struct smu_context *smu) +{ +struct amdgpu_device *adev = smu->adev; + +if (adev->in_runpm) +return smu_v11_0_baco_set_armd3_sequence (smu,BACO_SEQ_BACO ); +else +return smu_v11_0_baco_enter (smu); +} + +static int sienna_cichlid_baco_exit (struct smu_context *smu) +{ +struct amdgpu_device *adev = smu->adev; + +if (adev->in_runpm) { +/* Wait for PMFW handling for the Dstate change */ +msleep (10 ); +return smu_v11_0_baco_set_armd3_sequence (smu,BACO_SEQ_ULPS ); + }else { +return smu_v11_0_baco_exit (smu); + } +} +static bool sienna_cichlid_is_mode1_reset_supported (struct smu_context *smu) {struct amdgpu_device *adev = smu->adev;
@@ -3884,8 +3907,8 @@ static const struct pptable_funcs sienna_cichlid_ppt_funcs = { .baco_is_support = smu_v11_0_baco_is_support, .baco_get_state = smu_v11_0_baco_get_state, .baco_set_state = smu_v11_0_baco_set_state, - .baco_enter = smu_v11_0_baco_enter, - .baco_exit = smu_v11_0_baco_exit, + .baco_enter = sienna_cichlid_baco_enter, + .baco_exit = sienna_cichlid_baco_exit, .mode1_reset_is_support = sienna_cichlid_is_mode1_reset_supported, .mode1_reset = smu_v11_0_mode1_reset, .get_dpm_ultimate_freq = sienna_cichlid_get_dpm_ultimate_freq,
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +2 -9
@@ -1474,7 +1474,8 @@ int smu_v11_0_set_azalia_d3_pme(struct smu_context *smu)return smu_cmn_send_smc_msg (smu, SMU_MSG_BacoAudioD3PME,NULL ); } -static int smu_v11_0_baco_set_armd3_sequence (struct smu_context *smu,enum smu_v11_0_baco_seq baco_seq) +int smu_v11_0_baco_set_armd3_sequence (struct smu_context *smu, +enum smu_v11_0_baco_seq baco_seq) {return smu_cmn_send_smc_msg_with_param (smu, SMU_MSG_ArmD3, baco_seq,NULL ); }
@@ -1578,16 +1579,8 @@ int smu_v11_0_baco_set_state(struct smu_context *smu, enum smu_baco_state state)int smu_v11_0_baco_enter (struct smu_context *smu) { -struct amdgpu_device *adev = smu->adev;int ret =0 ; -/* Arcturus does not need this audio workaround */ -if (adev->asic_type !=CHIP_ARCTURUS ) { - ret =smu_v11_0_baco_set_armd3_sequence (smu,BACO_SEQ_BACO ); -if (ret) -return ret; - } - ret =smu_v11_0_baco_set_state (smu,SMU_BACO_STATE_ENTER );if (ret)return ret;
Signature · 6 lines
2.29.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH v3 3/5 drm/amdgpu: make audio dev's D-state transition PMFW-aware
In reply to Evan QuanTo correctly kick into BACO state, the audio dev's D-state transition(D0->D3) needs to be PMFW-aware. So, if the audio dev entered D3 state prior to our driver, we need to bring it back to D0 state and make sure there will be a D-state transition on runpm suspend.
---V1->V2:
- Lijo: include the code in a seperate API for better readability
- limit the change for Navi10 and later dGPUs
- comments more about the backgroundv2->V3:
- Lijo: update the code comment further
--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 42 +++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +42 -0
@@ -123,6 +123,22 @@ void amdgpu_register_gpu_instance(struct amdgpu_device *adev)mutex_unlock (&mgpu_info.mutex); } +static void amdgpu_get_audio_func (struct amdgpu_device *adev) +{ +struct pci_dev *p =NULL ; + + p =pci_get_domain_bus_and_slot (pci_domain_nr (adev->pdev->bus), + adev->pdev->bus->number,1 ); +if (p) { +pm_runtime_get_sync (&p->dev); + +pm_runtime_mark_last_busy (&p->dev); +pm_runtime_put_autosuspend (&p->dev); + +pci_dev_put (p); + } +} +/** * amdgpu_driver_load_kms - Main load function for KMS. *
@@ -212,9 +228,35 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags) DPM_FLAG_MAY_SKIP_RESUME);pm_runtime_use_autosuspend (dev->dev);pm_runtime_set_autosuspend_delay (dev->dev,5000 ); +pm_runtime_allow (dev->dev); +pm_runtime_mark_last_busy (dev->dev);pm_runtime_put_autosuspend (dev->dev); + +/* +* For runpm implemented via BACO, PMFW will handle the +* timing for BACO in and out: +* - put ASIC into BACO state only when both video and +* audio functions are in D3 state. +* - pull ASIC out of BACO state when either video or +* audio function is in D0 state. +* Also, at startup, PMFW assumes both functions are in +* D0 state. +* +* So if snd driver was loaded prior to amdgpu driver +* and audio function was put into D3 state, there will +* be no PMFW-aware D-state transition(D0->D3) on runpm +* suspend. Thus the BACO will be not correctly kicked in. +* +* Via amdgpu_get_audio_func(), the audio dev is put +* into D0 state. Then there will be a PMFW-aware D-state +* transition(D0->D3) on runpm suspend. +*/ +if (amdgpu_device_supports_baco (dev) && + !(adev->flags &AMD_IS_APU ) && + (adev->asic_type >=CHIP_NAVI10 )) +amdgpu_get_audio_func (adev); }if (amdgpu_acpi_smart_shift_update (dev,AMDGPU_SS_DRV_LOAD ))
Signature · 6 lines
2.29.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH v3 4/5 drm/amd/pm: update the cached dpm feature status
In reply to Evan QuanFor some ASICs, the real dpm feature disablement job is handled by PMFW during baco reset and custom pptable loading. Cached dpm feature status need to be updated to pair that.
---V1->V2:
- correct the setting for baco bit(pointed out by Lijo)v2->v3:
- Lijo: no new ppt_func
- fit the logic into existing API
--- drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h | 4 +- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 9 +++- drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 47 +++++++++++++++++---- drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h | 1 + drivers/gpu/drm/amd/pm/swsmu/smu_internal.h | 2 +- 5 files changed, 50 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h +3 -1
@@ -935,7 +935,9 @@ struct pptable_funcs {* @disable_all_features_with_exception: Disable all features with * exception to those in &mask. */ -int (*disable_all_features_with_exception)(struct smu_context *smu,enum smu_feature_mask mask); +int (*disable_all_features_with_exception)(struct smu_context *smu, +bool no_hw_disablement, +enum smu_feature_mask mask);/** * @notify_display_change: Enable fast memory clock switching.
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +7 -2
@@ -1382,7 +1382,9 @@ static int smu_disable_dpms(struct smu_context *smu)if (smu->uploading_custom_pp_table && (adev->asic_type >=CHIP_NAVI10 ) && (adev->asic_type <=CHIP_DIMGREY_CAVEFISH )) -return 0 ; +return smu_disable_all_features_with_exception (smu, + true, +SMU_FEATURE_COUNT );/* * For Sienna_Cichlid, PMFW will handle the features disablement properly
@@ -1390,7 +1392,9 @@ static int smu_disable_dpms(struct smu_context *smu)*/ if ((adev->asic_type ==CHIP_SIENNA_CICHLID ) && use_baco) -return 0 ; +return smu_disable_all_features_with_exception (smu, + true, +SMU_FEATURE_BACO_BIT );/* * For gpu reset, runpm and hibernation through BACO,
@@ -1398,6 +1402,7 @@ static int smu_disable_dpms(struct smu_context *smu)*/ if (use_baco &&smu_feature_is_enabled (smu,SMU_FEATURE_BACO_BIT )) { ret =smu_disable_all_features_with_exception (smu, + false,SMU_FEATURE_BACO_BIT );if (ret)dev_err (adev->dev,"Failed to disable smu features except BACO.\n" );
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +38 -9
61 lines not on this page · raw message
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h +1 -0
@@ -75,6 +75,7 @@ int smu_cmn_set_pp_feature_mask(struct smu_context *smu, uint64_t new_mask);int smu_cmn_disable_all_features_with_exception (struct smu_context *smu, +bool no_hw_disablement,enum smu_feature_mask mask); int smu_cmn_get_smc_version(struct smu_context *smu,
drivers/gpu/drm/amd/pm/swsmu/smu_internal.h +1 -1
@@ -57,7 +57,7 @@#define smu_feature_set_allowed_mask (smu) smu_ppt_funcs(set_allowed_mask, 0, smu)#define smu_feature_get_enabled_mask (smu, mask, num) smu_ppt_funcs(get_enabled_mask, 0, smu, mask, num)#define smu_feature_is_enabled (smu, mask) smu_ppt_funcs(feature_is_enabled, 0, smu, mask) -#define smu_disable_all_features_with_exception (smu, mask) smu_ppt_funcs(disable_all_features_with_exception, 0, smu, mask) +#define smu_disable_all_features_with_exception (smu, no_hw_disablement, mask) smu_ppt_funcs(disable_all_features_with_exception, 0, smu, no_hw_disablement, mask)#define smu_is_dpm_running (smu) smu_ppt_funcs(is_dpm_running, 0 , smu)#define smu_notify_display_change (smu) smu_ppt_funcs(notify_display_change, 0, smu)#define smu_populate_umd_state_clk (smu) smu_ppt_funcs(populate_umd_state_clk, 0, smu)
Signature · 6 lines
2.29.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH v3 5/5 drm/amd/pm: correct the dpm features disablement for Navi1x
In reply to Evan QuanFor BACO scenario, PMFW will handle the dpm features disablement and interaction with RLC properly. Driver involvement is unnecessary and error prone.
--- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -1
@@ -1390,7 +1390,8 @@ static int smu_disable_dpms(struct smu_context *smu)* For Sienna_Cichlid, PMFW will handle the features disablement properly * on BACO in. Driver involvement is unnecessary. */ -if ((adev->asic_type ==CHIP_SIENNA_CICHLID ) && +if (((adev->asic_type ==CHIP_SIENNA_CICHLID ) || + ((adev->asic_type >=CHIP_NAVI10 ) && (adev->asic_type <=CHIP_NAVI12 ))) && use_baco) return smu_disable_all_features_with_exception(smu, true,
Signature · 6 lines
2.29.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
[AMD Official Use Only]
Series is
-----Original Message-----
From: Quan, Evan <[email protected]>
Sent: Tuesday, June 8, 2021 10:04 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Lazar, Lijo <[email protected]>; Quan, Evan <[email protected]>
Subject: [PATCH V3 1/5] drm/amd/pm: drop the incomplete fix for Navi14 runpm issue
As the fix by adding PPSMC_MSG_PrepareMp1ForUnload is proved to be incomplete. Another fix(see link below) has been sent out.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 5 +--- .../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 26 +------------------ 2 files changed, 2 insertions(+), 29 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -4
@@ -2180,10 +2180,7 @@ static int psp_load_smu_fw(struct psp_context *psp)if ((amdgpu_in_reset (adev) && ras && adev->ras_enabled && (adev->asic_type ==CHIP_ARCTURUS || - adev->asic_type ==CHIP_VEGA20 )) || - (adev->in_runpm && - adev->asic_type >=CHIP_NAVI10 && - adev->asic_type <=CHIP_NAVI12 )) { + adev->asic_type ==CHIP_VEGA20 ))) { ret =amdgpu_dpm_set_mp1_state (adev,PP_MP1_STATE_UNLOAD );if (ret) { DRM_WARN("Failed to set MP1 state prepare for reload\n"); 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 695c65767258..267fbbdbff94 100644
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +1 -25
@@ -446,30 +446,6 @@ static int navi10_store_powerplay_table(struct smu_context *smu)return 0 ; } -static int navi10_set_mp1_state (struct smu_context *smu, -enum pp_mp1_state mp1_state) -{ -struct amdgpu_device *adev = smu->adev; -uint32_t mp1_fw_flags; -int ret =0 ; - - ret =smu_cmn_set_mp1_state (smu, mp1_state); -if (ret) -return ret; - -if (mp1_state ==PP_MP1_STATE_UNLOAD ) { - mp1_fw_flags =RREG32_PCIE (MP1_Public | - (smnMP1_FIRMWARE_FLAGS &0xffffffff )); - - mp1_fw_flags &= ~MP1_FIRMWARE_FLAGS__INTERRUPTS_ENABLED_MASK ; - -WREG32_PCIE (MP1_Public | - (smnMP1_FIRMWARE_FLAGS &0xffffffff ), mp1_fw_flags); - } - -return 0 ; -} -static int navi10_setup_pptable (struct smu_context *smu) {int ret =0 ;
@@ -3122,7 +3098,7 @@ static const struct pptable_funcs navi10_ppt_funcs = { .get_fan_parameters = navi10_get_fan_parameters, .post_init = navi10_post_smu_init, .interrupt_work = smu_v11_0_interrupt_work, - .set_mp1_state = navi10_set_mp1_state, + .set_mp1_state = smu_cmn_set_mp1_state, };void navi10_set_ppt_funcs (struct smu_context *smu)
--
2.29.0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx