Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: reduce RLC safe mode request for gfx clock gating

The driver can only request one time for the power safe mode instead of
polling and disabling the power feature each time prior to program the
GFX clock gating control registers. This update will reduce the latency
on the GFX clock gating entry.

Signed-off-by: Prike Liang <Prike.Liang@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Prike Liang and committed by
Alex Deucher
2b11179e a5d258a0

+6 -20
+4 -8
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
··· 5639 5639 { 5640 5640 uint32_t temp, data; 5641 5641 5642 - amdgpu_gfx_rlc_enter_safe_mode(adev, 0); 5643 - 5644 5642 /* It is disabled by HW by default */ 5645 5643 if (enable && (adev->cg_flags & AMD_CG_SUPPORT_GFX_MGCG)) { 5646 5644 if (adev->cg_flags & AMD_CG_SUPPORT_GFX_MGLS) { ··· 5732 5734 /* 7- wait for RLC_SERDES_CU_MASTER & RLC_SERDES_NONCU_MASTER idle */ 5733 5735 gfx_v8_0_wait_for_rlc_serdes(adev); 5734 5736 } 5735 - 5736 - amdgpu_gfx_rlc_exit_safe_mode(adev, 0); 5737 5737 } 5738 5738 5739 5739 static void gfx_v8_0_update_coarse_grain_clock_gating(struct amdgpu_device *adev, ··· 5740 5744 uint32_t temp, temp1, data, data1; 5741 5745 5742 5746 temp = data = RREG32(mmRLC_CGCG_CGLS_CTRL); 5743 - 5744 - amdgpu_gfx_rlc_enter_safe_mode(adev, 0); 5745 5747 5746 5748 if (enable && (adev->cg_flags & AMD_CG_SUPPORT_GFX_CGCG)) { 5747 5749 temp1 = data1 = RREG32(mmRLC_CGTT_MGCG_OVERRIDE); ··· 5821 5827 } 5822 5828 5823 5829 gfx_v8_0_wait_for_rlc_serdes(adev); 5824 - 5825 - amdgpu_gfx_rlc_exit_safe_mode(adev, 0); 5826 5830 } 5827 5831 static int gfx_v8_0_update_gfx_clock_gating(struct amdgpu_device *adev, 5828 5832 bool enable) 5829 5833 { 5834 + amdgpu_gfx_rlc_enter_safe_mode(adev, 0); 5835 + 5830 5836 if (enable) { 5831 5837 /* CGCG/CGLS should be enabled after MGCG/MGLS/TS(CG/LS) 5832 5838 * === MGCG + MGLS + TS(CG/LS) === ··· 5840 5846 gfx_v8_0_update_coarse_grain_clock_gating(adev, enable); 5841 5847 gfx_v8_0_update_medium_grain_clock_gating(adev, enable); 5842 5848 } 5849 + 5850 + amdgpu_gfx_rlc_exit_safe_mode(adev, 0); 5843 5851 return 0; 5844 5852 } 5845 5853
+2 -12
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
··· 4964 4964 { 4965 4965 uint32_t data, def; 4966 4966 4967 - amdgpu_gfx_rlc_enter_safe_mode(adev, 0); 4968 - 4969 4967 /* It is disabled by HW by default */ 4970 4968 if (enable && (adev->cg_flags & AMD_CG_SUPPORT_GFX_MGCG)) { 4971 4969 /* 1 - RLC_CGTT_MGCG_OVERRIDE */ ··· 5028 5030 WREG32_SOC15(GC, 0, mmCP_MEM_SLP_CNTL, data); 5029 5031 } 5030 5032 } 5031 - 5032 - amdgpu_gfx_rlc_exit_safe_mode(adev, 0); 5033 5033 } 5034 5034 5035 5035 static void gfx_v9_0_update_3d_clock_gating(struct amdgpu_device *adev, ··· 5037 5041 5038 5042 if (!adev->gfx.num_gfx_rings) 5039 5043 return; 5040 - 5041 - amdgpu_gfx_rlc_enter_safe_mode(adev, 0); 5042 5044 5043 5045 /* Enable 3D CGCG/CGLS */ 5044 5046 if (enable) { ··· 5079 5085 if (def != data) 5080 5086 WREG32_SOC15(GC, 0, mmRLC_CGCG_CGLS_CTRL_3D, data); 5081 5087 } 5082 - 5083 - amdgpu_gfx_rlc_exit_safe_mode(adev, 0); 5084 5088 } 5085 5089 5086 5090 static void gfx_v9_0_update_coarse_grain_clock_gating(struct amdgpu_device *adev, 5087 5091 bool enable) 5088 5092 { 5089 5093 uint32_t def, data; 5090 - 5091 - amdgpu_gfx_rlc_enter_safe_mode(adev, 0); 5092 5094 5093 5095 if (enable && (adev->cg_flags & AMD_CG_SUPPORT_GFX_CGCG)) { 5094 5096 def = data = RREG32_SOC15(GC, 0, mmRLC_CGTT_MGCG_OVERRIDE); ··· 5127 5137 if (def != data) 5128 5138 WREG32_SOC15(GC, 0, mmRLC_CGCG_CGLS_CTRL, data); 5129 5139 } 5130 - 5131 - amdgpu_gfx_rlc_exit_safe_mode(adev, 0); 5132 5140 } 5133 5141 5134 5142 static int gfx_v9_0_update_gfx_clock_gating(struct amdgpu_device *adev, 5135 5143 bool enable) 5136 5144 { 5145 + amdgpu_gfx_rlc_enter_safe_mode(adev, 0); 5137 5146 if (enable) { 5138 5147 /* CGCG/CGLS should be enabled after MGCG/MGLS 5139 5148 * === MGCG + MGLS === ··· 5152 5163 /* === MGCG + MGLS === */ 5153 5164 gfx_v9_0_update_medium_grain_clock_gating(adev, enable); 5154 5165 } 5166 + amdgpu_gfx_rlc_exit_safe_mode(adev, 0); 5155 5167 return 0; 5156 5168 } 5157 5169