drm/amd/pm: drop the incomplete fix for Navi14 runpm issue
Subsystems (3)
PATCH 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
@@ -2176,10 +2176,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
@@ -431,30 +431,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 ;
@@ -3119,7 +3095,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 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.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 ++ .../gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 20 ++++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -0
@@ -1574,6 +1574,8 @@ static int amdgpu_pmops_runtime_resume(struct device *dev)*/ pci_set_master (pdev); }else if (amdgpu_device_supports_baco (drm_dev)) { +/* Wait for PMFW handling for the Dstate change */ +msleep (10 );amdgpu_device_baco_exit (drm_dev); } ret =amdgpu_device_resume (drm_dev, false);
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +11 -9
@@ -1581,25 +1581,27 @@ 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 ) { +if (adev->in_runpm) { ret =smu_v11_0_baco_set_armd3_sequence (smu,BACO_SEQ_BACO ); + }else { + ret =smu_v11_0_baco_set_state (smu,SMU_BACO_STATE_ENTER );if (ret)return ret; - } - - ret =smu_v11_0_baco_set_state (smu,SMU_BACO_STATE_ENTER ); -if (ret) -return ret; -msleep (10 ); +msleep (10 ); + }return ret; }int smu_v11_0_baco_exit (struct smu_context *smu) { -return smu_v11_0_baco_set_state (smu,SMU_BACO_STATE_EXIT ); +struct amdgpu_device *adev = smu->adev; + +if (adev->in_runpm) +return smu_v11_0_baco_set_armd3_sequence (smu,BACO_SEQ_ULPS ); +else +return smu_v11_0_baco_set_state (smu,SMU_BACO_STATE_EXIT ); }int smu_v11_0_mode1_reset (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 3/5 drm/amdgpu: correct the audio function initial Dstate
In reply to Evan QuanOn driver loading, the ASIC is in D0 state. The bundled audio function should be in the same state also.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +14 -0
@@ -137,6 +137,7 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags)struct drm_device *dev;struct pci_dev *parent;int r, acpi_status; +struct pci_dev *p =NULL ; dev =adev_to_drm (adev);
@@ -212,9 +213,22 @@ 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); + + 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); + } }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
Re: [PATCH 3/5] drm/amdgpu: correct the audio function initial Dstate
Quoted 23 lines · Evan Quan
On driver loading, the ASIC is in D0 state. The bundled audio function should be in the same state also.
Change-Id I136e196be7633e95883a7f6c33963f7583e9bad1Signed-off-by Evan Quan <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +1
-0@@ -137,6 +137,7 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags)struct drm_device *dev;struct pci_dev *parent;int r, acpi_status; +struct pci_dev *p =NULL ; dev =adev_to_drm (adev);@@ -212,9 +213,22 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags) DPM_FLAG_MAY_SKIP_RESUME);
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags) · line 223
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +5
-0pm_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); + + p =pci_get_domain_bus_and_slot (pci_domain_nr (adev->pdev->bus), + adev->pdev->bus->number,1 );
For the sake of readability, it's better to wrap this as get_audio_dev or similar.
Thanks,
Lijo
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags) · line 234
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +8
-0+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); + } }if (amdgpu_acpi_smart_shift_update (dev,AMDGPU_SS_DRV_LOAD ))
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
RE: [PATCH 3/5] drm/amdgpu: correct the audio function initial Dstate
[AMD Official Use Only]
Quoted 38 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Thursday, June 3, 2021 7:09 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 3/5] drm/amdgpu: correct the audio function initial Dstatedrivers/gpu/drm/amd/amdgpu/amdgpu_kms.c int amdgpu_driver_load_kms(struct
Quoted 15 lines · Evan Quan
On driver loading, the ASIC is in D0 state. The bundled audio function should be in the same state also.
Change-Id I136e196be7633e95883a7f6c33963f7583e9bad1Signed-off-by Evan Quan <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0
-0@@ -137,6 +137,7 @@ int amdgpu_driver_load_kms(struct
amdgpu_device*adev, unsigned long flags)drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c int amdgpu_driver_load_kms(struct
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +1
-0struct drm_device *dev;struct pci_dev *parent;int r, acpi_status; +struct pci_dev *p =NULL ; dev =adev_to_drm (adev);@@ -212,9 +213,22 @@ int amdgpu_driver_load_kms(struct
amdgpu_device*adev, unsigned long flags)Quoted 1 line
DPM_FLAG_MAY_SKIP_RESUME);
Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags) · line 223
Quoted 11 lines
pm_runtime_use_autosuspend(dev->dev); pm_runtime_set_autosuspend_delay(dev->dev, 5000);drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +4
-0+pm_runtime_allow (dev->dev); +pm_runtime_mark_last_busy (dev->dev);pm_runtime_put_autosuspend (dev->dev); + + p = pci_get_domain_bus_and_slot(pci_domain_nr(adev-
pdev->bus),drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +1
-0+ adev->pdev->bus->number, 1);For the sake of readability, it's better to wrap this as
get_audio_devor similar.
[Quan, Evan] Sounds good to me. Will update it in V2. BR
Evan
Quoted 14 lines
Thanks,
LijoQuoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +8
-0+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); + } }
Quoted 3 lines
Quoted 1 line
if (amdgpu_acpi_smart_shift_update(dev,
AMDGPU_SS_DRV_LOAD))Quoted 1 line
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/5 drm/amd/pm: clear 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 cleared to pair that.
--- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +16 -2
@@ -1352,6 +1352,16 @@ static int smu_hw_init(void *handle)return 0 ; } +static void smu_reset_cached_dpm_feature_status (struct smu_context *smu) +{ +struct smu_feature *feature = &smu->smu_feature; + +mutex_lock (&feature->mutex); +bitmap_zero (feature->enabled, feature->feature_num); +bitmap_zero (feature->supported, feature->feature_num); +mutex_unlock (&feature->mutex); +} +static int smu_disable_dpms (struct smu_context *smu) {struct amdgpu_device *adev = smu->adev;
@@ -1374,16 +1384,20 @@ 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 )) + (adev->asic_type <=CHIP_DIMGREY_CAVEFISH )) { +smu_reset_cached_dpm_feature_status (smu);return 0 ; + }/* * For Sienna_Cichlid, PMFW will handle the features disablement properly * on BACO in. Driver involvement is unnecessary. */ if ((adev->asic_type ==CHIP_SIENNA_CICHLID ) && - use_baco) + use_baco) { +smu_reset_cached_dpm_feature_status (smu);return 0 ; + }/* * For gpu reset, runpm and hibernation through BACO,
Signature · 6 lines
2.29.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 4/5] drm/amd/pm: clear the cached dpm feature status
Quoted 15 lines · Evan Quan
For 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 cleared to pair that.
Change-Id I9e37d80e13599833301c04711b097fb37c2e41f9Signed-off-by Evan Quan <[email protected]>--- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0
-0
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c static int smu_hw_init(void *handle) · line 1361
Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +7
-0@@ -1352,6 +1352,16 @@ static int smu_hw_init(void *handle)return 0 ; } +static void smu_reset_cached_dpm_feature_status (struct smu_context *smu) +{ +struct smu_feature *feature = &smu->smu_feature; + +mutex_lock (&feature->mutex); +bitmap_zero (feature->enabled, feature->feature_num); +bitmap_zero (feature->supported, feature->feature_num);
This will clear also clear the BACO feature status. Won't that affect using baco exit for runtime pm resume?
Thanks,
Lijo
Quoted 20 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +6
-1+mutex_unlock (&feature->mutex); +} +static int smu_disable_dpms (struct smu_context *smu) {struct amdgpu_device *adev = smu->adev;@@ -1374,16 +1384,20 @@ 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 )) + (adev->asic_type <=CHIP_DIMGREY_CAVEFISH )) { +smu_reset_cached_dpm_feature_status (smu);return 0 ; + }/* * For Sienna_Cichlid, PMFW will handle the features disablement properly * on BACO in. Driver involvement is unnecessary.
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c static int smu_disable_dpms(struct smu_context *smu) · line 1403
Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +3
-1*/ if ((adev->asic_type ==CHIP_SIENNA_CICHLID ) && - use_baco) + use_baco) { +smu_reset_cached_dpm_feature_status (smu);return 0 ; + }/* * For gpu reset, runpm and hibernation through BACO,
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
RE: [PATCH 4/5] drm/amd/pm: clear the cached dpm feature status
[AMD Official Use Only]
Quoted 30 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Thursday, June 3, 2021 7:04 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 4/5] drm/amd/pm: clear the cached dpm feature statusQuoted 8 lines · Evan Quan
For 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 cleared to pair that.
Change-Id I9e37d80e13599833301c04711b097fb37c2e41f9Signed-off-by Evan Quan <[email protected]>--- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 18++++++++++++++++--
Quoted 11 lines
1 file changed, 16 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0
-0@@ -1352,6 +1352,16 @@ static int smu_hw_init(void *handle)return 0 ; }
Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c static int smu_hw_init(void *handle) · line 1361
Quoted 7 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +7
-0+static void smu_reset_cached_dpm_feature_status (struct smu_context +*smu) { +struct smu_feature *feature = &smu->smu_feature; + +mutex_lock (&feature->mutex); +bitmap_zero (feature->enabled, feature->feature_num); +bitmap_zero (feature->supported, feature->feature_num);This will clear also clear the BACO feature status. Won't that affect using baco exit for runtime pm resume?
[Quan, Evan] Yes, you are right. Will update it.
Regards,
Evan
Quoted 33 lines
Thanks,
Lijodrivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c static int smu_hw_init(void *handle)
Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +3
-0+mutex_unlock (&feature->mutex); +} +static int smu_disable_dpms (struct smu_context *smu) { struct amdgpu_device *adev = smu->adev; @@ -1374,16 +1384,20@@
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c static int smu_disable_dpms(struct smu_context *smu)
Quoted 12 lines
static int
smu_disable_dpms(struct smu_context *smu)
*/
if (smu->uploading_custom_pp_table&&
(adev->asic_type>=CHIP_NAVI10) &&drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +3
-1- (adev->asic_type <= CHIP_DIMGREY_CAVEFISH)) + (adev->asic_type <= CHIP_DIMGREY_CAVEFISH)) { +smu_reset_cached_dpm_feature_status (smu);return 0 ; + }/* * For Sienna_Cichlid, PMFW will handle the features disablement properly
Quoted 9 lines
* on BACO in. Driver involvement is unnecessary. */
if ((adev->asic_type==CHIP_SIENNA_CICHLID) &&drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +3
-1- use_baco) + use_baco) { +smu_reset_cached_dpm_feature_status (smu);return 0 ; + }
Quoted 3 lines
Quoted 3 lines
/*
* For gpu reset, runpm and hibernation through BACO,
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 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
@@ -1393,7 +1393,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) {smu_reset_cached_dpm_feature_status (smu);return 0 ;
Signature · 6 lines
2.29.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx