drm/amdgpu: when suspend, set boot state instand of disable dpm.
Subsystems (2)
PATCH 1/6 drm/amdgpu: when suspend, set boot state instand of disable dpm.
fix pm-hibernat bug, when suspend/resume, dpm start failed.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h | 2 ++ drivers/gpu/drm/amd/amdgpu/ci_dpm.c | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h +2 -0
@@ -404,6 +404,8 @@ struct amdgpu_dpm {enum amd_vce_level vce_level;enum amd_pm_state_type state;enum amd_pm_state_type user_state; +enum amd_pm_state_type last_state; +enum amd_pm_state_type last_user_state;u32 platform_caps;u32 voltage_response_time;u32 backbias_response_time;
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +13 -4
@@ -6347,12 +6347,19 @@ static int ci_dpm_suspend(void *handle)if (adev->pm.dpm_enabled) {mutex_lock (&adev->pm.mutex); -/* disable dpm */ -ci_dpm_disable (adev); -/* reset the power state */ - adev->pm.dpm.current_ps = adev->pm.dpm.requested_ps = adev->pm.dpm.boot_ps; +amdgpu_irq_put (adev, &adev->pm.dpm.thermal.irq, +AMDGPU_THERMAL_IRQ_LOW_TO_HIGH ); +amdgpu_irq_put (adev, &adev->pm.dpm.thermal.irq, +AMDGPU_THERMAL_IRQ_HIGH_TO_LOW ); + adev->pm.dpm.last_user_state = adev->pm.dpm.user_state; + adev->pm.dpm.last_state = adev->pm.dpm.state; + adev->pm.dpm.user_state =POWER_STATE_TYPE_INTERNAL_BOOT ; + adev->pm.dpm.state =POWER_STATE_TYPE_INTERNAL_BOOT ;mutex_unlock (&adev->pm.mutex); +amdgpu_pm_compute_clocks (adev); + } +return 0 ; }
@@ -6370,6 +6377,8 @@ static int ci_dpm_resume(void *handle) adev->pm.dpm_enabled = false; else adev->pm.dpm_enabled = true; + adev->pm.dpm.user_state = adev->pm.dpm.last_user_state; + adev->pm.dpm.state = adev->pm.dpm.last_state;mutex_unlock (&adev->pm.mutex);if (adev->pm.dpm_enabled)amdgpu_pm_compute_clocks (adev);
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1477477272-5840-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org
PATCH 2/6 drm/amd/powerplay: fix bug get wrong evv voltage of Polaris.
--- drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | 2 +- drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +1 -1
@@ -716,7 +716,7 @@ int phm_get_voltage_evv_on_sclk(struct pp_hwmgr *hwmgr, uint8_t voltage_type, *voltage =1150 ; }else { ret =atomctrl_get_voltage_evv_on_sclk_ai (hwmgr, voltage_type, sclk, id, &vol); - *voltage = (uint16_t )vol/100 ; + *voltage = (uint16_t )(vol/100 ); }return ret; }
drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c +1 -1
@@ -1321,7 +1321,7 @@ int atomctrl_get_voltage_evv_on_sclk_ai(struct pp_hwmgr *hwmgr, uint8_t voltage_if (0 != result)return result; - *voltage =le16_to_cpu (((GET_EVV_VOLTAGE_INFO_OUTPUT_PARAMETER_V1_3 *) + *voltage =le32_to_cpu (((GET_EVV_VOLTAGE_INFO_OUTPUT_PARAMETER_V1_3 *) (&get_voltage_info_param_space))->ulVoltageLevel);return result;
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/6 drm/amdgpu: just not load smc firmware if smu is already running
In reply to a message not in the archive--- drivers/gpu/drm/amd/amdgpu/ci_dpm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +5 -2
@@ -2207,6 +2207,11 @@ static int ci_upload_firmware(struct amdgpu_device *adev)struct ci_power_info *pi =ci_get_pi (adev);int i, ret; +if (amdgpu_ci_is_smc_running (adev)) { +DRM_INFO ("smc is running, no need to load smc firmware\n" ); +return 0 ; + } +for (i =0 ; i < adev->usec_timeout; i++) {if (RREG32_SMC (ixRCU_UC_EVENTS) & RCU_UC_EVENTS__boot_seq_done_MASK)break ;
@@ -5275,8 +5280,6 @@ static int ci_dpm_enable(struct amdgpu_device *adev)struct amdgpu_ps *boot_ps = adev->pm.dpm.boot_ps;int ret; -if (amdgpu_ci_is_smc_running (adev)) -return -EINVAL ;if (pi->voltage_control !=CISLANDS_VOLTAGE_CONTROL_NONE ) {ci_enable_voltage_control (adev); ret =ci_construct_voltage_tables (adev);
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/6 drm/amdgpu: enable uvd bypass mode for CI/VI.
In reply to a message not in the archive--- drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c | 25 ++++++++++++++++++++++--- drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c | 18 ++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 9 ++++----- 3 files changed, 44 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +22 -3
@@ -36,6 +36,9 @@#include "bif/bif_4_1_d.h" +#include "smu/smu_7_0_1_d.h" +#include "smu/smu_7_0_1_sh_mask.h" +static void uvd_v4_2_mc_resume (struct amdgpu_device *adev);static void uvd_v4_2_init_cg (struct amdgpu_device *adev);static void uvd_v4_2_set_ring_funcs (struct amdgpu_device *adev);
@@ -683,18 +686,34 @@ static int uvd_v4_2_process_interrupt(struct amdgpu_device *adev,return 0 ; } +static void uvd_v5_0_set_bypass_mode (struct amdgpu_device *adev,bool enable) +{ +u32 tmp =RREG32_SMC (ixGCK_DFS_BYPASS_CNTL); + +if (enable) + tmp |= (GCK_DFS_BYPASS_CNTL__BYPASSDCLK_MASK | +GCK_DFS_BYPASS_CNTL__BYPASSVCLK_MASK ); +else + tmp &= ~(GCK_DFS_BYPASS_CNTL__BYPASSDCLK_MASK | +GCK_DFS_BYPASS_CNTL__BYPASSVCLK_MASK ); + +WREG32_SMC (ixGCK_DFS_BYPASS_CNTL, tmp); +} +static int uvd_v4_2_set_clockgating_state (void *handle,enum amd_clockgating_state state) {bool gate = false;struct amdgpu_device *adev = (struct amdgpu_device *)handle; -if (!(adev->cg_flags &AMD_CG_SUPPORT_UVD_MGCG )) -return 0 ; -if (state ==AMD_CG_STATE_GATE ) gate = true; +uvd_v5_0_set_bypass_mode (adev, gate); + +if (!(adev->cg_flags &AMD_CG_SUPPORT_UVD_MGCG )) +return 0 ; +uvd_v4_2_enable_mgcg (adev, gate);return 0 ;
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +18 -0
@@ -33,6 +33,8 @@#include "oss/oss_2_0_sh_mask.h" #include "bif/bif_5_0_d.h" #include "vi.h" +#include "smu/smu_7_1_2_d.h" +#include "smu/smu_7_1_2_sh_mask.h" static void uvd_v5_0_set_ring_funcs (struct amdgpu_device *adev);static void uvd_v5_0_set_irq_funcs (struct amdgpu_device *adev);
@@ -722,6 +724,20 @@ static void uvd_v5_0_set_hw_clock_gating(struct amdgpu_device *adev) }#endif +static void uvd_v5_0_set_bypass_mode (struct amdgpu_device *adev,bool enable) +{ +u32 tmp =RREG32_SMC (ixGCK_DFS_BYPASS_CNTL); + +if (enable) + tmp |= (GCK_DFS_BYPASS_CNTL__BYPASSDCLK_MASK | +GCK_DFS_BYPASS_CNTL__BYPASSVCLK_MASK ); +else + tmp &= ~(GCK_DFS_BYPASS_CNTL__BYPASSDCLK_MASK | +GCK_DFS_BYPASS_CNTL__BYPASSVCLK_MASK ); + +WREG32_SMC (ixGCK_DFS_BYPASS_CNTL, tmp); +} +static int uvd_v5_0_set_clockgating_state (void *handle,enum amd_clockgating_state state) {
@@ -729,6 +745,8 @@ static int uvd_v5_0_set_clockgating_state(void *handle,bool enable = (state ==AMD_CG_STATE_GATE ) ? true : false;static int curstate =-1 ; +uvd_v5_0_set_bypass_mode (adev, enable); +if (!(adev->cg_flags &AMD_CG_SUPPORT_UVD_MGCG ))return 0 ;
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +4 -5
@@ -935,7 +935,7 @@ static void uvd_v6_0_set_hw_clock_gating(struct amdgpu_device *adev) }#endif -static void uvd_v6_set_bypass_mode (struct amdgpu_device *adev,bool enable) +static void uvd_v6_0_set_bypass_mode (struct amdgpu_device *adev,bool enable) {u32 tmp =RREG32_SMC (ixGCK_DFS_BYPASS_CNTL);
@@ -953,15 +953,14 @@ static int uvd_v6_0_set_clockgating_state(void *handle, enum amd_clockgating_state state) {struct amdgpu_device *adev = (struct amdgpu_device *)handle; +bool enable = (state ==AMD_CG_STATE_GATE ) ? true : false; -if (adev->asic_type ==CHIP_FIJI || - adev->asic_type ==CHIP_POLARIS10 ) -uvd_v6_set_bypass_mode (adev, state ==AMD_CG_STATE_GATE ? true : false); +uvd_v6_0_set_bypass_mode (adev, enable);if (!(adev->cg_flags &AMD_CG_SUPPORT_UVD_MGCG ))return 0 ; -if (state ==AMD_CG_STATE_GATE ) { +if (enable) {/* disable HW gating and enable Sw gating */ uvd_v6_0_set_sw_clock_gating (adev); }else {
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/6 drm/amdgpu: disable dpm before turn off clock when vce idle.
In reply to a message not in the archive--- drivers/gpu/drm/amd/amdgpu/ci_dpm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +1 -2
@@ -4258,13 +4258,12 @@ static int ci_update_vce_dpm(struct amdgpu_device *adev, ret =ci_enable_vce_dpm (adev, true); }else { + ret =ci_enable_vce_dpm (adev, false);/* turn the clocks off when not encoding */ ret =amdgpu_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_VCE ,AMD_CG_STATE_GATE );if (ret)return ret; - - ret =ci_enable_vce_dpm (adev, false); } }return ret;
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 6/6 drm/amdgpu: turn on/off uvd clock when dpm enable/disable on CI
In reply to a message not in the archive--- drivers/gpu/drm/amd/amdgpu/ci_dpm.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +18 -6
@@ -887,9 +887,6 @@ static void ci_dpm_powergate_uvd(struct amdgpu_device *adev, bool gate) {struct ci_power_info *pi =ci_get_pi (adev); -if (pi->uvd_power_gated == gate) -return ; - pi->uvd_power_gated = gate;ci_update_uvd_dpm (adev, gate);
@@ -4201,8 +4198,15 @@ static int ci_update_uvd_dpm(struct amdgpu_device *adev, bool gate) {struct ci_power_info *pi =ci_get_pi (adev);u32 tmp; +int ret =0 ;if (!gate) { +/* turn the clocks on when decoding */ + ret =amdgpu_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_UVD , +AMD_CG_STATE_UNGATE ); +if (ret) +return ret; +if (pi->caps_uvd_dpm || (adev->pm.dpm.dyn_state.uvd_clock_voltage_dependency_table.count <=0 )) pi->smc_state_table.UvdBootLevel =0 ;
@@ -4214,9 +4218,17 @@ static int ci_update_uvd_dpm(struct amdgpu_device *adev, bool gate) tmp &= ~DPM_TABLE_475__UvdBootLevel_MASK; tmp |= (pi->smc_state_table.UvdBootLevel << DPM_TABLE_475__UvdBootLevel__SHIFT);WREG32_SMC (ixDPM_TABLE_475, tmp); + ret =ci_enable_uvd_dpm (adev, true); + }else { + ret =ci_enable_uvd_dpm (adev, false); +if (ret) +return ret; + + ret =amdgpu_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_UVD , +AMD_CG_STATE_GATE ); } -return ci_enable_uvd_dpm (adev, !gate); +return ret; }static u8 ci_get_vce_boot_level (struct amdgpu_device *adev)
@@ -4262,8 +4274,8 @@ static int ci_update_vce_dpm(struct amdgpu_device *adev,/* turn the clocks off when not encoding */ ret =amdgpu_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_VCE ,AMD_CG_STATE_GATE ); -if (ret) -return ret; + +return ret; } }return ret;
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Patch #1-#4 are Acked-by: Christian König <[email protected]>.
You already send a v2 for patch #5.
Where is patch #6 in this series?
Regards,
Christian.
Am 26.10.2016 um 12:21 schrieb Rex Zhu:
Quoted 51 lines
fix pm-hibernat bug, when suspend/resume, dpm start failed.
Change-Id I0ec39c72b9c38778c01f88283caa14f115db8f4cSigned-off-by Rex Zhu <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h | 2 ++ drivers/gpu/drm/amd/amdgpu/ci_dpm.c | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h +2
-0@@ -404,6 +404,8 @@ struct amdgpu_dpm {enum amd_vce_level vce_level;enum amd_pm_state_type state;enum amd_pm_state_type user_state; +enum amd_pm_state_type last_state; +enum amd_pm_state_type last_user_state;u32 platform_caps;u32 voltage_response_time;u32 backbias_response_time;drivers/gpu/drm/amd/amdgpu/ci_dpm.c +11
-4@@ -6347,12 +6347,19 @@ static int ci_dpm_suspend(void *handle)if (adev->pm.dpm_enabled) {mutex_lock (&adev->pm.mutex); -/* disable dpm */ -ci_dpm_disable (adev); -/* reset the power state */ - adev->pm.dpm.current_ps = adev->pm.dpm.requested_ps = adev->pm.dpm.boot_ps; +amdgpu_irq_put (adev, &adev->pm.dpm.thermal.irq, +AMDGPU_THERMAL_IRQ_LOW_TO_HIGH ); +amdgpu_irq_put (adev, &adev->pm.dpm.thermal.irq, +AMDGPU_THERMAL_IRQ_HIGH_TO_LOW ); + adev->pm.dpm.last_user_state = adev->pm.dpm.user_state; + adev->pm.dpm.last_state = adev->pm.dpm.state; + adev->pm.dpm.user_state =POWER_STATE_TYPE_INTERNAL_BOOT ; + adev->pm.dpm.state =POWER_STATE_TYPE_INTERNAL_BOOT ;mutex_unlock (&adev->pm.mutex); +amdgpu_pm_compute_clocks (adev); + } +return 0 ; }
drivers/gpu/drm/amd/amdgpu/ci_dpm.c static int ci_dpm_resume(void *handle) · line 6384
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +2
-0@@ -6370,6 +6377,8 @@ static int ci_dpm_resume(void *handle) adev->pm.dpm_enabled = false; else adev->pm.dpm_enabled = true; + adev->pm.dpm.user_state = adev->pm.dpm.last_user_state; + adev->pm.dpm.state = adev->pm.dpm.last_state;mutex_unlock (&adev->pm.mutex);if (adev->pm.dpm_enabled)amdgpu_pm_compute_clocks (adev);
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 766d370a-a211-c8d3-9e2f-5a26123642be-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org
Alex Deucher
Reviewed-byQuoted 5 lines · Christian König
Patch #1-#4 are Acked-by: Christian König <[email protected]>.
You already send a v2 for patch #5.
Where is patch #6 in this series?
Strangely, I didn't get it either, but it showed up in the archives. Anyway,
Patches 1-4, 5(v2), 6:
Quoted 66 lines
Regards,
Christian.Am 26.10.2016 um 12:21 schrieb Rex Zhu:
Quoted 60 lines
fix pm-hibernat bug, when suspend/resume, dpm start failed.
Change-Id I0ec39c72b9c38778c01f88283caa14f115db8f4cSigned-off-by Rex Zhu <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h | 2 ++ drivers/gpu/drm/amd/amdgpu/ci_dpm.c | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h +2
-0@@ -404,6 +404,8 @@ struct amdgpu_dpm {enum amd_vce_level vce_level;enum amd_pm_state_type state;enum amd_pm_state_type user_state; +enum amd_pm_state_type last_state; +enum amd_pm_state_type last_user_state;u32 platform_caps;u32 voltage_response_time;u32 backbias_response_time;drivers/gpu/drm/amd/amdgpu/ci_dpm.c +11
-4@@ -6347,12 +6347,19 @@ static int ci_dpm_suspend(void *handle)if (adev->pm.dpm_enabled) {mutex_lock (&adev->pm.mutex); -/* disable dpm */ -ci_dpm_disable (adev); -/* reset the power state */ - adev->pm.dpm.current_ps = adev->pm.dpm.requested_ps = adev->pm.dpm.boot_ps; +amdgpu_irq_put (adev, &adev->pm.dpm.thermal.irq, +AMDGPU_THERMAL_IRQ_LOW_TO_HIGH ); +amdgpu_irq_put (adev, &adev->pm.dpm.thermal.irq, +AMDGPU_THERMAL_IRQ_HIGH_TO_LOW ); + adev->pm.dpm.last_user_state = adev->pm.dpm.user_state; + adev->pm.dpm.last_state = adev->pm.dpm.state; + adev->pm.dpm.user_state =POWER_STATE_TYPE_INTERNAL_BOOT ; + adev->pm.dpm.state =POWER_STATE_TYPE_INTERNAL_BOOT ;mutex_unlock (&adev->pm.mutex); +amdgpu_pm_compute_clocks (adev); + } +return 0 ; } @@ -6370,6 +6377,8 @@ static int ci_dpm_resume(void *handle)adev->pm.dpm_enabled = false; else adev->pm.dpm_enabled = true;drivers/gpu/drm/amd/amdgpu/ci_dpm.c +2
-0+ adev->pm.dpm.user_state = adev->pm.dpm.last_user_state; + adev->pm.dpm.state = adev->pm.dpm.last_state;mutex_unlock (&adev->pm.mutex);if (adev->pm.dpm_enabled)
Quoted 8 lines
Quoted 1 line
amdgpu_pm_compute_clocks(adev);_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx