Commit 4cb0add2 authored by Alex Deucher's avatar Alex Deucher

drm/radeon: handle cg in SI dpm code

Clockgating needs to be disabled around certain parts
of dpm setup otherwise the smc gets into a bad state
and dpm doesn't work properly.
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 5594a558
...@@ -1753,6 +1753,9 @@ static int si_calculate_sclk_params(struct radeon_device *rdev, ...@@ -1753,6 +1753,9 @@ static int si_calculate_sclk_params(struct radeon_device *rdev,
u32 engine_clock, u32 engine_clock,
SISLANDS_SMC_SCLK_VALUE *sclk); SISLANDS_SMC_SCLK_VALUE *sclk);
extern void si_update_cg(struct radeon_device *rdev,
u32 block, bool enable);
static struct si_power_info *si_get_pi(struct radeon_device *rdev) static struct si_power_info *si_get_pi(struct radeon_device *rdev)
{ {
struct si_power_info *pi = rdev->pm.dpm.priv; struct si_power_info *pi = rdev->pm.dpm.priv;
...@@ -5759,6 +5762,13 @@ int si_dpm_enable(struct radeon_device *rdev) ...@@ -5759,6 +5762,13 @@ int si_dpm_enable(struct radeon_device *rdev)
struct radeon_ps *boot_ps = rdev->pm.dpm.boot_ps; struct radeon_ps *boot_ps = rdev->pm.dpm.boot_ps;
int ret; int ret;
si_update_cg(rdev, (RADEON_CG_BLOCK_GFX |
RADEON_CG_BLOCK_MC |
RADEON_CG_BLOCK_SDMA |
RADEON_CG_BLOCK_BIF |
RADEON_CG_BLOCK_UVD |
RADEON_CG_BLOCK_HDP), false);
if (si_is_smc_running(rdev)) if (si_is_smc_running(rdev))
return -EINVAL; return -EINVAL;
if (pi->voltage_control) if (pi->voltage_control)
...@@ -5878,6 +5888,13 @@ int si_dpm_enable(struct radeon_device *rdev) ...@@ -5878,6 +5888,13 @@ int si_dpm_enable(struct radeon_device *rdev)
si_enable_auto_throttle_source(rdev, RADEON_DPM_AUTO_THROTTLE_SRC_THERMAL, true); si_enable_auto_throttle_source(rdev, RADEON_DPM_AUTO_THROTTLE_SRC_THERMAL, true);
si_update_cg(rdev, (RADEON_CG_BLOCK_GFX |
RADEON_CG_BLOCK_MC |
RADEON_CG_BLOCK_SDMA |
RADEON_CG_BLOCK_BIF |
RADEON_CG_BLOCK_UVD |
RADEON_CG_BLOCK_HDP), true);
ni_update_current_ps(rdev, boot_ps); ni_update_current_ps(rdev, boot_ps);
return 0; return 0;
...@@ -5888,6 +5905,13 @@ void si_dpm_disable(struct radeon_device *rdev) ...@@ -5888,6 +5905,13 @@ void si_dpm_disable(struct radeon_device *rdev)
struct rv7xx_power_info *pi = rv770_get_pi(rdev); struct rv7xx_power_info *pi = rv770_get_pi(rdev);
struct radeon_ps *boot_ps = rdev->pm.dpm.boot_ps; struct radeon_ps *boot_ps = rdev->pm.dpm.boot_ps;
si_update_cg(rdev, (RADEON_CG_BLOCK_GFX |
RADEON_CG_BLOCK_MC |
RADEON_CG_BLOCK_SDMA |
RADEON_CG_BLOCK_BIF |
RADEON_CG_BLOCK_UVD |
RADEON_CG_BLOCK_HDP), false);
if (!si_is_smc_running(rdev)) if (!si_is_smc_running(rdev))
return; return;
si_disable_ulv(rdev); si_disable_ulv(rdev);
...@@ -5952,6 +5976,13 @@ int si_dpm_set_power_state(struct radeon_device *rdev) ...@@ -5952,6 +5976,13 @@ int si_dpm_set_power_state(struct radeon_device *rdev)
struct radeon_ps *old_ps = &eg_pi->current_rps; struct radeon_ps *old_ps = &eg_pi->current_rps;
int ret; int ret;
si_update_cg(rdev, (RADEON_CG_BLOCK_GFX |
RADEON_CG_BLOCK_MC |
RADEON_CG_BLOCK_SDMA |
RADEON_CG_BLOCK_BIF |
RADEON_CG_BLOCK_UVD |
RADEON_CG_BLOCK_HDP), false);
ret = si_disable_ulv(rdev); ret = si_disable_ulv(rdev);
if (ret) { if (ret) {
DRM_ERROR("si_disable_ulv failed\n"); DRM_ERROR("si_disable_ulv failed\n");
...@@ -6050,6 +6081,13 @@ int si_dpm_set_power_state(struct radeon_device *rdev) ...@@ -6050,6 +6081,13 @@ int si_dpm_set_power_state(struct radeon_device *rdev)
return ret; return ret;
} }
si_update_cg(rdev, (RADEON_CG_BLOCK_GFX |
RADEON_CG_BLOCK_MC |
RADEON_CG_BLOCK_SDMA |
RADEON_CG_BLOCK_BIF |
RADEON_CG_BLOCK_UVD |
RADEON_CG_BLOCK_HDP), true);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment